http://stackoverflow.com/q/21012771
possible better answer: http://stackoverflow.com/a/21012861
linked to: http://stackoverflow.com/q/6456007
has answer: http://stackoverflow.com/a/21012861
has title: Can we set two result types in struts-2?
duplicate of: http://stackoverflow.com/q/6456007
tagged with: struts2
has answer: http://stackoverflow.com/a/21013145
score: 0
has answer: http://stackoverflow.com/a/31414087
tagged with: tiles
has answer: http://stackoverflow.com/a/38642490
tagged with: jquery
has body: I have an application in which I am using tiles, but I am using ajax request too to get the response of type json and want to display it through tiles. Can I set both result-types in my struts.xml. I have tried this but failed... getCampData is there any solution to this???
accepted answer: http://stackoverflow.com/a/21013145
answer count: 4
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question

http://stackoverflow.com/q/20933425
tagged with: java
tagged with: mysql
has body: I am planning an app that needs to connect to a MySQL database. Can I use JDBC in my Codename One project and expect it to work in runtime? If Codename One does not support JDBC, could I implement a connection to MySQL using the native code (Objective-C) generated by Codename One? Then if that is not possible, could I connect my Codename One project to a php script that runs on the server next to the MySQL database?
type: Question
has answer: http://stackoverflow.com/a/20938112
has title: Can you use JDBC with Codename One?
tagged with: database
tagged with: codenameone
downvote count: 0
answer count: 1
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: jdbc
score: 2

classcastexception
tags question: http://stackoverflow.com/q/20983752
tags question: http://stackoverflow.com/q/20951847
type: Tag
tag name: classcastexception
tags question: http://stackoverflow.com/q/20868973

http://stackoverflow.com/q/20861588
downvote count: 1
type: Question
tagged with: oop
tagged with: jtextarea
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31298137
answer count: 2
tagged with: awt
has title: How can I append a JTextArea from a method that doesn't contain the JTextArea?
favorite count: 0
has answer: http://stackoverflow.com/a/20862393
possible better answer: http://stackoverflow.com/a/20861680
has body: I'm making some test code to practice OOP, and I want to append a JTextArea from the "writeToArea" to the "initialize" method where the JTextArea is defined and initialized. I already tried to directly call the "output" variable, but this returns an "output cannot be resolved" error. I want so that whenever I call the "writeToArea" method in the main class, I'll be able to add lines to the "output" JTextArea in the "initialize" method. Here's the main class: public class Pangea { public static void main(String[] args) { UI.initialize(); UI.writeToArea(); } } Here's the initialize class: import java.awt.BorderLayout; import java.awt.Color; import java.awt.Font; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JTextField; public class UI { static void initialize() { System.out.println("Initializing GUI."); JFrame frame = new JFrame(); Font myFont = new Font("Courier", Font.BOLD, 14); JTextField input = new JTextField(""); JTextArea output = new JTextArea("Initiated Succesfully."); output.setWrapStyleWord(true); output.setLineWrap(true); input.setFont(myFont); output.setFont(myFont); input.setForeground(Color.WHITE); output.setForeground(Color.WHITE); input.setBackground(Color.BLACK); input.setCaretColor(Color.WHITE); output.setBackground(Color.BLACK); output.setEditable(false); JScrollPane jp = new JScrollPane(output); frame.setTitle("PANGEA RPG [0.01 ALPHA][WIP]"); frame.setResizable(false); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(input, BorderLayout.SOUTH); frame.add(jp, BorderLayout.CENTER); frame.pack(); frame.setSize(800, 500); frame.setVisible(true); System.out.println("GUI Initialized."); } static void writeToArea() { System.out.println("\"writeToArea\" running."); output.append("Hello!"); System.out.println("\"writeToArea\" finished."); } } I've tried to do something similar to this: Updating jtextarea from another class but it didn't work. If anyone has any suggestions I'd be v…
has answer: http://stackoverflow.com/a/20861680
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20862393
upvote count: 2
linked to: http://stackoverflow.com/q/12359059
tagged with: swing

http://stackoverflow.com/comment/31303127
type: AnswerComment
score: 0
type: Comment
has text: @lovingjava You need to add the applet to the frame and not close the frame as a minimum.
comment on: http://stackoverflow.com/a/20863742

http://stackoverflow.com/a/20891362
has body: Yes, SBT only supports class name granularity. The reason for this is that most of the test frameworks SBT supports don't use one method per test, they use DSLs for tests, eg specs2 tests look like this: "The plus sign" should { "add two numbers" in { 2 + 3 === 5 } "be communatative" in { 1 + 2 === 2 + 1 } } And in fact these specs can be nested arbitrarily deep, they can have the same names as each other, they can be parameterized and reused arbitrarily, etc, to the point where specifying a single test and understanding what that should do from the command line doesn't make sense. So SBT has just provided support for what makes sense in all test frameworks, and that's class name granularity.
type: Answer
has comment: http://stackoverflow.com/comment/31359237
has comment: http://stackoverflow.com/comment/31357963
accepted answer of: http://stackoverflow.com/q/20865100
upvote count: 10
answers question: http://stackoverflow.com/q/20865100
type: AcceptedAnswer
downvote count: 0
score: 10

http://stackoverflow.com/comment/31465312
type: Comment
score: 0
comment on: http://stackoverflow.com/a/20946832
type: AnswerComment
has text: @user2818060: See [*How to Use Spinners*](http://docs.oracle.com/javase/tutorial/uiswing/components/spinner.html), and please don't shout.

http://stackoverflow.com/a/21000299
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/20999910
score: 0
has body: kurumi pointed out that you are using the wrong delimiter. You need to use strLine.split("."); Even with the "." delimiter your code will not consider special cases where filename itself has a "." in it. you are better off using a standard library like "FilenameUtils". Please refer to the following. How to get the filename without the extension in Java?
type: Answer

http://stackoverflow.com/comment/31409290
comment on: http://stackoverflow.com/a/20918488
type: Comment
has text: It's the Core API, and yes, that does seem to be the problem. I've updated my question. I wonder though, is there any disadvantage to just using the Java client in an Android app, as opposed to the Android client?
score: 0
type: AnswerComment

http://stackoverflow.com/q/20934747
type: Question
upvote count: 2
tagged with: htmlunit
has title: HtmlUnit get submit button from form by it's value?
answer count: 3
has answer: http://stackoverflow.com/a/20935681
accepted answer: http://stackoverflow.com/a/20935681
possible better answer: http://stackoverflow.com/a/20935024
favorite count: 0
has answer: http://stackoverflow.com/a/20935024
has body: &lt;input type="submit" class="submit-button" style="white-space:normal" value="hello world!"&gt; This is how the HTML submit button works, in HTMLUNIT I already got the form, using the list: HtmlForm form = this.page.getForms().get(0); But now the site im trying to load doesn't have id or name on the submit button, just a class &amp; a value. I tried doing this: HtmlButton button = (HtmlButton) page.getByXPath("/html/body//form//input[@type='submit' and @value='Hello world!']"); But when it loads, I get this error: Exception in thread "Thread-1" java.lang.ClassCastException: java.util.ArrayList cannot be cast to com.gargoylesoftware.htmlunit.html.HtmlButton at Web.getButton(Web.java:78) at java.lang.Thread.run(Unknown Source) How can I get button without id or value?
has answer: http://stackoverflow.com/a/20956266
downvote count: 0
score: 2
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/31283253
type: QuestionComment
type: Comment
has text: i tried without comma but it prompt out syntax error in query expression
score: 0
comment on: http://stackoverflow.com/q/20853630

http://stackoverflow.com/comment/31457046
score: 0
type: Comment
has text: thanks . Also as I asked in the question , do you have any idea how would I remove the three dots in the corner ? . The one which invokes the option menu
type: AnswerComment
comment on: http://stackoverflow.com/a/20945462

http://stackoverflow.com/comment/139486790
type: Comment
type: AnswerComment
has text: Try to add this to the headers dictionary: 'Accept-Language': 'en-US,en;q=0.8,pt-BR;q=0.5,pt;q=0.3'
score: 0
comment on: http://stackoverflow.com/a/20913840

http://stackoverflow.com/a/20888010
has comment: http://stackoverflow.com/comment/31349723
score: 0
has body: The first step to debug this would be to see if you have the correct port. So do this - Try accessing just - http: //localhost:9081 . see if you get to default page or blank page or hello page if there is default index.jsp. If you get 404 then that means that you serever is running but your port number is incorrect. If you are unsure what your port settings are(If I am correct then default port should be 9080) then follow this documentation - http://pic.dhe.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=%2Fcom.ibm.websphere.migration.nd.doc%2Finfo%2Fae%2Fae%2Frmig_portnumber.html
type: Answer
answers question: http://stackoverflow.com/q/20887406

http://stackoverflow.com/a/20983098
answers question: http://stackoverflow.com/q/20980427
has body: Besides your XML, you will need an Adaptor and a ListView of some kind. In your Adapter you will have to implement public View getView(int position, View convertView, ViewGroup parent) In this method, return your new view (Probably created with LayoutInflator and your xml) and update that data displayed on each button/text view. Make sure to research how convertView works. If your lists are long, the performance boost from using convertView properly is huge. If you get this correct, Android's listview and baseadpater will do the hard work for you.
type: Answer
score: 0

http://stackoverflow.com/comment/31530331
comment on: http://stackoverflow.com/q/20983642
type: QuestionComment
has text: There has to be a no-arg constructor otherwise the code will not compile...
score: 0
type: Comment

stack-overflow
tags question: http://stackoverflow.com/q/20899689
tag name: stack-overflow
type: Tag
tags question: http://stackoverflow.com/q/20987556
tags question: http://stackoverflow.com/q/20937907

http://stackoverflow.com/comment/31818265
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21024445
has text: I need the operation (insert/update) enrolled in a transaction because it involves modification in other entities. So, in service layer the method is adorned with @Transactional(propagation=Propagation.REQUIRES_NEW) attribute. When the repository is called its operations are inside a transaction.
type: Comment

http://stackoverflow.com/q/20937270
tagged with: parsing
has answer: http://stackoverflow.com/a/20939272
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21405112
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/31445399
has answer: http://stackoverflow.com/a/20937398
tagged with: java
has comment: http://stackoverflow.com/comment/31441602
type: Question
has body: This is my problem: i need to extract the text between the tag "p" without the XML notation using SAX Parser 1. Introduction The Lorem ipsum 1 . Lorem ipsum 23. The L domain recruits an ATP-requiring cellular factor for this scission event, the only known energy-dependent step in assembly 2 . Domain is used here to denote the amino acid sequence that constitutes the biological function. Is it possible using endElement() ? Because when i use it i obtain only the part after "/xref" tag Here the code public void endElement(String s, String s1, String element) throws SAXException { if(element.equals(Finals.PARAGRAPH)){ Paragraph paragraph = new Paragraph(); paragraph.setContext(tmpValue); System.out.println("Contesto: " + tmpValue); listP.add(paragraph); } } @Override public void characters(char[] ac, int i, int j) throws SAXException { tmpValue = new String(ac, i, j); } This is what i expect to do: a list listP containing the two paragraphs: 1) Lorem ipsum 1 Lorem ipsum 23. 2) The L domain recruits an ATP-requiring cellular factor for this scission event, the only known energy-dependent step in assembly 2 Domain is used here to denote the amino acid sequence that constitutes the biological function.
has title: SAX Parser - Extract string within tags
score: 0
tagged with: saxparser
answer count: 3
has comment: http://stackoverflow.com/comment/31445069

http://stackoverflow.com/a/20869570
type: Answer
answers question: http://stackoverflow.com/q/20869559
has body: Arrays are zero-based in Java (and most languages). If you have an array of size N, the indexes will be from [0, N-1] (Total size of N). i &lt;= alist .size() should be i &lt; alist .size() ↑ No "=" Why don't you simply use toArray?
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/31313370
downvote count: 0

http://stackoverflow.com/a/43979961
score: 1
upvote count: 1
has body: You should install the font first or download https://keyman.com/desktop/ Amharic's keyboards or other Amharic's keyboard. Open eclipse window > preferece > General > Appearance > Colors and Fonts preference page. Select the font you want to change Font font = new Font("Your new Amharic installed font and appear in the font list ", Font.PLAIN, 12); public class Text { public static void main(String[] args) { ``// TODO Auto-generated method stub Font font = new Font("Abyssinica SIL", Font.PLAIN, 12); JTextArea txt = new JTextArea(20,10); JTextField txtField = new JTextField(10);`` txtField.setFont(font); txt.setFont(font); JFrame frame = new JFrame(" አማረኛ ሙክራ "); frame.setLayout(new FlowLayout(FlowLayout.LEFT)); frame.setSize(400, 400); frame.add(txt); frame.add(txtField); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20956017

http://stackoverflow.com/q/20917653
type: Question
tagged with: aspectj
downvote count: 0
tagged with: tomcat
favorite count: 0
answer count: 0
has comment: http://stackoverflow.com/comment/31404220
type: UnansweredQuestion
has title: Running AspectJ compiler in Tomcat
has body: I wanna use the AOP(aspect oriented programming) while running tomcat. I don't want using spring aop. so I search for the way how the aspectj works. finally, I found the way which is posted on eclipse forum. I downloaded aspectj component at the eclipse hompage. next, I copy three libraries, 'aspectjrt.jar' 'aspectjtools.jar', 'aspectjweaver', and paste to tomcat's lib folder. After all, I edited web.xml. adding following code at the jsp servlet part. compiler org.aspectj.tools.ant.taskdefs.Ajc11CompilerAdapter I think this adding code will be run when loading jsp pages for using ajc. Next, Command line set up of variables, I add next code at 'catalina.bat'. Set CATALINA_OPTS=-Dorg.aspectj.tools.ant.taskdefs.AjcTask.COMMAND_EDITOR=ajee.adapters.AutoAspectpathRewriter Finally, I make the aspect code contained pointcut and advices, and move it tomcat lib folder. As a result, aspect code did not execute. while writing the aspect code, I tested it and confirmed working it. maybe, it isn't caused by aspect code.
upvote count: 1
score: 1
tagged with: java

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/20933233
tags question: http://stackoverflow.com/q/20893480
tags question: http://stackoverflow.com/q/20953319
tags question: http://stackoverflow.com/q/20944719
tag name: jfreechart
tags question: http://stackoverflow.com/q/20966205
tags question: http://stackoverflow.com/q/20884694

http://stackoverflow.com/comment/65670253
comment on: http://stackoverflow.com/a/21843984
has text: Your post contains statements such as "Without erasure there's runtime information that's carried with the implementation that we can use to design our algorithms". This implies that _with_ erasure, there's no runtime type information. This is either false, or inapplicable to Java because it _does_ have "type erasure" and also _does_ carry runtime type information. You say "not erasing leads to abuses", as if Java _prevents_ abuses by sporting erasure. All this leads me to characterize your post as off-topic at best (applying to true erasure), but misleading would be a more honest description.
type: AnswerComment
score: 4
type: Comment

http://stackoverflow.com/q/20964500
answer count: 1
score: 0
has body: I have this JavaScript code which is connecting with the service and sending back the result. Now the requirement is to call the same service from Pure Java. Below is the javascript code for calling the service. If some one can guide me to convert this Javascript to Java in my GWT Application Thanks function verifyValidationSyntax(textToValidate) { var url = "https://validation-grammar.example.com/validation_grammar_service/rest/validation_step_validation"; var client = new XMLHttpRequest(); client.open("POST", url, false); client.setRequestHeader("Content-Type", "text/plain"); client.send(textToValidate); if (client.responseText==='true') { return "true"; } else { return "false"; } }
type: UnansweredQuestion
tagged with: gwt
tagged with: java
type: Question
has title: calling some online service from GWT
has answer: http://stackoverflow.com/a/20964534

http://stackoverflow.com/comment/31410561
score: 0
comment on: http://stackoverflow.com/q/20921046
type: QuestionComment
type: Comment
has text: what is the criteria on which you decide you want to display items(some items)?

jar
tags question: http://stackoverflow.com/q/20879407
tags question: http://stackoverflow.com/q/20870046
tags question: http://stackoverflow.com/q/20937016
tags question: http://stackoverflow.com/q/20896538
tags question: http://stackoverflow.com/q/20976122
tags question: http://stackoverflow.com/q/21011309
tags question: http://stackoverflow.com/q/20991963
tags question: http://stackoverflow.com/q/20995133
tags question: http://stackoverflow.com/q/20993850
tags question: http://stackoverflow.com/q/21008982
tags question: http://stackoverflow.com/q/20933782
tags question: http://stackoverflow.com/q/20954659
tags question: http://stackoverflow.com/q/20862365
tags question: http://stackoverflow.com/q/20932438
tags question: http://stackoverflow.com/q/20933367
tags question: http://stackoverflow.com/q/20954322
tags question: http://stackoverflow.com/q/20990534
tags question: http://stackoverflow.com/q/20862102
type: Tag
tags question: http://stackoverflow.com/q/20976018
tags question: http://stackoverflow.com/q/20952200
tags question: http://stackoverflow.com/q/21016422
tags question: http://stackoverflow.com/q/20953126
tags question: http://stackoverflow.com/q/20858109
tags question: http://stackoverflow.com/q/20936174
tags question: http://stackoverflow.com/q/20955512
tags question: http://stackoverflow.com/q/20936163
tags question: http://stackoverflow.com/q/20885143
tag name: jar
tags question: http://stackoverflow.com/q/21003086
tags question: http://stackoverflow.com/q/20875898
tags question: http://stackoverflow.com/q/20998414
tags question: http://stackoverflow.com/q/20993915
tags question: http://stackoverflow.com/q/20913149
tags question: http://stackoverflow.com/q/21004983
tags question: http://stackoverflow.com/q/20861539
tags question: http://stackoverflow.com/q/20865750
tags question: http://stackoverflow.com/q/20991463
tags question: http://stackoverflow.com/q/20957441
tags question: http://stackoverflow.com/q/21001486
tags question: http://stackoverflow.com/q/20994766
tags question: http://stackoverflow.com/q/20965106
tags question: http://stackoverflow.com/q/21000685
tags question: http://stackoverflow.com/q/21016350
tags question: http://stackoverflow.com/q/20931363
tags question: http://stackoverflow.com/q/20981447

java
tags question: http://stackoverflow.com/q/21011199
tags question: http://stackoverflow.com/q/21005908
tags question: http://stackoverflow.com/q/20881551
tags question: http://stackoverflow.com/q/20931194
tags question: http://stackoverflow.com/q/20954170
tags question: http://stackoverflow.com/q/20878902
tags question: http://stackoverflow.com/q/20909339
tags question: http://stackoverflow.com/q/20918613
tags question: http://stackoverflow.com/q/20937893
tags question: http://stackoverflow.com/q/20967518
tags question: http://stackoverflow.com/q/20873005
tags question: http://stackoverflow.com/q/21004488
tags question: http://stackoverflow.com/q/20942757
tags question: http://stackoverflow.com/q/20913120
tags question: http://stackoverflow.com/q/20939759
tags question: http://stackoverflow.com/q/20959399
tags question: http://stackoverflow.com/q/20926989
tags question: http://stackoverflow.com/q/20994989
tags question: http://stackoverflow.com/q/20934885
tags question: http://stackoverflow.com/q/20869398
tags question: http://stackoverflow.com/q/20905219
tags question: http://stackoverflow.com/q/21018025
tags question: http://stackoverflow.com/q/21007061
tags question: http://stackoverflow.com/q/20949678
tags question: http://stackoverflow.com/q/20966666
tags question: http://stackoverflow.com/q/20979282
tags question: http://stackoverflow.com/q/20855167
tags question: http://stackoverflow.com/q/20855376
tags question: http://stackoverflow.com/q/20863805
tags question: http://stackoverflow.com/q/20967693
tags question: http://stackoverflow.com/q/20891532
tags question: http://stackoverflow.com/q/20868891
tags question: http://stackoverflow.com/q/20937225
tags question: http://stackoverflow.com/q/20952641
tags question: http://stackoverflow.com/q/20941270
tags question: http://stackoverflow.com/q/20986983
tags question: http://stackoverflow.com/q/20933211
tags question: http://stackoverflow.com/q/20896312
tags question: http://stackoverflow.com/q/20911338
tags question: http://stackoverflow.com/q/20976847
tags question: http://stackoverflow.com/q/20924414
tags question: http://stackoverflow.com/q/20858109
tags question: http://stackoverflow.com/q/20853488
tags question: http://stackoverflow.com/q/20955539
tags question: http://stackoverflow.com/q/20946897
tags question: http://stackoverflow.com/q/20959489
tags question: http://stackoverflow.com/q/20868029
tags question: http://stackoverflow.com/q/20959805
tags question: http://stackoverflow.com/q/21007613
tags question: http://stackoverflow.com/q/21018083
tags question: http://stackoverflow.com/q/20974043
tags question: http://stackoverflow.com/q/20875546
tags question: http://stackoverflow.com/q/21006471
tags question: http://stackoverflow.com/q/20902662
tags question: http://stackoverflow.com/q/20976249
tags question: http://stackoverflow.com/q/20880096
tags question: http://stackoverflow.com/q/20973437
tags question: http://stackoverflow.com/q/20950182
tags question: http://stackoverflow.com/q/20902212
tags question: http://stackoverflow.com/q/20974519
tags question: http://stackoverflow.com/q/20919389
tags question: http://stackoverflow.com/q/20910986
tags question: http://stackoverflow.com/q/21011915
tags question: http://stackoverflow.com/q/20972412
tags question: http://stackoverflow.com/q/20987716
tags question: http://stackoverflow.com/q/20873104
tags question: http://stackoverflow.com/q/20991918
tags question: http://stackoverflow.com/q/20974220
tags question: http://stackoverflow.com/q/20988142
tags question: http://stackoverflow.com/q/20945662
tags question: http://stackoverflow.com/q/21013890
tags question: http://stackoverflow.com/q/21016067
tags question: http://stackoverflow.com/q/20908632
tags question: http://stackoverflow.com/q/20967315
tags question: http://stackoverflow.com/q/20955873
tags question: http://stackoverflow.com/q/20966185
tags question: http://stackoverflow.com/q/20923062
tags question: http://stackoverflow.com/q/20944368
tags question: http://stackoverflow.com/q/20999792
tags question: http://stackoverflow.com/q/20903046

http://stackoverflow.com/a/20969678
answers question: http://stackoverflow.com/q/20969555
type: Answer
has comment: http://stackoverflow.com/comment/31502479
has body: Whether you use a 64-bit JVM or a 32-bit JVM the contents of the file don't change so you are looking for the same thing. RandomAccessFile is designed for binary files and so you can only read bytes, not characters. You have to do the translation from bytes to characters. In short, you read the same bytes in either case and talking about characters is just down to how you see them as characters, only bytes are meaningful.
has comment: http://stackoverflow.com/comment/31503109
score: 0
accepted answer of: http://stackoverflow.com/q/20969555
type: AcceptedAnswer

http://stackoverflow.com/comment/31586897
score: 1
has text: are you using emulator or real device?
comment on: http://stackoverflow.com/q/21015342
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31372487
type: Comment
comment on: http://stackoverflow.com/a/20864378
has text: Yes you can do that, and I am. Which is what led to this question, its very efficient for me to just get the book title and include it with the chapter, so that is why I mentioned that it was not OO to have the title with the chapter. There are two alternatives, 1) get the book id, instantiate the book, and attach it to the chapter, or 2) get all of the book fields in the FTS query by a join and instantiate using them instead of of a new query, however this does not feel right, and the the first approach is slow... which brings me back to why I asked.
type: AnswerComment
score: 0

http://stackoverflow.com/q/20955912
has answer: http://stackoverflow.com/a/20956045
answer count: 4
tagged with: list
has comment: http://stackoverflow.com/comment/31476451
score: 0
tagged with: loops
has body: I am trying to make kind of highscores in Java. Basically I want a hashmap to hold the double value (so index starts from the highest double, so it's easier for me to sort highscores) and then the second value will be the client object, like this: private HashMap&lt;Double, TempClient&gt; players = new HashMap&lt;Double, TempClient&gt;(); And to insert a new value: TempClient client = new TempClient(kills, rank, deaths, name); this.players.put(client.getKdr(), client); Now, of course I can't iterate through the hashmap because it gets the list item by key, not index. How can I iterate through a hashmap? or any good ideas for my case? I tried it in a Foo class: Output: 0.5 0.6 0.9 0.1 2.5 Code: public class Foo { public static void main(String[] args) { HashMap&lt;Double, String&gt; map = new LinkedHashMap&lt;Double, String&gt;(); map.put(0.5, "hey"); map.put(0.6, "hey1"); map.put(0.9, "hey2"); map.put(0.1, "hey425"); map.put(2.5, "hey36"); for (Double lol : map.keySet()) { System.out.println(lol); } } }
type: Question
has answer: http://stackoverflow.com/a/20955941
tagged with: java
has answer: http://stackoverflow.com/a/20956057
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20956058
has comment: http://stackoverflow.com/comment/31476381
has title: Iterate through a hashmap?

http://stackoverflow.com/a/20980062
has body: Use SharedPreferences for this purpose it is much better for performance here Vogella has some good tutorial for this , and android provide one too , it is much easier to detect duplicates too
has comment: http://stackoverflow.com/comment/31522244
score: 0
has comment: http://stackoverflow.com/comment/31522079
type: Answer
has comment: http://stackoverflow.com/comment/31522305
answers question: http://stackoverflow.com/q/20979667

http://stackoverflow.com/a/21015355
answers question: http://stackoverflow.com/q/21015318
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/31586842
type: Answer
score: 4
has body: This should work ArrayList&lt;ArrayList&lt;String&gt;&gt; a = new ArrayList&lt;ArrayList&lt;String&gt;&gt;(); List&lt;String&gt; result = new ArrayList&lt;String&gt;(); for (ArrayList&lt;String&gt; arrayList : a) { result.addAll(arrayList); } Look into main loop and get each list in it and add to your result list.

amazon-ec2
tags question: http://stackoverflow.com/q/20982448
type: Tag
tags question: http://stackoverflow.com/q/20928655
tags question: http://stackoverflow.com/q/20984261
tag name: amazon-ec2

http://stackoverflow.com/q/21006136
downvote count: 0
has comment: http://stackoverflow.com/comment/31570514
tagged with: java
has answer: http://stackoverflow.com/a/43541119
has answer: http://stackoverflow.com/a/75486671
type: Question
has comment: http://stackoverflow.com/comment/31616199
upvote count: 159
has answer: http://stackoverflow.com/a/63486989
has answer: http://stackoverflow.com/a/21006225
linked to: http://stackoverflow.com/q/25888023
has body: Despite specifying JDK 1.7 in all project settings (including in File -&gt; Project Structure -&gt; Project :: Project SDK), the following error is produced by IntelliJ 13 when trying to compile some simple Java 7 code which does use the diamond operator: java: diamond operator is not supported in -source 1.5 (use -source 7 or higher to enable diamond operator) Is there any other place in the configuration where the expected -source 7 option should be enabled?
has title: IntelliJ IDEA 13 uses Java 1.5 despite setting to 1.7
has answer: http://stackoverflow.com/a/21006230
tagged with: compilation
has answer: http://stackoverflow.com/a/26920121
linked to: http://stackoverflow.com/q/21747254
accepted answer: http://stackoverflow.com/a/26920121
has comment: http://stackoverflow.com/comment/44585652
has comment: http://stackoverflow.com/comment/58553172
has answer: http://stackoverflow.com/a/29953590
has answer: http://stackoverflow.com/a/43268486
linked to: http://stackoverflow.com/q/27037657
has comment: http://stackoverflow.com/comment/60301593
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/41058715
has answer: http://stackoverflow.com/a/58007386
has comment: http://stackoverflow.com/comment/63081088
favorite count: 0
has answer: http://stackoverflow.com/a/71182778
score: 159
has answer: http://stackoverflow.com/a/43455770
possible better answer: http://stackoverflow.com/a/21006225
has comment: http://stackoverflow.com/comment/55050407
has answer: http://stackoverflow.com/a/37297419
has answer: http://stackoverflow.com/a/44630234
has answer: http://stackoverflow.com/a/56329434
has comment: http://stackoverflow.com/comment/53891649
answer count: 15
type: AnsweredQuestion

http://stackoverflow.com/q/20894009
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/31364828
has body: I want to get distinct values from my db. I have 10 fields in this db, and when i try to use such query: SELECT DISTINCT (IMIE)FROM `przychodzace` I get 26 results, but hibernate returns me just 17... Here is list function: List&lt;String&gt; list = new ArrayList&lt;String&gt;(); SessionFactory sf = HibernateUtil.getSessionFactory(); Session session = sf.openSession(); Criteria criteria = session.createCriteria(PrzychodzaceModel.class); if (i == 0) { criteria.setProjection(Projections.distinct(Projections.property("imie"))); criteria.addOrder(Order.asc("imie")); } list = criteria.list(); System.out.println(list.size() + "size"); return list; Have anyone idea how to do it properly, i am trying to correct it for long time. Thanks in advance.
tagged with: java
tagged with: hibernate
tagged with: mysql
upvote count: 1
has title: hibernate select distinct values order by one value
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31360308
tagged with: sql
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/24618002

http://stackoverflow.com/comment/31566312
score: 1
type: AnswerComment
has text: You will have to keep a vector in memory that is the vertical perpendicular to the straight direction and keep it updated for all movements. Or, calculate the vertical position based on the values of the forward position and rotation of the craft. I think keeping a vector in memory that is modified would be easiest with the current code.
type: Comment
comment on: http://stackoverflow.com/a/21003543

http://stackoverflow.com/q/20852921
downvote count: 0
tagged with: jsp
tagged with: jquery
tagged with: struts2
tagged with: ajax
upvote count: 2
answer count: 1
favorite count: 0
type: UnansweredQuestion
has body: I am doing an AJAX call and using Struts 2 JSON plugin. When the code reaches success() of AJAX call, I don't know how to differentiate whether I should load the success data or load message or errors, which I want to display it to the user if something unusual happened during the AJAX call. As code always reaches success() until the AJAX request itself fails. How can I achieve this? EDIT: I came up with one idea which was to send a String too with response to Ajax and check string value (i.e) if string is set to success load the other JSON parameter returned, if error I load error.jsp
has answer: http://stackoverflow.com/a/20857989
has title: Differentiate between success data and error message to use in Struts 2?
linked to: http://stackoverflow.com/q/20856712
score: 2
tagged with: java
type: Question

http://stackoverflow.com/a/20872168
has comment: http://stackoverflow.com/comment/31318682
has comment: http://stackoverflow.com/comment/31327926
has comment: http://stackoverflow.com/comment/31319262
score: 0
has comment: http://stackoverflow.com/comment/31379213
upvote count: 1
downvote count: 1
has body: You may want to use Runtime.addShutdownHook. A Shutdown Hook allow you to execute a thread before the VM shuts down. Here is a small usage example : public class Foo { public static void main(String... args) { Runtime.getRuntime().addShutdownHook( new Thread() { public void run() { System.out.println("Hello"); } } ); } }
type: Answer
answers question: http://stackoverflow.com/q/20872118
has comment: http://stackoverflow.com/comment/31318972
has comment: http://stackoverflow.com/comment/31318916

http://stackoverflow.com/q/20895099
type: Question
linked to: http://stackoverflow.com/q/9588827
tagged with: java
has answer: http://stackoverflow.com/a/20900290
has answer: http://stackoverflow.com/a/20901717
score: 0
has title: How to close the new windows in firefox that open after extracting elements from div using webdriver?
answer count: 2
has comment: http://stackoverflow.com/comment/31361770
possible better answer: http://stackoverflow.com/a/20901717
has comment: http://stackoverflow.com/comment/31362754
has comment: http://stackoverflow.com/comment/31361877
has body: Webdriver launches multiple windows after performing click action. I have tried driver.close() but it close the webdriver and test fails. WebDriver driver = new FirefoxDriver (); driver.get("http://www.xyz.com/"); JavascriptExecutor js = (JavascriptExecutor) driver; WebElement page = driver.findElement(By.className("coupon-rows")); List &lt;WebElement&gt; coupontrigger = page.findElements(By.className("code")); System.out.println("number of couponsTriggers on carousel = "+ "coupontrigger.size()); for (int j=0; j&lt;=coupontrigger.size(); j++) { js.executeScript("$('.ccode.coupon-trigger').eq("+j+").click()"); System.out.println(driver.getTitle()); driver.switchTo().defaultContent(); driver.get("http://www.xyz.com/"); page = driver.findElement(By.className("coupon-rows")); coupontrigger = page.findElements(By.className("code")); } }
tagged with: selenium-webdriver
type: AnsweredQuestion
tagged with: selenium
accepted answer: http://stackoverflow.com/a/20900290

http://stackoverflow.com/q/20881572
tagged with: android
tagged with: textview
answer count: 4
has body: Hello I have 3 Type of textViews in my Layout with same Dynamic text but there is only one Difference between them i.e. . Postion . I wanted to show and hide them according to Button Click . but the problem problem occurs when I have to write the same code for five Different TextViews with only one TEXT . Kindly Suggest me Efficient way which could reduce the number of line in my JAVA code. temperature.setText(temp); txt.setText(Name); descptxt.setText(descp); temperature3.setText(temp); txt3.setText(Name); descptxt3.setText(descp); temperature4.setText(temp); txt4.setText(Name); descptxt4.setText(descp); the number of TextViews will be increase in Future . I am worried about writing same Boiler Plate Code again and Agian
has answer: http://stackoverflow.com/a/20881775
has answer: http://stackoverflow.com/a/20882183
possible better answer: http://stackoverflow.com/a/20881803
type: AnsweredQuestion
tagged with: android-layout
has answer: http://stackoverflow.com/a/20881803
tagged with: performance
tagged with: java
accepted answer: http://stackoverflow.com/a/20881775
type: Question
has title: android setText() multiple textViews
has answer: http://stackoverflow.com/a/20881952
score: 0

http://stackoverflow.com/q/20906564
has answer: http://stackoverflow.com/a/20906671
tagged with: java
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/20906741
has comment: http://stackoverflow.com/comment/31382413
has comment: http://stackoverflow.com/comment/31382486
linked to: http://stackoverflow.com/q/1732348
has body: I have a white list of HTML end tags (br, b, i, div):- String whitelist = "([^br|^b|^i|^div])"; String endTagPattern = "(<[ ]*/[ ]*)" + whitelist + "(>?).*?([^>]+>)"; ... html = html.replaceAll(endTagPattern, "[r]"); Which takes my test String and removes the end tags of those not in the white list, in this case replaced by [r] for clarity:- 1. bold, 2. italic, 3. strong, 4. div , 5. 1. bold, 2. italic, 3. strong[r], 4. div , 5. script[r] If I add strong to this white list String whitelist = "([^br|^b|^i|^div|^strong])"; Not only does it not match the strong end tag, it also stops matching that of the end script tag or any other for that matter. My question is, why?
tagged with: regex
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31382519
has answer: http://stackoverflow.com/a/20906741
has title: Why does regex only match a string when others are present?
has comment: http://stackoverflow.com/comment/31382538
type: Question
possible better answer: http://stackoverflow.com/a/20906671

http://stackoverflow.com/a/20995408
answers question: http://stackoverflow.com/q/20995118
downvote count: 0
has comment: http://stackoverflow.com/comment/43299391
type: Answer
has body: try multipart entity public void upload(String filepath) throws IOException { HttpClient httpclient = new DefaultHttpClient(); httpclient.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1); HttpPost httppost = new HttpPost("url"); File file = new File(filepath); MultipartEntity mpEntity = new MultipartEntity(); ContentBody cbFile = new FileBody(file, "image/jpeg"); mpEntity.addPart("userfile", cbFile); httppost.setEntity(mpEntity); System.out.println("executing request " + httppost.getRequestLine()); HttpResponse response = httpclient.execute(httppost); HttpEntity resEntity = response.getEntity(); // check the response and do what is required }
score: 4
upvote count: 4

http://stackoverflow.com/q/20936134
has answer: http://stackoverflow.com/a/20938117
accepted answer: http://stackoverflow.com/a/20938117
upvote count: 1
answer count: 1
tagged with: conflict
favorite count: 0
tagged with: dependency-management
type: AnsweredQuestion
has body: I have 2 java projects: capturingapp and epcis-queryclient. These are open source projects which I imported in Eclipse. capturingapp runs in Tomcat. epcis-queryclient is nested in capturingapp (i.e. it is listed in the Projects tab in Java Build Path in Eclipse) epcis-queryclient uses the cxf-rt-transports-http-2.2.9.jar library. capturingapp uses the cxf-rt-transports-http-2.6.1.jar library. I have an error at runtime: capturingapp calls a method present in epcis-queryclient which needs the ClientOnlyHTTPTransportFactory class (present in v2.2.9 of cxf), but it fails because it looks in v2.6.1 which does not contain that class anymore. How could I solve this situation? Thanks! Roberto
downvote count: 0
tagged with: cxf
score: 1
tagged with: java
has title: Conflicting CXF jar version between a Java project and a nested project
tagged with: eclipse
type: Question

http://stackoverflow.com/a/20866221
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31307338
has comment: http://stackoverflow.com/comment/31307432
has comment: http://stackoverflow.com/comment/31307394
type: Answer
has comment: http://stackoverflow.com/comment/31307213
score: 1
has comment: http://stackoverflow.com/comment/31307393
has comment: http://stackoverflow.com/comment/31307364
accepted answer of: http://stackoverflow.com/q/20866174
answers question: http://stackoverflow.com/q/20866174
has body: You just set Intent when you add tab like a below: // Tab for Photos TabSpec photospec = tabHost.newTabSpec("Photos"); // setting Title and Icon for the Tab photospec.setIndicator("Photos", getResources().getDrawable(R.drawable.icon_photos_tab)); Intent photosIntent = new Intent(this, PhotosActivity.class); photospec.setContent(photosIntent); For more information go to this link:Android tab layout tutorial

http://stackoverflow.com/comment/31435190
type: QuestionComment
comment on: http://stackoverflow.com/q/20934097
has text: Duplicate of http://stackoverflow.com/questions/4240080/generating-all-permutations-of-a-given-string
score: 0
type: Comment

http://stackoverflow.com/a/20902037
upvote count: 1
has body: Your code is incomplete, so it's difficult to say with certainty, but observe that in the Handler's constructor a thread is created and started, which executes run(). Inside that function (and therefore in a separate thread), the input stream is read from the socket into a BufferedReader, from which the first line is obtained. The thread will block until a line is received over the socket connection. Because your code is cut off from that point, I can't say what else it does.
type: Answer
has comment: http://stackoverflow.com/comment/31375396
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20901796

http://stackoverflow.com/comment/31355037
type: QuestionComment
has text: Is it possible that you try to access the value of `values` directly after calling `new GetRoutes().execute("test");`? I.e. not waiting for the async result set by `onPostExecute` (the code that uses the result must be triggered from `onPostExecute`)
score: 1
comment on: http://stackoverflow.com/q/20891374
type: Comment

http://stackoverflow.com/q/20999991
has title: Exception while trying to execute axis2 service client
score: 0
has body: I am using Axis2 Wsdl2java from SOAP based service which is hosted on IIS. I have set requestHeader first and then tried to execute Create method in client that accepts two parameters payload xml as OMElement and requesType as string but getting exception as below. org.apache.axis2.AxisFault: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.InvalidCastException: Unable to cast object of type 'System.Xml.XmlNode[]' to type 'System.String'. can someone please help me to understand the problem with code below or why I am getting above exception? Please see below my client code: package net.approva.BizRights.Services; public class Client{ public static void main(java.lang.String args[]){ try { ApprovalRequestManagerStub stub = new ApprovalRequestManagerStub("serverurl.asmx"); Create(stub); } catch(Exception e) { e.printStackTrace(); System.out.println("\n\n\n"); } } /* Create */ public static void Create(ApprovalRequestManagerStub stub){ try { net.approva.BizRights.Services.ApprovalRequestManagerStub.Create req = new Create(); java.lang.String content = " USER 002371(ABC) OnlyWhatIfAnalysis SubmittedForWhatIf Medium 2 SAP AI Connection NoConstraints 591 ABC 002371 USER 1900-01-01 1900-01-01 3172 SAP_ICM_S_CUST 1900-01-02T00:00:00 1900-01-01T00:00:00 4 Commissions: Customizing SAP AI Connection <comment /><asanotheruser /> 1 administrator 1 <analysisresults /> administrator SAP AI Connection 1 "; org.apache.axiom.om.OMFactory fac = org.apache.axiom.om.OMAbstractFactory.getOMFactory(); org.apache.axiom.om.OMNamespace omNs = fac.createOMNamespace("http://www.approva.net/BizRights/Services", null); org.apache.axiom.om.OMElement _valueObjXML = fac.createOMElement("approvalrequests", omNs); _valueObjXML.addChild(fac.createOMText(_valueObjXML, content)); req.setObjXML(_valueObjXML); System.out.println(_valueObjXML.getText()); req.setObjType(WellKnownType.ApprovalRequest); BRSoapHeader brSOAP = new BRSoapHeader(); brSOAP.setProfileI…
has answer: http://stackoverflow.com/a/21001566
type: UnansweredQuestion
tagged with: soap
tagged with: web-services
tagged with: java
tagged with: apache-axis
type: Question
has comment: http://stackoverflow.com/comment/31559059
answer count: 1

http://stackoverflow.com/comment/31356022
score: 2
comment on: http://stackoverflow.com/q/20892170
has text: Resampling takes time; try it without the scaling.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20907564
answer count: 1
has answer: http://stackoverflow.com/a/20907674
type: AnsweredQuestion
has title: How to pass parameter to XSLT from java code
tagged with: java
accepted answer: http://stackoverflow.com/a/20907674
tagged with: xslt
type: Question
linked to: http://stackoverflow.com/q/1667454
linked to: http://stackoverflow.com/q/1384802
has comment: http://stackoverflow.com/comment/31384632
tagged with: xslt-2.0
score: 0
has body: I want to pass the parameter from java application for the indent attribute as below. I can pass it from java code without any issue but defining the parameter in xslt is an issue. I did the sample below: &lt;xsl:param select="'yes'"&gt; &lt;xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="yes" indent="{$indent}" /&gt; But when I use like above I am getting the error saying the way I defined the attribute indent is invalid. Please help me to resolve this issue.

http://stackoverflow.com/comment/31547107
type: AnswerComment
has text: I chose the other comment as answer because i think it was the first to arrive. Both your answers do fix my problem tho, so i would also like to thank you for your effort. It is very much appreciated.
type: Comment
comment on: http://stackoverflow.com/a/20993181
score: 0

http://stackoverflow.com/q/20868167
tagged with: parameters
score: 2
tagged with: java
has body: I would like to pass String array and String variable to my AsyncTask class. I am new to programming android apps so It is possible that this is not the most efficient way to achieve my goal. Anyways, I have String array called separate[] and String selected. In separate[] I have loaded values from EditText View and in selected, there is a value from my spinner. Now I want to work with these in my AsyncTask. My AsyncTask class looks now like this: final class cyklus extends AsyncTask&lt;String[], Void, String[]&gt;{ String[] tones = {"C","Cis","D","Dis","E","F","Fis","G","Gis","A","Ais","B"}; String[] result; @Override protected String[] doInBackground(String[]... params) { int l =params.length; //length of separate[] for(int k=0; k==l; k++){ // finding indexes of matches of elements separate[k] in tones[] // INPUT POSITION int i= Arrays.asList(tones).indexOf(params[k]); // RESULT INDEX int j =Integer.parseInt(selected); int index = i+j; // RESULT String res=tones[index]; result[k]=res; } return result; } } After this for loop is done, I would like my AsyncTask to return result[]. To sum up tis, I would like to know how can I work with "separate[]" and "selected" in my AsyncTask class. Thank you. EDIT: One more subquestion. My for loop wont start. Why? Thank you.
type: Question
has answer: http://stackoverflow.com/a/20868268
has answer: http://stackoverflow.com/a/20868297
has title: android passing String array and String to asyncTask
downvote count: 0
answer count: 4
favorite count: 0
tagged with: android-asynctask
has answer: http://stackoverflow.com/a/20868271
upvote count: 2
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/20868275

http://stackoverflow.com/a/20902903
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20898439
has comment: http://stackoverflow.com/comment/31376112
score: 1
has body: I can answer the second part of question. AssetManager calculates percent based om number of asssets not on their size. Suppose you have huge texture atlas which is packed in one texture and several other small resources. Loading of the atlas takes 9 seconds and there are 4 other small resource which take 1 second to load. So, see what happens. You have 20%-20%-20%-20%-20% when you expect 90%-10&amp;. If you want to more precise percentage you need to calculate percentage some other way. Blank screen glitch is trickier. You need to check that Stage is properly initialized, aspect ratio is correct, resources are loaded correctly. You can download source code for libgdx, add it to your project and go through render method with debugger. If you find something suspicious there you can update this post or create a new one.
upvote count: 1

http://stackoverflow.com/q/20932492
has comment: http://stackoverflow.com/comment/31463986
has body: Does Rhino have function convert its script to java source code? I want to convert Rhino script to java source code.
has comment: http://stackoverflow.com/comment/31436046
type: UnansweredQuestion
type: Question
has title: Does Rhino have function convert its script to java source code?
has answer: http://stackoverflow.com/a/20984164
has comment: http://stackoverflow.com/comment/31443813
tagged with: rhino
tagged with: java
tagged with: code-conversion
tagged with: function
answer count: 1
score: 0

http://stackoverflow.com/a/20938562
has comment: http://stackoverflow.com/comment/31445196
has body: With a standard for-loop, you access the elements of the list via get() and (perhaps) set them via set(). These methods cannot detect concurrent modification. However, with a for-each loop, you are actually using an Iterator as returned by the list's iterator() method, which does check for concurrent modification. Hence the difference. A for-each loop for (Element e : list) { ... } actually becomes something like: for (Iterator&lt;Element&gt; iter = list.iterator(); iter.hasNext();) { Element e = iter.next(); ... }
answers question: http://stackoverflow.com/q/20938500
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20938500
has comment: http://stackoverflow.com/comment/31444491
type: Answer
has comment: http://stackoverflow.com/comment/31444682
upvote count: 3
has comment: http://stackoverflow.com/comment/31444873
score: 3
has comment: http://stackoverflow.com/comment/31444809
has comment: http://stackoverflow.com/comment/31444989
has comment: http://stackoverflow.com/comment/31445182

http://stackoverflow.com/comment/31333072
type: Comment
comment on: http://stackoverflow.com/a/20873845
score: 0
type: AnswerComment
has text: Thanks, User is really reserved word. I have created the new project with name Userr. I have used this query: "SELECT UserID, EnterKey, Nick FROM Userr WHERE (Nick = :nick)" and I get this error: java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager: Exception Description: Syntax error parsing [SELECT UserID, EnterKey, Nick FROM Userr WHERE (Nick = :nick)]. [41, 41] An identification variable must be provided for a range variable declaration. Can you help me please?

http://stackoverflow.com/a/20995377
has body: The class initialization procedure guarantees that if a static field's value is set using a static initializer (i.e. static variable = someValue;) that value is visible to all threads: 10 - If the execution of the initializers completes normally, then acquire LC, label the Class object for C as fully initialized, notify all waiting threads, release LC, and complete this procedure normally. Regarding your edit, let's imagine a situation with two threads T1 and T2, executing in that order from a wall clock's perspective: T1: Something s = Something.getInstance(); T2: Something s = Something.getInstance(); i = s.getAnswer(); Then you have: T1 acquire LC, T1 run Something INSTANCE = new Something();, which initialises answer, T1 release LC T2 tries to acquire LC, but already locked by T1 =&gt; waits. When T1 releases LC, T2 acquire LC, reads INSTANCE then reads answer. So you can see that you have a proper happens-before relationship between the write and the read to answer, thanks to the LC lock.
accepted answer of: http://stackoverflow.com/q/20995036
type: Answer
has comment: http://stackoverflow.com/comment/83874824
has comment: http://stackoverflow.com/comment/31552819
score: 16
upvote count: 16
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20995036
downvote count: 0

http://stackoverflow.com/q/20927840
linked to: http://stackoverflow.com/q/439485
has comment: http://stackoverflow.com/comment/31423715
linked to: http://stackoverflow.com/q/3683602
upvote count: 6
type: AnsweredQuestion
tagged with: syntax
has answer: http://stackoverflow.com/a/20927846
downvote count: 2
has comment: http://stackoverflow.com/comment/31423519
has comment: http://stackoverflow.com/comment/31423505
has title: Why does Java require the char variable to use single quotes?
type: Question
tagged with: java
has body: Why is it that Java requires the char variable to enclose anything inside of it with single quotes rather than double? An example of this: char s = 's'; //This will not break vs: char s = "s"; //This will break I understand that double quotes are primarily for strings but is there a specific reason as to why chars were built to only use single quotes and to break when a double quote is entered? I have tried to do some research but the only thing that was relevant was another SO Question, which refers to the difference between single and double quotes, not the reasoning behind the syntactical development of the char.
has answer: http://stackoverflow.com/a/20927922
answer count: 2
accepted answer: http://stackoverflow.com/a/20927846
possible better answer: http://stackoverflow.com/a/20927922
score: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/31423718

http://stackoverflow.com/a/20932302
score: 0
upvote count: 1
downvote count: 1
has body: Best way to be sure is verifying it yourself. Implementing both your options and writing test cases measuring the performance with a significantly large input will enable you to find the better option.
type: Answer
answers question: http://stackoverflow.com/q/20932247

http://stackoverflow.com/q/21000064
has body: I have an arraylist (result_arraylist) and an using the gson library to convert java objects to JSON and then print it to a text file. Here is my code: Gson gson = new Gson(); File file = new File(file_path); FileWriter fWriter; BufferedWriter bWriter; try { //create the file if it doesn't exist if((!file.exists())) { file.createNewFile(); } fWriter = new FileWriter(file.getAbsoluteFile()); bWriter = new BufferedWriter(fWriter); for(int j = 0; j &lt; result_arraylist.size(); ++j) { bWriter.write("&lt;!--"); //this and the last string I write to the file is just to separate the objects for when I read the file again bWriter.newLine(); bWriter.write(gson.toJson(result_arraylist.get(j))); //take the object at index j, convert it to JSON and write to file bWriter.newLine(); bWriter.write("--&gt;"); //seperator to denote end of object bWriter.newLine(); bWriter.newLine(); } } catch(IOException e) {e.printStackTrace();} What I didn't show here is that this is nested in a larger for loop that fills result_arraylist with different objects with every iteration. My problem is that with every iteration of the main for loop, the file keeps getting overwritten.
score: 0
answer count: 2
tagged with: file-io
has comment: http://stackoverflow.com/comment/31559183
possible better answer: http://stackoverflow.com/a/21000582
accepted answer: http://stackoverflow.com/a/21000083
has answer: http://stackoverflow.com/a/21000582
has title: Why does my file keep getting overwritten?
type: AnsweredQuestion
tagged with: bufferedwriter
tagged with: java
tagged with: gson
type: Question
has comment: http://stackoverflow.com/comment/31558682
has answer: http://stackoverflow.com/a/21000083

http://stackoverflow.com/comment/31662897
score: 0
has text: If I will use manual way to build SQL query, how can I use dslContext to return generated values after insert? Now I use StringBuilder queryBuilder = new StringBuilder("INSERT INTO ...; dslContext.query(queryBuilder.toString());
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21038160

http://stackoverflow.com/q/20868373
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31311054
has answer: http://stackoverflow.com/a/20868466
has body: I want my java program to execute a different java program. I used following method. (The program I want to run is Example.java) class RunJava { public static void main(String a[])throws Exception { Runtime.getRunTime().exec("c:\\"+path+"\\javac Example.java"); Runtime.getRunTime().exec("c:\\"+path+"\\java Example"); } But it is not working. Is there any other way of doing this?
tagged with: java
has title: How to run a java program through a different java program?
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31311074
favorite count: 0
has comment: http://stackoverflow.com/comment/31311069
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20868401
tagged with: process
linked to: http://stackoverflow.com/q/4842684

http://stackoverflow.com/a/20897098
score: 2
has body: There are two very different issues in the question. One is a valid observation that, in one specific program, with low iteration count the enhanced for loop time was faster. The other is a generalization of that observation to "For a low number of iterations (100-1000), the enhanced for loop seems to be much faster with and without JIT." I see no justification for that generalization. I made a small change to the program, running the basic for-loop test first, then the enhanced for-loop. I also labeled the outputs to reduce confusion in dealing with modified versions. Here is my output for 100 iterations: Warming up Running Enhanced For-Loop 2002nS Basic For-Loop 70nS With the loops in the original order, I get: Warming up Running Basic For-Loop 2139nS Enhanced For-Loop 137nS If I warm up the second loop immediately before running it, instead of doing both warm-ups at the start, I get: Warming up Running Basic For-Loop 1093nS Enhanced For-Loop 984nS The results, for low iteration count, are very dependent on fine details of the program, an inherent danger of micro-benchmarking, and a reason to avoid generalizing from a single program observation to a general assumption about how the measured code would perform in any other program.
has comment: http://stackoverflow.com/comment/31365248
downvote count: 0
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/31365274
answers question: http://stackoverflow.com/q/20896432

http://stackoverflow.com/q/20858888
tagged with: java
tagged with: jboss
type: Question
has answer: http://stackoverflow.com/a/20860126
tagged with: maven-module
answer count: 1
downvote count: 0
has title: sharing java beans between maven modules in an app server
tagged with: javabeans
accepted answer: http://stackoverflow.com/a/20860126
has comment: http://stackoverflow.com/comment/31295456
favorite count: 0
score: 2
upvote count: 2
tagged with: maven
type: AnsweredQuestion
has body: I'm not sure what I'm attempting is possible, therefore I'm looking for advice / guidance on the subject. Say I've got 2 maven modules running simultaneously, with module B having module A specified as dependency. I've also got an application server running - WildFly (JBoss) - that is serving as a launching entity for those modules. The problem: I need to access the same bean instance (object reference) on module B that is first initialized in module A. Basically, this is a type of resource sharing / shared memory access. Conventional ways that come to mind are CRUD operations on a database, but I'm wondering if there's an actual way of sharing bean instances between running modules? Could the AS help in this regard in any way as well - as in, perhaps I could move the initialization there and somehow share the instances between modules? Thank you.

http://stackoverflow.com/a/20918741
answers question: http://stackoverflow.com/q/20918696
score: 0
has body: You are getting 500 Response. It means your request is reaching at the server, but at the server some error is occurring. You need to trace the request log in the server. Check the sent parameters matches the required ones Also, check the request parameter name ( user_name or login_name)
has comment: http://stackoverflow.com/comment/31406267
type: Answer
has comment: http://stackoverflow.com/comment/31406197

http://stackoverflow.com/comment/41013695
has text: No, but bringing all people to where they want just before the rush hour would help. But this analogy doesn't work. Think about emptying the trash bin before many guests arrive. For sure it'll last longer till it fills again and if you're very lucky, it'll survive the whole party.
comment on: http://stackoverflow.com/a/20893321
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/comment/31341647
type: AnswerComment
type: Comment
has text: @AniketThakur so does that create a variable of the type Level. What is the type Level? Just a random type that stores what type of data? And is Level() an array
comment on: http://stackoverflow.com/a/20884620
score: 0

http://stackoverflow.com/a/20977667
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20977361
upvote count: 2
has body: I would test the string against the following regex: [^\d ] If you get any results it means you have something else other than a digit (\d) or a space
score: 2

http://stackoverflow.com/q/20962186
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/20962320
has comment: http://stackoverflow.com/comment/31489138
score: 0
tagged with: imageicon
answer count: 1
has title: remove image in Jlabel in java
has comment: http://stackoverflow.com/comment/31489146
has body: I have a question and I know it may seem simple but I spent 3 hours and still I am having trouble: I am trying to add and remove image in Jlabel in java dynamically I am trying this code but I cant see any image loding on label what is wrong with my code and what can I do else? public static void main (String[] args) { ImageIcon icon = new ImageIcon ("1.gif"); JFrame frame = new JFrame ("Nested Panels"); frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); // Set up first subpanel JPanel subPanel1 = new JPanel(); subPanel1.setPreferredSize (new Dimension(450, 100)); //subPanel1.setBackground (Color.green); JLabel label1 ; label1 = new JLabel ("Devil Left", icon, SwingConstants.CENTER); label1.setHorizontalTextPosition (SwingConstants.LEFT); label1.setVerticalTextPosition (SwingConstants.BOTTOM); subPanel1.add (label1); JPanel primary = new JPanel(); primary.setBackground (Color.blue); primary.add (subPanel1); frame.getContentPane().add(primary); frame.pack(); frame.setVisible(true); }
tagged with: jlabel
tagged with: embedded-resource
tagged with: swing
has answer: http://stackoverflow.com/a/20962320

http://stackoverflow.com/comment/31546812
type: Comment
has text: thank you for the answer,i will be accepting your answer soon.can you please have a look at blackbelt's answer....??and the comments below ?
comment on: http://stackoverflow.com/a/20993433
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31568364
type: AnswerComment
has text: In a stupid microbenchmark, I've just thrown and caught 100,000 exceptions in 100 milliseconds. What's the cost of a typical SQL query execution? What's the relative cost of a SQLException (which *is* exceptional) relative to the SQL request execution itself? The problem with SQLException is that they're checked exceptions, not that they are exceptions.
comment on: http://stackoverflow.com/a/21005048
type: Comment
score: 1

http://stackoverflow.com/q/20928228
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/20928521
has body: I'm having trouble returning a value outside of a for statement. In my below syntax I have to declare the finalAmount variable outside of the for loop because if I don't it won't work. The return value is 0, which I don't want. How can I use the variable outside the for loop statement in Java? Thanks import java.util.Scanner; public class CompundInterest2 { public static void main(String[] args){ Scanner input = new Scanner(System.in); double amount, rate, year; System.out.println("What is the inital cost? Dude"); amount = input.nextDouble(); System.out.println("What is the interest rate?"); rate = input.nextDouble(); rate = rate/100; System.out.println("How many years?"); year = input.nextDouble(); input.close(); justSayit(year, rate, amount); } private static double thefunction(double amount, double rate, double year){ double finalAmount = 0; // This is where I'm running into trouble. If I don't declare this variable the program won't work. But if I declare it, it works but returns 0. for(int x = 1; x &lt; year; x++){ finalAmount = amount * Math.pow(1.0 + rate, year); } return finalAmount; } public static void justSayit(double year, double rate, double amount){ double awesomeValue = thefunction(amount, year, rate); System.out.println("For " + year + " years an initial " + amount + " cost compounded at a rate of " + rate + " will grow to " + awesomeValue); }
score: 0
accepted answer: http://stackoverflow.com/a/20928245
tagged with: for-loop
answer count: 3
favorite count: 0
type: AnsweredQuestion
has title: Having trouble returning a value outside of a for loop with Java
has answer: http://stackoverflow.com/a/20928245
tagged with: java
upvote count: 1
possible better answer: http://stackoverflow.com/a/20928521
has answer: http://stackoverflow.com/a/20928752

http://stackoverflow.com/comment/31463145
type: QuestionComment
has text: Judging by the profile activity, he is asking us to solve his homework again.
comment on: http://stackoverflow.com/q/20948995
type: Comment
score: 0

http://stackoverflow.com/comment/31371535
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20900446
has text: Hi, i have 6 strings with the length of 5 .But it prints even 6 also .And How i can identify the empty string.I couldn't understand what u mean by empty String.pls..
score: 0

http://stackoverflow.com/a/21108403
has comment: http://stackoverflow.com/comment/31761886
answers question: http://stackoverflow.com/q/21016067
score: 0
type: Answer
has body: I didn't test it myself, and I'm not sure if it's efficient, but this query should work: select b.[jcr:path] as [jcr:path], b.[title] as [title], b.[overallScore] as [overallScore] from [nt:base] as a inner join [nt:base] as b on ischildnode(b, a) where name(a) = 'institutes' and name(b) = 'institute'

http://stackoverflow.com/q/20937369
has answer: http://stackoverflow.com/a/20937578
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31442248
has answer: http://stackoverflow.com/a/20937551
tagged with: java
has comment: http://stackoverflow.com/comment/31441681
has body: This is the basis of my code. It prints students grades on the console, but how do I use a Buffereader to put all the students grade on a new file. import java.io.*; import java.util.InputMismatchException; import java.lang.*; import java.util.*; public class WorkSpace { private Scanner x; public void openFile(){ try{ x = new Scanner (new File ("grades.txt")); } catch(Exception e){ System.out.println("could not find file"); }} public void createFile()throws IOException { try{ File file = new File("grades.txt"); Scanner s = new Scanner(file); while(s.hasNext()){ { String [] split = s.nextLine().split(", "); String fname = split[0]; Double q1 = Double.parseDouble (split[1]); Double q2 = Double.parseDouble (split[2]); Double q3 = Double.parseDouble (split[3]); Double q4 = Double.parseDouble (split[4]); Double proji = Double.parseDouble (split[5]); Double projii = Double.parseDouble (split[6]); Double projiii = Double.parseDouble (split[7]); double studentgrade = (q1 *0.1) + (q2 *0.1) +(q3 *0.1) + (q4 *0.1) +(proji*0.15) + (projii * 0.2) + (projiii *0.25); if(studentgrade&gt;90) System.out.printf("%s got an A\n", fname); else if(studentgrade&gt;80) System.out.printf("%s got a B\n", fname); else if(studentgrade&gt;70) System.out.printf("%s got a C\n", fname); else if(studentgrade&gt;60) System.out.printf("%s got a D\n", fname); else if(studentgrade&gt;50) System.out.printf("%s got a F\n", fname); }}}catch(Exception e){ e.printStackTrace(); } } public void closeFile(){ x.close(); }
has comment: http://stackoverflow.com/comment/31441654
downvote count: 1
type: Question
has title: BufferReader to write new file with previous info
score: -1
answer count: 3
tagged with: file-io
upvote count: 0
has answer: http://stackoverflow.com/a/20943427
tagged with: bufferedreader
favorite count: 0

http://stackoverflow.com/comment/31396098
comment on: http://stackoverflow.com/q/20897020
score: 2
type: Comment
has text: Isn't looping almost always done w/ primitive ints -- not boxed Integers? Caching doesn't apply.
type: QuestionComment

http://stackoverflow.com/q/20994715
has answer: http://stackoverflow.com/a/20994798
has answer: http://stackoverflow.com/a/20994750
accepted answer: http://stackoverflow.com/a/20994750
has title: Find lowest odd number in a loop
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/31548503
possible better answer: http://stackoverflow.com/a/20994799
favorite count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20994799
upvote count: 1
type: Question
has body: I know this code is wrong. I'm a beginner so bear with me. I need to find the lowest odd number but it keeps coming up as zero no matter what numbers are entered. I need to initialize 'lowest' but how/where do I initialize it? lowest = 0 is causing a problem but I'm not sure where to initialize lowest class Odd { public static void main(String[] args) { int number; //the number entered by the user int input; //the amount of numbers to be entered by the user int index; int lowest = 0; //lowest odd number System.out.println("How many numbers? "); input = EasyIn.getInt(); for (index = 1; index &lt;= input ; index ++) { System.out.println("Enter number " + index + ":" ); number = EasyIn.getInt(); if ((number % 2 == 1) &amp;&amp; (number &lt; lowest)) { lowest = number; } } System.out.println("The lowest odd number entered was " + lowest); } }
type: AnsweredQuestion

http://stackoverflow.com/comment/31547483
type: QuestionComment
comment on: http://stackoverflow.com/q/20994220
has text: `zipFIle` That's an extreme ugly name for a class. I advise you to go through a basic tutorial my friend.
type: Comment
score: 1

http://stackoverflow.com/comment/31577455
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21006776
has text: For better help sooner, post an [SSCCE](http://sscce.org/). Note that setting the PLAF is typically done before any components are created. If there was a bug in the JRE such that setting it after that point caused an NPE, few other programmers would have noticed it. See if you can reproduce the NPE when changing PLAF using the [nested layout code](http://stackoverflow.com/a/5630271/418556). It allows the user to change PLAFs after start-up.

http://stackoverflow.com/q/20973238
tagged with: android
tagged with: android-actionbar
has comment: http://stackoverflow.com/comment/31513103
has comment: http://stackoverflow.com/comment/31508889
answer count: 0
upvote count: 3
tagged with: java
has title: Android 4.0 Support for Action Bar Up Navigation
type: Question
score: 3
has body: I followed the Tutorial http://developer.android.com/guide/topics/ui/actionbar.html#Home and I added the latest android-support-v4.jar to my Project. I also added the jar-file to my Buildpath. I modified my Manifest.xml file and anything works fine for Android 4.1.2. But if I use Android 4.0.4 the Back buttons are shown but they didn't respond. Did anyone had the same problem? Best regards Martin
has comment: http://stackoverflow.com/comment/31540631
has comment: http://stackoverflow.com/comment/31511879
downvote count: 0
has comment: http://stackoverflow.com/comment/31512827
favorite count: 0
has comment: http://stackoverflow.com/comment/31512158
type: UnansweredQuestion

http://stackoverflow.com/a/20939714
downvote count: 0
has body: You need to make the array static, and NOT pass it in to the function. Passing it in does indeed create the array, but it only exists during the lifetime of the function. This works: import java.util.Scanner; public class SetListSize { private static int [] listA; public static final void main(String[] igno_red) { SetListSize.setListSize(); for(int i : listA) { System.out.println(i); } } public static void setListSize () { Scanner reader = new Scanner (System.in); while (true) { System.out.print("Enter array size for between [1-50]: "); int listSize = Integer.parseInt(reader.nextLine()); if (listSize &gt; 50 || listSize &lt; 1) { System.out.println("Array size must be between [1-50]"); } else { //Reference the array statically SetListSize.listA = new int [listSize]; break; } } } } Output: [C:\]java SetListSize Enter array size for between [1-50]: 12 0 0 0 0 0 0 0 0 0 0 0 0
upvote count: 2
answers question: http://stackoverflow.com/q/20939548
type: Answer
score: 2

http://stackoverflow.com/a/20856743
downvote count: 0
answers question: http://stackoverflow.com/q/20856681
has comment: http://stackoverflow.com/comment/31288436
type: Answer
has comment: http://stackoverflow.com/comment/31288847
has comment: http://stackoverflow.com/comment/31288409
has comment: http://stackoverflow.com/comment/31288642
score: 3
has body: It seems as if you want to ignore whitespace and the parenthesis in the first string. You can replace these characters for the comparison. public class IfCondition { public static void main(String[] args) { String s1 = "6970596 (A1)"; String s2 = "6970596A1"; if (s1.replaceAll("[^A-Za-z0-9]", "").contains(s2)) { System.out.println("value matched"); } } } In your example the compare method is working as expected since it does not find an exact match for the String s2 within the String s1. In the String#compare JavaDoc it states Returns true if and only if this string contains the specified sequence of char values. The language cannot assume that you would like to ignore the whitespace and parens within the first String, therefore you must manipulate the string for your comparison.
upvote count: 3
has comment: http://stackoverflow.com/comment/31288905
has comment: http://stackoverflow.com/comment/31288420

http://stackoverflow.com/comment/31591187
comment on: http://stackoverflow.com/a/21017552
has text: I am waiting for any answer too.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31514360
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/20976077
has text: Main_CardGame_Activity.java:346 what line is that?
type: Comment

http://stackoverflow.com/q/20953284
has comment: http://stackoverflow.com/comment/31471620
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21531343
tagged with: java
type: Question
score: 5
upvote count: 5
possible better answer: http://stackoverflow.com/a/56312734
has answer: http://stackoverflow.com/a/56312734
answer count: 3
has answer: http://stackoverflow.com/a/20954010
has comment: http://stackoverflow.com/comment/31471355
downvote count: 0
has body: We have a system in place which collects data from multiple sensors and stores the data into the database, we have a website where our customers can log in and view their data. Now one of our customers wants to display the data from our server into their web site. I created a web service and gave them access to collect the data from the our database and import it into their website, but they are requesting us to push the data to their server. I am not sure how this can be done! Can anyone help me with this? Thanks
has title: How to push data to client's server
favorite count: 0
has answer: http://stackoverflow.com/a/21531343
has comment: http://stackoverflow.com/comment/31471758
tagged with: web-services

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

http://stackoverflow.com/comment/31597146
score: 1
has text: Java floating point conversion causes rounding error if, and only if, the value being converted is not exactly representable in the floating point type. Zero is exactly representable in double, so no rounding error.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21005444

http://stackoverflow.com/comment/31421075
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20926630
has text: You should be specific about your errors. Was this a compile-time error? A NullPointerException?

http://stackoverflow.com/comment/31472726
comment on: http://stackoverflow.com/q/20953444
score: 0
type: Comment
type: QuestionComment
has text: The exception can't point to the line of code you claim.

http://stackoverflow.com/a/21003954
answers question: http://stackoverflow.com/q/21003910
has comment: http://stackoverflow.com/comment/31566214
has comment: http://stackoverflow.com/comment/31566132
downvote count: 0
type: Answer
score: 1
has body: The error message shows you're looking for linux-7w1q.site, but your /etc/hosts alias is linux-7w1q
upvote count: 1

http://stackoverflow.com/comment/31489440
comment on: http://stackoverflow.com/q/20962343
type: QuestionComment
score: 3
has text: I would recommend you learn Java basics.
type: Comment

http://stackoverflow.com/comment/31533810
type: Comment
comment on: http://stackoverflow.com/a/20981814
has text: now how do i make a client to conect to that? XD
type: AnswerComment
score: 0

http://stackoverflow.com/a/53318765
has comment: http://stackoverflow.com/comment/99528692
score: 0
has body: Declaring a variable final or not declaring it final, but keeping it effectively final may result (depends on compiler) in different bytecode. Let's have a look on a small example: public static void main(String[] args) { final boolean i = true; // 6 // final by declaration boolean j = true; // 7 // effectively final if (i) { // 9 System.out.println(i);// 10 } if (!i) { // 12 System.out.println(i);// 13 } if (j) { // 15 System.out.println(j);// 16 } if (!j) { // 18 System.out.println(j);// 19 } } The corresponding bytecode of the main method (Java 8u161 on Windows 64 Bit): public static void main(java.lang.String[]); Code: 0: iconst_1 1: istore_1 2: iconst_1 3: istore_2 4: getstatic #16 // Field java/lang/System.out:Ljava/io/PrintStream; 7: iconst_1 8: invokevirtual #22 // Method java/io/PrintStream.println:(Z)V 11: iload_2 12: ifeq 22 15: getstatic #16 // Field java/lang/System.out:Ljava/io/PrintStream; 18: iload_2 19: invokevirtual #22 // Method java/io/PrintStream.println:(Z)V 22: iload_2 23: ifne 33 26: getstatic #16 // Field java/lang/System.out:Ljava/io/PrintStream; 29: iload_2 30: invokevirtual #22 // Method java/io/PrintStream.println:(Z)V 33: return The corresponding line number table: LineNumberTable: line 6: 0 line 7: 2 line 10: 4 line 15: 11 line 16: 15 line 18: 22 line 19: 26 line 21: 33 As we see the source code at lines 12, 13, 14 doesn't appear in the byte code. That's because i is true and will not change it's state. Thus this code is unreachable (more in this answer). For the same reason the code at line 9 misses too. The state of i doesn't have to be evaluated since it is true for sure. On the other hand though the variable j is effectively final it's not processed in the same way. There are no such optimizations applied. The state of j is evaluated two times. The bytecode is the same regardless of j being effectively final.
has comment: http://stackoverflow.com/comment/99533364
type: Answer
answers question: http://stackoverflow.com/q/20938095

http://stackoverflow.com/q/20922164
answer count: 4
has title: How to check whether a HashMap has all the elements of an ArrayList?
score: 1
tagged with: java
tagged with: collections
type: Question
tagged with: hashmap
linked to: http://stackoverflow.com/q/27581
has comment: http://stackoverflow.com/comment/31531468
tagged with: arraylist
has body: If I have a HashMap hashM, an ArrayList arrayL. If I would like to use an if statement to check whether hashM has all the elements in arrayL, how can I do that? I cm currently using something like if (hashM.values().containsAll(arrayL.getPreReqs())) However it doesn't work properly. Dear all thanks for the answers! Actually containsAll works however the way I structure the my codes is wrong so that I got wrong outcomes. Now it has been fixed. Cheers!
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31412244
favorite count: 0
has answer: http://stackoverflow.com/a/20922241
has answer: http://stackoverflow.com/a/20922445
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31412221
has answer: http://stackoverflow.com/a/20922488
has comment: http://stackoverflow.com/comment/31412220
has answer: http://stackoverflow.com/a/20922272

http://stackoverflow.com/comment/31308621
comment on: http://stackoverflow.com/q/20867009
score: 0
has text: use java properties -D (fileName&Location) option to java command and access the properties in code.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20961816
has comment: http://stackoverflow.com/comment/31488634
has comment: http://stackoverflow.com/comment/31488767
has comment: http://stackoverflow.com/comment/31488652
has answer: http://stackoverflow.com/a/20961855
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31488681
has answer: http://stackoverflow.com/a/20962016
has comment: http://stackoverflow.com/comment/31488605
has body: Okay, so I'm trying to get the odd, even, and negative numbers using 3 separate conditions %2=0, %2!=0, and &lt;0 However if say the number doesn't belong to the condition I put element at [i] = null; in which I get an error message saying can't convert from int to null add cast integer - Type mismatch: cannot convert from null to int Then if I proceed to cast the integer I get this error Exception in thread "main" java.lang.NullPointerException at Server.getEven(Server.java:10) at Main.main(Main.java:10) Now we haven't learned casting in my computer class and my teacher wouldn't accept my work with casting, even though is doesn't work. I was wondering if i could do this project with storing my 3 arrays in the server and only having the single inputed array in the client I.e my array of even numbers, array of odd numbers, array of negative numbers, all stored and printed in the server, while having the "array that the user inputed" solely in the client here is my code Client import java.util.Scanner; public class Main { public static void main (String[] args){ Scanner input = new Scanner(System.in); int [] array = new int[10]; System.out.print("Insert the 10 values of your array."); for(int i=0; i&lt;array.length; i++){ array[i] = input.nextInt(); } int[] even = Server.getEven(array); int[] odd = Server.getOdd(array); int[] neg = Server.getNeg(array); System.out.println("The even numbers in the array are..."); System.out.println(even); System.out.println("The odd numbers in the array are..."); System.out.println(odd); System.out.println("The negative numbers in the array are..."); System.out.println(neg); input.close(); } } Server public class Server { public static int[] getEven(int[] array){ int[] even = new int[array.length]; for(int i=0; i&lt;array.length; i++){ if(array[i]%2 ==0){ even[i] = array[i]; } else { even[i] = null;// &lt;-- here it asks me to do (Integer) null; } } return even; } public static int[] getOdd(int[] array){ int[] odd = new int[array.lengt…
has answer: http://stackoverflow.com/a/20961867
type: Question
possible better answer: http://stackoverflow.com/a/20961844
has title: How to convert null to int without casting to integer?
has answer: http://stackoverflow.com/a/20961844
has answer: http://stackoverflow.com/a/20961856
linked to: http://stackoverflow.com/q/5415604
tagged with: java
answer count: 6
score: 0
has answer: http://stackoverflow.com/a/20962134
accepted answer: http://stackoverflow.com/a/20962134
tagged with: casting
tagged with: null
has comment: http://stackoverflow.com/comment/31488591
tagged with: arrays
has comment: http://stackoverflow.com/comment/31488561

http://stackoverflow.com/comment/31301794
comment on: http://stackoverflow.com/a/20863172
score: 0
type: AnswerComment
has text: So basically, I call rotate this way: g2d.rotate(30 * Math.PI/180, 300, 250); Where 300 and 250 are the coordinates of the pivot point. But if I want it more accurate, then I need to measure the dimensions of the object I'm rotating, come up with the center point of it, and set that as the pivot point. So let's say I got an image the size fo 10x10, and it's location on the screen is 250,250 (location of it's top-left point), then I would set the pivot point to be 260,260. Wrote all of this to make sure I understand correctly. Do I?
type: Comment

http://stackoverflow.com/q/20893976
has answer: http://stackoverflow.com/a/20894262
accepted answer: http://stackoverflow.com/a/20894262
tagged with: listview
score: 0
answer count: 2
has title: Setting up custom Adapter for Custom ListView
has comment: http://stackoverflow.com/comment/31359630
tagged with: adapter
possible better answer: http://stackoverflow.com/a/20894289
tagged with: android
type: AnsweredQuestion
has body: I am currently working on a project that will keep track of player scores and other information for a game called Farkle. I have done about 100 Google searches and read several entries on here as well. I have tried implementing and using everything I have found, but I am just at ends here. The row.xml will be loaded as a single item in a ListView. Ultimately, I want to have in order (you will see my row.xml layout below): "Player's name" checkbox checkbox "Player's score". I can get the app to run, so I don't have an issue at launch, however, as soon as I attempt to add a new player, the app breaks. Now, the code I have below is a new project, as the last one had broken to a point that it showed no errors but would crash on launch. I have tried using a custom ArrayAdapter, and I believe this is the method that will work for me, but I just cannot seem to get it to load the row.xml without crashing. I am still new to the ArrayAdapter, and I have done a few tutorials, but I still can't get it worked. If anyone has any ideas as to what I can do to get this worked, please help and get me pointed in the right direction. I have been working on this for 2 weeks now! Thank you in advance. activity_main.xml &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".MainActivity" &gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" &gt; &lt;Button android:id="@+id/btnSetScore" android:layout_weight="1" android:layout_width="0dp" android:layout_height="wrap_content" android:text="@string/winning_score" /&gt; &lt;Button android:id="@+id/btnAddPlayer" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/add_player" android:textSize="@dimen/activity_horizontal_margin" …
tagged with: java
has answer: http://stackoverflow.com/a/20894289
type: Question

http://stackoverflow.com/comment/31302810
type: QuestionComment
comment on: http://stackoverflow.com/q/20863759
score: 0
type: Comment
has text: try trim() on your vals[]. Maybe there are still white spaces?

http://stackoverflow.com/comment/31497924
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20967242
has text: http://blog.bdoughan.com/2012/08/handle-middle-of-xml-document-with-jaxb.html -- FYR...
score: 0

http://stackoverflow.com/q/20895090
has comment: http://stackoverflow.com/comment/31361791
tagged with: java
has title: 'error: cannot find symbol' Compiler Error
type: Question
has answer: http://stackoverflow.com/a/20895174
accepted answer: http://stackoverflow.com/a/20895174
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31364965
type: AnsweredQuestion
has body: I've basically copied the below code from a text book. I've had this kind of error before and managed to fix it but because I'm not familiar with the Classes &amp; Methods used I am having a bit a trouble with this one. Below is the error thrown by the compiler. TextReader.java:27: error: cannot find symbol output = new BufferedOutputStream(filePath.newOutputStream()); symbol: method newOutputStream() location: variable filePath of type Path Below is the code. It is basically supposed to get input from a user write it to a text file then read the text file and display the info to the user. import java.nio.file.*; import static java.nio.file.StandardOpenOption.*; import java.io.*; import javax.swing.JOptionPane; public class TextReader { public static void main (String[]args) { Path filePath = Paths.get("Message.txt"); String s = JOptionPane.showInputDialog(null,"Enter text to save as a file","Text File Creator",JOptionPane.INFORMATION_MESSAGE); byte[] data = s.getBytes(); OutputStream output = null; InputStream input = null; try { output = new BufferedOutputStream(filePath.newOutputStream()); output.write(data); output.flush(); output.close(); } catch(Exception e) { JOptionPane.showMessageDialog(null,"Message: " + e,"Error!!",JOptionPane.WARNING_MESSAGE); } try { input = filePath.newInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(input)); String ss = null; ss = reader.readLine(); JOptionPane.showMessageDialog(null,"Below is the information from the saved file:\n" + ss,"Reader Output",JOptionPane.INFORMATION_MESSAGE); input.close(); } catch (IOException ee) { JOptionPane.showMessageDialog(null,"Message: " + ee,"Error!!",JOptionPane.WARNING_MESSAGE); } } }
downvote count: 0
score: 1

http://stackoverflow.com/a/21017638
type: Answer
accepted answer of: http://stackoverflow.com/q/21017524
score: 3
answers question: http://stackoverflow.com/q/21017524
upvote count: 3
has body: new SomeCollection&lt;MyPojo&lt;String&gt;, String&gt;(); Or are we missing something?
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31591220

http://stackoverflow.com/a/20865245
downvote count: 1
has body: Seemed player1Kortlek is An Kortlek Object,but not a method. when using println,it will call object's toString method, so you need to: 1)just Override the class Kortlek' toString method correctly 2)use System.out.println(player1Kortlek) to display informaiton;
has comment: http://stackoverflow.com/comment/31305502
type: Answer
upvote count: 0
has comment: http://stackoverflow.com/comment/31365166
answers question: http://stackoverflow.com/q/20864868
score: -1
has comment: http://stackoverflow.com/comment/31305542
has comment: http://stackoverflow.com/comment/31306192
has comment: http://stackoverflow.com/comment/31322060

http://stackoverflow.com/q/20923756
accepted answer: http://stackoverflow.com/a/20923805
type: Question
linked to: http://stackoverflow.com/q/10627992
tagged with: datanucleus
score: -1
answer count: 1
favorite count: 0
downvote count: 2
has body: I need to setup a MySQL database for a DataNucleus properties file: javax.jdo.PersistenceManagerFactoryClass=org.datanucleus.api.jdo.JDOPersistenceManagerFactory datanucleus.metadata.validate=false # Enable these lines if persisting to ODF #javax.jdo.option.ConnectionURL=odf:file:tutorial.ods #javax.jdo.option.Mapping=odf # Enable these lines if persisting to RDBMS (HSQLDB) javax.jdo.option.ConnectionDriverName=com.mysql.jdbc.Driver javax.jdo.option.ConnectionURL=jdbc:mysql://myserver.com:3306/myDb javax.jdo.option.ConnectionUserName=userName javax.jdo.option.ConnectionPassword=password # javax.jdo.option.Mapping=hsql datanucleus.autoCreateSchema=true datanucleus.validateTables=false datanucleus.validateConstraints=false Can anyone please tell me the steps on how to set it up for this particular purpose?
has title: How to create a MySQL database for DataNucleus
type: AnsweredQuestion
tagged with: java
tagged with: mysql
upvote count: 1
has answer: http://stackoverflow.com/a/20923805

http://stackoverflow.com/a/21018169
upvote count: 1
answers question: http://stackoverflow.com/q/21017616
downvote count: 0
has body: I would avoid using a timestamp as the primary key. It's clumsy for a unique column. Also do you really want to be using a cumbersome field like that as a foreign key in your other tables? If this timestamp genuinely needs to be unique then you should probably put timestamp in its own field and use a unique constraint. @Entity @Table(uniqueConstraints={@UniqueConstraint(columnNames={"timestamp"})}) public class MyDomain implements Serializable { @Id @Column(name = "id") private Long id; @Column(name = "timestamp") public Timestamp timestamp; }
type: Answer
score: 1

http://stackoverflow.com/q/20953459
has comment: http://stackoverflow.com/comment/31471690
tagged with: return
type: Question
answer count: 2
score: 0
tagged with: java
tagged with: loops
has answer: http://stackoverflow.com/a/20953485
has body: I'm having some difficulty with this for-loop in java: public String[] geefAlleTemplateNamen(String[][] templateLijst){ for(int i = 0; i &lt; templateLijst.length; i++){ String lijst[] = {templateLijst[i][0]}; } return lijst; } When i execute the program, i get the following error: Mailmatcher.java:39: error: cannot find symbol return lijst; ^ symbol: variable lijst location: class Mailmatcher 1 error I think this is because 'lijst' is declared inside the for loop, so it's unknown outside it, although i think i know what the problem is, i've got no idea how to solve this. Any ideas would be appreciated! I used the search allready, but didn't realy find something, this is a school project, so i don't expect pre-made answers. Thank you!
tagged with: for-loop
has answer: http://stackoverflow.com/a/20953583
accepted answer: http://stackoverflow.com/a/20953485
possible better answer: http://stackoverflow.com/a/20953583
type: AnsweredQuestion
has title: Java: returning a list with a for loop

http://stackoverflow.com/comment/31284577
has text: Any luck? Have you find it?
type: Comment
comment on: http://stackoverflow.com/a/20851089
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31364519
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20896721
has text: This will create 16 different squares with different names? I'm sorry, iv'e read about these 2D arrays, but never fully understood them.
type: AnswerComment

http://stackoverflow.com/comment/31374329
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/20897533
has text: There's an accepted answer already but the problem wasn't made obvious: `"` terminates your string literal in `""` - if you want `"` in a string, escape it as `\"`. The accepted answer just removed the `"`.

http://stackoverflow.com/q/20953269
answer count: 0
downvote count: 0
favorite count: 0
has body: i want to ran a jar file in linux But the following error occurs What is the reason [root@server ~]# java -jar keygen.jar Exception in thread "main" java.lang.UnsupportedClassVersionError: org/dgt/jl/App : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:643) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:277) at java.net.URLClassLoader.access$000(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:212) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:323) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:268) Could not find the main class: org.dgt.jl.App. Program will exi my java version : java version "1.6.0_24" OpenJDK Runtime Environment (IcedTea6 1.11.14) (rhel-1.42.1.11.14.el5_10-i386) OpenJDK Client VM (build 20.0-b12, mixed mode) Thank you
duplicate of: http://stackoverflow.com/q/10382929
tagged with: linux
has comment: http://stackoverflow.com/comment/31471328
type: Question
upvote count: 2
tagged with: java
has title: Executing a jar file in linux centos
type: UnansweredQuestion
score: 2
linked to: http://stackoverflow.com/q/10382929

http://stackoverflow.com/a/20939272
score: 0
has comment: http://stackoverflow.com/comment/31465186
has comment: http://stackoverflow.com/comment/31447035
has comment: http://stackoverflow.com/comment/31446058
type: Answer
has comment: http://stackoverflow.com/comment/31447138
has comment: http://stackoverflow.com/comment/31468465
has body: There are many possible solutions. Usually using SAX parsers you just add some boolean flags to denote some particular states when parsing. In this simple example you can achieve this with just changing this: tmpValue = new String(ac, i, j); to this: if (tmpValue.equals("")) tmpValue = new String(ac, i, j); else tmpValue += new String(ac, i, j); or: if (tmpValue == null) tmpValue = new String(ac, i, j); else tmpValue += new String(ac, i, j); Depending on how you initialize the tmpValue variable (and you should initialize it if you're not doing it already). To gather contents of all paragraphs you need to: public void endElement(String s, String s1, String element) throws SAXException { if (element.equals(Finals.PARAGRAPH)) { Paragraph paragraph = new Paragraph(); paragraph.setContext(tmpValue); System.out.println("Contesto: " + tmpValue); listP.add(paragraph); tmpValue = ""; // or tmpValue = null; for the second version } } and to omit the title part: public void startElement( String uri, String localName, String qName, Attributes atts) { if (localName.equals(Finals.PARAGRAPH)) { tmpValue = ""; // or tmpValue = null; for the second version } }
has comment: http://stackoverflow.com/comment/31465446
has comment: http://stackoverflow.com/comment/31446593
has comment: http://stackoverflow.com/comment/31461668
has comment: http://stackoverflow.com/comment/31468361
answers question: http://stackoverflow.com/q/20937270
has comment: http://stackoverflow.com/comment/31461396

http://stackoverflow.com/comment/31432476
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20932488
has text: @MariuszS With what we know about the context, we can't tell if being locale-dependant or locale-independant is good or bad. That's why this answer suggests both solutions. Most of the time, a simple, effective and to-the-point solution is better than an overengineered solution that solves non-existent problems.
score: 1

http://stackoverflow.com/q/20969851
type: UnansweredQuestion
tagged with: windows
has title: Resize windows using Java or C#
has body: I'd like to create an application where I can resize Windows forms. I can iterate through windows and get certain properties like so for example: How to iterate through window elements using JNA? I've found similar ones, but can I resize and relocate these windows rather than just getting their attributes like title and rect? I'd like to sort all visible windows as a tile but I can't figure out how I can manipulate their position. For example, I want to grab and resize Total Commander and Notepadd++ (the 2 visible windows) to be on the left and right half of the screen. Is it possible? If anyone can show me a snippet I'd be grateful.
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/7045548
has answer: http://stackoverflow.com/a/20970589
type: Question
tagged with: c#
has answer: http://stackoverflow.com/a/20970304
tagged with: resize
tagged with: forms
answer count: 2
upvote count: 1
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/5609486

http://stackoverflow.com/a/20982385
has comment: http://stackoverflow.com/comment/31527492
has comment: http://stackoverflow.com/comment/31527368
downvote count: 0
has comment: http://stackoverflow.com/comment/31526724
has body: Assuming you want this as a hex number (that is base 16), you must supply the radix to your parseInt call - seatNo = Integer.parseInt(lblSeatNo.getText(), 16); if you want the decimal value (e.g. base 10) and to skip the letter, you could do seatNo = Integer.parseInt(lblSeatNo.getText().substring(1));
type: Answer
has comment: http://stackoverflow.com/comment/31527202
answers question: http://stackoverflow.com/q/20982283
upvote count: 3
has comment: http://stackoverflow.com/comment/31527075
has comment: http://stackoverflow.com/comment/31526766
score: 3
has comment: http://stackoverflow.com/comment/31526999
has comment: http://stackoverflow.com/comment/31527250

http://stackoverflow.com/comment/31578163
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21005650
has text: It will work, and is a good and flexible solution. Making existing projects the hosts is also fine, and is a natural solution if for each War, one project is clearly tied to that War (e.g. contains all JSPs), without potential of reuse in a different context. Reorganizing directory structure doesn't provide any advantages. For example, even with a flat structure, Gradle is smart enough to rebuild dependent projects automatically as necessary. In summary, the legacy structure doesn't seem bad at all.
score: 0

http://stackoverflow.com/a/20884620
has comment: http://stackoverflow.com/comment/31341079
has comment: http://stackoverflow.com/comment/31341057
accepted answer of: http://stackoverflow.com/q/20884545
has comment: http://stackoverflow.com/comment/31341647
upvote count: 3
has comment: http://stackoverflow.com/comment/31342269
has body: public static Level level; level = new Level(); is same as public static Level level = new Level(); If you just consider the statement public static Level level; level being an static variable is set to null.(All instance variables and static variables are assigned default values unlike local variables.) level.render(g); This is calling an function render() defined in the class Level. It calls it in the instance of Level stored earlier in the variable level and passes in the parameter g. block[x][y].render(g); means you have an 2D array which stores objects of class which has the definition of function render() in it. block[x][y].id = whatever means you take the Object stored in the 2D array and assign value to the variable id defined in that Object. Again if you are doing this outside class in which id is define then id variables must be in scope(public/protected in that sense).
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31341268
type: Answer
has comment: http://stackoverflow.com/comment/31342528
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/20884545
has comment: http://stackoverflow.com/comment/31341996

http://stackoverflow.com/a/20929423
has comment: http://stackoverflow.com/comment/31426922
upvote count: 2
has comment: http://stackoverflow.com/comment/31426740
type: Answer
has body: In the Activity providing the data, use Intent#putExtra(): ArrayList &lt;String []&gt; list = new ArrayList &lt;String[]&gt;(); list.add (new String [] {"a","b"}); Intent i = new Intent (this,YourTargetActivity.class); i.putExtra("list", list); startActivity(i); Then to retrieve, use Intent#getSerializableExtra() and cast to ArrayList &lt;String[]&gt; : ArrayList &lt;String[]&gt; list = (ArrayList&lt;String[]&gt;) getIntent().getSerializableExtra("list"); You need to cast because the compiler cannot tell that the Serializable instance is really an ArrayList&lt;String[]&gt;. You will get an unchecked conversion warning, which makes sense because this does away with the type safety. It is fine though, because you know that you passed an ArrayList&lt;String[]&gt; so retrieving it won't cause any ClassCastExceptions. One caveat however, is that all the elements must be non-null. For example, if "a" was instead null, when the Runtime recreates the List, a NullPointerException will be thrown.
has comment: http://stackoverflow.com/comment/31426706
score: 2
has comment: http://stackoverflow.com/comment/31426874
has comment: http://stackoverflow.com/comment/31426905
has comment: http://stackoverflow.com/comment/31426828
has comment: http://stackoverflow.com/comment/31426676
has comment: http://stackoverflow.com/comment/31426774
accepted answer of: http://stackoverflow.com/q/20929248
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31426947
has comment: http://stackoverflow.com/comment/31427024
has comment: http://stackoverflow.com/comment/31426970
has comment: http://stackoverflow.com/comment/31426699
answers question: http://stackoverflow.com/q/20929248

http://stackoverflow.com/q/20964894
has comment: http://stackoverflow.com/comment/31493870
has comment: http://stackoverflow.com/comment/31493931
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/20965008
tagged with: java
has comment: http://stackoverflow.com/comment/31494010
has comment: http://stackoverflow.com/comment/31494034
has comment: http://stackoverflow.com/comment/31493937
type: Question
has body: I have some code where you can take an image from a folder and when a toggle button is on, the image will be resized and stored to another folder. When I run this code using a toggle button the app crashes saying "Unfortunately MyApps has stopped". This code is in Java and I want to run this program in android. How can I achieve this? public class ImageTest { private static int height; private static int width ; private static int IMG_HEIGHT=480; private static int IMG_WIDTH; public int image() { try{ BufferedImage bimg = ImageIO.read(new File("D:\\image\\12.jpg")); width = bimg.getWidth(); height = bimg.getHeight(); System.out.println("Width:"+width+" and height:"+height); IMG_WIDTH = ((IMG_HEIGHT * width)/height); BufferedImage originalImage = ImageIO.read(new File("d:\\image\\12.jpg")); int type = originalImage.getType() == 0? BufferedImage.TYPE_INT_ARGB : originalImage.getType(); BufferedImage resizeImageJpg = resizeImage(originalImage, type); ImageIO.write(resizeImageJpg, "jpg", new File("d:\\image\\12_jpg.jpg")); BufferedImage resizeImagePng = resizeImage(originalImage, type); ImageIO.write(resizeImagePng, "png", new File("d:\\image\\12_png.png")); BufferedImage resizeImageHintJpg = resizeImageWithHint(originalImage, type); ImageIO.write(resizeImageHintJpg, "jpg", new File("d:\\image\\12_hint_jpg.jpg")); BufferedImage resizeImageHintPng = resizeImageWithHint(originalImage, type); ImageIO.write(resizeImageHintPng, "png", new File("d:\\image\\12_hint_png.png")); return 1; }catch(Exception e){ System.out.println(e.getMessage()); return 0; } } private static BufferedImage resizeImage(BufferedImage originalImage, int type) { BufferedImage resizedImage = new BufferedImage(IMG_WIDTH, IMG_HEIGHT, type); Graphics2D g = resizedImage.createGraphics(); g.drawImage(originalImage, 0, 0, IMG_WIDTH, IMG_HEIGHT, null); g.dispose(); return resizedImage; } private static BufferedImage resizeImageWithHint(BufferedImage originalImage, int type) { BufferedImage resizedImage = new B…
has comment: http://stackoverflow.com/comment/31493902
tagged with: resize
score: 0
has comment: http://stackoverflow.com/comment/31494065
answer count: 1
has title: Resizing an image in android
has comment: http://stackoverflow.com/comment/31493900

http://stackoverflow.com/comment/31369957
type: Comment
has text: Can you please edit your answer on how to achieve it in c++. I'm new to c++. Java part I'll handle.
comment on: http://stackoverflow.com/a/20897911
type: AnswerComment
score: 0

http://stackoverflow.com/comment/45929406
comment on: http://stackoverflow.com/q/20962960
has text: Hi @Tenfour04, I have your same problem, did you come up with a solution? Anyway, your attempt seems returning me right values
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31502304
comment on: http://stackoverflow.com/a/20969660
score: 1
has text: @AstralProjection that is the way we use Long in `Java` else that is like an `int`
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31410956
score: 0
type: Comment
has text: @Stevie you made me cry ; /
type: AnswerComment
comment on: http://stackoverflow.com/a/20921305

http://stackoverflow.com/q/21012751
tagged with: jdatechooser
downvote count: 0
possible better answer: http://stackoverflow.com/a/27678905
has answer: http://stackoverflow.com/a/28122815
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/21012875
accepted answer: http://stackoverflow.com/a/21012875
tagged with: jlabel
upvote count: 3
has body: This is my infernal problem. nowadays i'm trying to create my project according to my Degree. I already have added jcalender to my project in netbeans, and i already added jDateChooser to my jFrame. my problem is, when i chooseing a date from jDateChooser how will display this date on a jLabel. i tried to using jLabel1.setText(jDateChooser1); but in this case error will occur. https://i.sstatic.net/FXeYO.jpg
has title: Get jDateChooser date to jLabel
tagged with: swing
has answer: http://stackoverflow.com/a/27678905
has comment: http://stackoverflow.com/comment/31582500
has comment: http://stackoverflow.com/comment/31582728
tagged with: jcalendar
type: AnsweredQuestion
score: 3
linked to: http://stackoverflow.com/q/1746758
has answer: http://stackoverflow.com/a/39062222
has answer: http://stackoverflow.com/a/47927808
tagged with: java
type: Question

http://stackoverflow.com/q/20869559
has answer: http://stackoverflow.com/a/20870132
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20869574
has title: How to create an array from an arraylist
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/20869570
has answer: http://stackoverflow.com/a/20869633
has comment: http://stackoverflow.com/comment/31313694
tagged with: arrays
tagged with: arraylist
has body: ArrayList&lt;Student&gt; alist = new ArrayList(); // object type is student //arraylist contains student objects Student[] arr= new Student[un.size()]; for(int i = 0; i &lt;= alist .size(); i++){ them[i] = arr.get(i); } What I want to do is to create an array of students without getting the array out of bounds exception.
has answer: http://stackoverflow.com/a/20869623
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/31586133
type: QuestionComment
has text: possible duplicate of [Is Java "pass-by-reference"?](http://stackoverflow.com/questions/40480/is-java-pass-by-reference)
type: Comment
comment on: http://stackoverflow.com/q/21014891
score: 0

http://stackoverflow.com/a/20923765
answers question: http://stackoverflow.com/q/20923753
type: Answer
downvote count: 0
has body: You can use either: private Slot[][] board = {{Slot.UNFILLED, ... or private Slot[][] board = {{UNFILLED, ... in which case you need to add a static import: import static your.package.Board.Slot.*;
score: 3
upvote count: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20923753

http://stackoverflow.com/comment/31387026
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20908520
has text: check the edit of my answer

http://stackoverflow.com/comment/31512633
score: 0
comment on: http://stackoverflow.com/a/20975018
type: Comment
has text: If you do the delegation in the other direction, then you can use Arrays.asList() which will build a list backed by the actual array. Then you save yourself from having to do the work of copying the items back into the list.
type: AnswerComment

http://stackoverflow.com/comment/31319395
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20870639
has text: The ` ...` is a generic type parameter. It could have been any name, but the convention generally is taking one letter. In this case I should have used a distinguishing A or B.

http://stackoverflow.com/comment/31394249
comment on: http://stackoverflow.com/a/20912060
score: 0
type: Comment
has text: This is the beauty of JPA, doesn't matter how the database manages the limits, for JPA is always the same sintaxis
type: AnswerComment

http://stackoverflow.com/comment/31428612
has text: DeleteLocalRef for the jobject also i have done.But still the crash is seen...Inorder to use PushLocalFrame(env,size)...i dont know exactly how many references will be created insde that function internally..Is there any solution for that or should i blindly set the size to some value...
type: AnswerComment
comment on: http://stackoverflow.com/a/20918022
type: Comment
score: 0

http://stackoverflow.com/a/21009596
answers question: http://stackoverflow.com/q/21008946
type: Answer
has body: Rather than having a Map&lt;String,String&gt; where the key is the integer value you could have the key as the error message and then the value could hold a list of the integer values so when reading the file it would become something like and also implement a comparator in the map to order them: Map&lt;String, String&gt; map = new TreeMap&lt;String, List&lt;String&gt;&gt;(new Comparator&lt;String&gt;() { @Override public int compare(String s1, String s2) { //Implement a compare to get the order of string you want } } ); String line = ""; while((line = reader.readLine()) != null) { String lineStr = line.split(" ")[1]; // get the message List&lt;String&gt; vals = map.get(lineStr) // get the existing list if( vals == null) vals = new ArrayList&lt;String&gt;(); // create a new list if there isn't one vals.add(getFeild(line)); // add the int value to the list map.put(lineStr,vals); // add to map } You could then sort the list into numeric order if you wanted. Also this would then require a bit more work to print out the map - but this depends on the format
score: 0

http://stackoverflow.com/q/20944898
has answer: http://stackoverflow.com/a/23682808
has comment: http://stackoverflow.com/comment/31462698
tagged with: java
type: Question
has title: Struts 2 unable to load interceptor file
has comment: http://stackoverflow.com/comment/31465918
tagged with: struts
tagged with: struts2
score: 0
has body: I'm new to struts2 and I'm having problems loading the custom interceptor file into my demo Struts2 application. I have tested and checked all my java, jsp and xml files and everything seems ok. At run time I have the following error and I'm not sure how to fix it. The application works but the interceptor is not invoked and the print line statements are not printed. WARNING: Unable to load config class com.ao.businessobjects.interceptor at interceptor - file:/Users/faraichirawu/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/AO/WEB-INF/classes/struts.xml:16:86 probably due to a missing jar, which might be fine if you never plan to use the LoginInterceptor interceptor Jan 05, 2014 4:27:20 PM com.opensymphony.xwork2.config.providers.InterceptorBuilder error SEVERE: Actual exception Caught Exception while registering Interceptor class com.ao.businessobjects.interceptor - interceptor - file:/Users/faraichirawu/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/AO/WEB-INF/classes/struts.xml:16:86 at com.opensymphony.xwork2.factory.DefaultInterceptorFactory.buildInterceptor(DefaultInterceptorFactory.java:64) at com.opensymphony.xwork2.ObjectFactory.buildInterceptor(ObjectFactory.java:202) at com.opensymphony.xwork2.config.providers.InterceptorBuilder.constructInterceptorReference(InterceptorBuilder.java:70) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.lookupInterceptorReference(XmlConfigurationProvider.java:1110) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.buildInterceptorList(XmlConfigurationProvider.java:626) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:440) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:552) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:292) at org…
answer count: 1
tagged with: interceptor
type: UnansweredQuestion

http://stackoverflow.com/comment/31325679
type: Comment
type: AnswerComment
has text: @peeskillet you have to look? i don't believe you
score: 0
comment on: http://stackoverflow.com/a/20875713

http://stackoverflow.com/q/20930098
has body: Pointcut declaration: @Pointcut(value="com.someapp.someservice.someOperation() &amp;&amp; args(t,req)",argNames="t,req") private void logOperationArg(final String t,final String req) { } Advice Declaration not compiling: @Before(value="logOperationArg(t,req)") public void logBeforeOperationAdvice(JoinPoint jp, final String t, final String req){ ... } When compiling Aspect with Aspectj-maven-plugin (1.5 version), have error "can not build thisJoinPoint lazily for this advice since it has no suitable guard [Xlint:noGuardForLazyTjp]" But the same advice compiles without JoinPoint argument. Advice Declaration compiling: @Before(value="logOperationArg(t,req)") public void logBeforeOperationAdvice(final String t, final String req){ ... }
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20931312
upvote count: 1
has comment: http://stackoverflow.com/comment/31430288
has title: Spring Aop Error Can not build thisJoinPoint lazily for this advice
type: Question
tagged with: aspectj-maven-plugin
downvote count: 0
tagged with: spring-aop
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/comment/93338595
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20923372
has text: I don't know if it is of any help, but you can run PHP applications on Java EE servers by using Caucho Quercus, a PHP engine written in Java. Be cautious, it's PHP 5 only... http://quercus.caucho.com/
score: 0

http://stackoverflow.com/a/38090797
type: Answer
answers question: http://stackoverflow.com/q/20964469
score: 0
has body: In case someone is looking for a quick solution to the problem, here is the code for deselecting all the selected rows and columns of the table, once the table looses focus. jtable.addFocusListener(new java.awt.event.FocusAdapter() { @Override public void focusLost(java.awt.event.FocusEvent evt) { clearSelection(); } }); Simply add this focus listener to each of your tables and their selected rows and columns will be deselected, once you select the records in a different table.

http://stackoverflow.com/comment/31581009
type: Comment
has text: if its different layout with the same ids there is no problem. and op already has different layouts
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21011709

http://stackoverflow.com/comment/31452759
score: 0
comment on: http://stackoverflow.com/q/20942821
type: QuestionComment
has text: In your server code, do not close the outputstream after writing to the socket. Closing the outputstream will also close the socket.
type: Comment

http://stackoverflow.com/q/20976909
type: Question
tagged with: playframework
answer count: 1
downvote count: 0
favorite count: 0
has body: At the moment we're running our Play app on port 9000 with Apache as a front-end HTTP server like so: &lt;VirtualHost *:80&gt; ServerName vms.gltd.net ProxyPass /http-bind http://vms.gltd.net:5280/http-bind/ ProxyPassReverse /http-bind http://vms.gltd.net:5280/http-bind/ ProxyPass / http://vms.gltd.net:9000/ ProxyPassReverse / http://vms.gltd.net:9000/ &lt;/VirtualHost&gt; However when a user signs up Play Authenticate uses the port from play.mvc.Http.Request which is 9000 not 80. Is there a way to override the port Play Authenticate uses or do we have to move our Play app to its own server and run it on port 80? thanks, -Leon
tagged with: playframework-2.0
type: UnansweredQuestion
upvote count: 1
tagged with: play-authenticate
has title: How to get change the port Play Authenticate uses for redirects and email URLs?
has answer: http://stackoverflow.com/a/21015750
score: 1
tagged with: java

http://stackoverflow.com/a/21005150
score: 0
answers question: http://stackoverflow.com/q/21005043
type: Answer
has body: This is not a trivial problem, the best way to fight it is to try some post-mortem analysis of your object pool after the problem rises again. I would use jconsole (it is for free and included in every modern JDK), and there are other tools. Once you have that analysis, there are 2 options: You find some evidence that some objects are out of control (maybe someone did a programming error and they are leaking objects). A code change should fix it Everything is normal, but it just eats a lot of memory. In that case, talk with your operator (if it is not you) to see how to size your server JVM memory. Have a look at this: How can I increase the JVM memory?

http://stackoverflow.com/q/20911127
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20913196
upvote count: 1
tagged with: emacs
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/74738812
type: Question
has body: I'm looking at jumping back into using Emacs as my primary editor. The trick here is that I've never really done large project work with Emacs. Up to this point I've used Visual Studio, but on my latest project build on Node (transpiling some CoffeeScript -- not something I can change) and Java, I'd like to make the full switch. I am using IntelliJ/WebStorm at the moment, but if I had some of the features I find in those editors I'd be willing to make the move whole sale. Surprisingly in WebStorm there is a Go to Usage and Go to Declaration feature for CoffeeScript (I'd imagine the same for pure JavaScript). How do veterans of Emacs traverse code in a similar fashion, that is how do they normally Go to Usage or Go to Declaration? It's likely different for Java than for JavaScript, but I'd like to know the differences and possible headaches of setting this up with Emacs.
has title: How can one 'Go to definition' in Java and JavaScript using Emacs?
tagged with: intellij-idea
downvote count: 0
tagged with: javascript
favorite count: 0
has comment: http://stackoverflow.com/comment/31391750
has answer: http://stackoverflow.com/a/20924270
answer count: 4
has answer: http://stackoverflow.com/a/21679184

http://stackoverflow.com/comment/31281075
type: Comment
comment on: http://stackoverflow.com/a/20852510
type: AnswerComment
has text: @BrianRoach: I am totally aware that knowing the answer to this question doesn't save you time, since there are tons of other things that overwhelms any time you can save from it.
score: 0

http://stackoverflow.com/q/20901145
has comment: http://stackoverflow.com/comment/31374926
downvote count: 0
has body: I am having a requirement to add a sentence on a JSP page with a hyperlink, which it'll redirect to a different page, and this sentence needs to be automatically removed after two days from the deployment date. Example: Football tournament on 20th Jan 2014 Is there any techniques available in Java to add a schedule job to a particular JSP text? I am using Struts 2 in my application as well.
score: 1
tagged with: java
type: Question
has title: Creating a sentence on a JSP page with a hyperlink that will be automatically removed after two days from the deployment date
tagged with: ognl
tagged with: hyperlink
has comment: http://stackoverflow.com/comment/31376709
tagged with: struts2
has answer: http://stackoverflow.com/a/20909797
has comment: http://stackoverflow.com/comment/31375402
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/31372152
tagged with: jsp
has comment: http://stackoverflow.com/comment/31374702
has comment: http://stackoverflow.com/comment/31375159
favorite count: 0
has comment: http://stackoverflow.com/comment/31375795
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31374798

http://stackoverflow.com/q/20922681
tagged with: mom
has answer: http://stackoverflow.com/a/21018859
has body: ActiveMQ Message Groups are a wonderful feature for load balancing across multiple consumers. In short: a stream of messages is partitioned across multiple consumers of a single queue according to a group identifier embedded in the message (JMSXGroupID). (So, consumer 1 will get all messages with JMSXGroupID = a, consumer 2 will get all messages with JMSXGroupID = b, and so on.) Now, imagine you have 2 queues: A and B, and imagine that a consistent taxonomy of JMSXGroupIDs is used in messages flowing through both queues. Will the consumer the broker chooses for JMSXGroupID = ABC on queue A be the consumer from the same connection that the broker chooses for JMSXGroupID = ABC on queue B? I suspect the answer to the question as I've asked it is "no." There are too many variables in play: What happens if the consumer the broker chooses for A has no corresponding consumer for B? What happens if the consumer the broker chooses for A has multiple corresponding consumers for B? There's no obvious right answer in these cases. However, can we simulate this behavior? For example, a consumer on a composite destination could be a viable solution -- make sure all consumers on A and B consume on the composite destination A,B and you might be in business -- but ActiveMQ does not appear to support consuming from composite destinations. The only solution I've found is simply to push messages for both A and B on one single queue -- call it AB -- and have an exclusive consumer on that. You now have to distinguish between "A messages" and "B messages," but you could easily do that with headers. However, this solution smells funny. (You now have to assume producers will dutifully apply special headers to their messages, or modify your payloads.) Is there a solution that will make sure consumers across two separate queues A and B always land on the same connection?
type: Question
has title: ActiveMQ Message Group Consumer Selection Across Multiple Queues?
tagged with: message-queue
downvote count: 0
answer count: 1
favorite count: 0
tagged with: jms
type: UnansweredQuestion
upvote count: 1
tagged with: activemq-classic
score: 1
tagged with: java

http://stackoverflow.com/comment/31353575
score: 2
has text: One line of code isn't enough to determine for sure if you are doing something correctly. However I would use the information from each field to construct a Book object (i.e. `Book bk = new Book(title, author, isbn)`), then add that object to a list (i.e. `list.add(bk)`).
comment on: http://stackoverflow.com/q/20890880
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31556175
type: QuestionComment
has text: How do you determine the ball has hit the brick without having a reference to the brick? What does `add (brick)` do?
comment on: http://stackoverflow.com/q/20998786
score: 0
type: Comment

http://stackoverflow.com/a/25211084
downvote count: 0
has comment: http://stackoverflow.com/comment/39294928
upvote count: 2
type: Answer
score: 2
has body: Here is a code I have tested to generate all possible combinations out of given array: enter code here import java.util.Arrays; public class PasswordGen { static String[] options = { "a", "b", "c", "d" }; static String[] places = new String[options.length]; static int count; public static void main(String[] args) { // Starting with initial position of a i.e. 0 sequence(0, places.clone()); } private static void sequence(int level, String[] holder) { if (level &gt;= options.length) { // combination complete System.out.println("" + (++count) + " Combination " + Arrays.toString(holder)); return; } String val = options[level]; String[] inrHolder = null; for (int c = 0; c &lt; holder.length; c++) { inrHolder = holder.clone(); if (inrHolder[c] == null) { inrHolder[c] = val; sequence(level + 1, inrHolder.clone()); } } return; } }
has comment: http://stackoverflow.com/comment/47462248
answers question: http://stackoverflow.com/q/20935315

http://stackoverflow.com/a/22961905
type: Answer
answers question: http://stackoverflow.com/q/20966143
score: 2
downvote count: 0
upvote count: 2
has body: I'm always in favor of the constants approach. The reason is that I believe it gets more readable than chaining several matchers. Instead of your example: class MyObjectTest{ @Test(expected=NullPointerException.class) public void testConstructor_ShouldThrowNullpointer_IfSecondParamIsNull(){ new MyObject(Any.anyInteger().nonnegative(), null); } } I would d: class MyObjectTest{ private static final int SOME_NON_NEGATIVE_INTEGER = 5; @Test(expected=NullPointerException.class) public void testConstructor_ShouldThrowNullpointer_IfSecondParamIsNull(){ new MyObject(SOME_NON_NEGATIVE_INTEGER, null); } } Also, I prefer the use of 'SOME' over 'ANY', but that's also a matter of personal taste. If you're considering testing the constructor with a number of different variants as you mentioned (nonNegative(), negative(), thatStartsWith(), etc.), I would that instead you write parameterized tests. I recommend JUnitParams for that, here's how I'd do it: @RunWith(JUnitParamRunner.class) class MyObjectTest { @Test(expected = NullPointerException.class) @Parameters({"-4000", "-1", "0", "1", "5", "10000"}) public void testConstructor_ShouldThrowNullpointer_IfSecondParamIsNull(int i){ new MyObject(i, null); } ... }

http://stackoverflow.com/comment/31475147
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/44637/discussion-between-ghostderfel-and-user2915567)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20954235

http://stackoverflow.com/comment/31403888
type: Comment
type: QuestionComment
has text: They are the default of apache-tomcat-7.0.27. I'm using a clean apache-tomcat-7.0.27 installation.
score: 0
comment on: http://stackoverflow.com/q/20917274

http://stackoverflow.com/q/20931570
has comment: http://stackoverflow.com/comment/31430708
has answer: http://stackoverflow.com/a/20931656
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20931659
tagged with: java
tagged with: loops
type: Question
answer count: 2
has body: I'm trying to write a program which is a game that generates random letters and the user selects whether random generated letters are part of user's name. I have not started the second algorithm, I want to focus on the first one. UPDATE: Hey, so I followed you guys advice and I was able to get the algorithm 1 to work. Now the only thing for me to finish algorithm 1 is to have a loop that checks whether the randomly generated letter is in the wrongLetters arrayList. If it is, then it would generate another random letter and if its not part of the arrayList, it would ask the user whether its the next letter. The wrongLetters arraylist should hold several strings (letters) that are not the next letter in user name. As soon as a letter is correctly guessed, it would clear the wrong letters arraylist and add new strings when guessing for the next letter after that. I tried using a do/while loop using while(actualLetter != wrongLetters); but I keep getting an error about "incompatible operand types". How can i fix this? thanks again. Thanks again! /* * PSEUDOCODE: * -Ask user to choose an option (algorithm 1, algorithm 2, quit) * -if user selects algorithm 1, generate a random number to pass off as unicode(char) and then change char to string * -ask user whether generated char is part of their name * -if yes, then add (actualLetter) string to arrayList(name). * -if no, then add (actualLetter) string to arrayList(wrongLetters). * reask user to choose an option (algorithm 1, algorithm 2, quit) * whether user chooses algorithm 1 or 2, after generating random char, check char to make sure its not in the arrayList(wrongLetters) * if char is in the wrongLetters arrayList, then generate another random char until a char that is not in that array generates * * */ import javax.swing.JOptionPane; import java.util.ArrayList; public class Lab_1 { public static void main(String[] args) { int n; ArrayList&lt;String&gt; name = new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; wrongL…
tagged with: arraylist
has comment: http://stackoverflow.com/comment/31430733
score: 0
has title: How can I add a string to a string array list via a loop

http://stackoverflow.com/comment/31315313
has text: Try import javax.microedition.lcdui.game.*;
comment on: http://stackoverflow.com/q/20867358
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31391290
comment on: http://stackoverflow.com/q/20910937
type: QuestionComment
has text: where do you get the error? what line?
type: Comment
score: 2

http://stackoverflow.com/comment/31719477
comment on: http://stackoverflow.com/q/20995133
type: Comment
score: 1
type: QuestionComment
has text: Is kie-ci.jar on the classpath of your application?

interceptor
tags question: http://stackoverflow.com/q/20997346
tags question: http://stackoverflow.com/q/20975789
tags question: http://stackoverflow.com/q/20993574
tags question: http://stackoverflow.com/q/20944898
tag name: interceptor
tags question: http://stackoverflow.com/q/20992861
type: Tag

http://stackoverflow.com/q/20977210
type: Question
upvote count: 1
answer count: 1
tagged with: adapter
favorite count: 0
tagged with: android
has body: It is my desire to use multiple adaptable GridViews to populate several sections on the screen with different data. There is an undetermined amount of sections, and items in each section so the solution must be flexible. Each section will have a section header title and its own gridview, filled with an unknown number of items. These elements must be clickable to take you to another screen for that element. So the desired screen would look something like this: __________________________________ | **Section1** | | | | GridView1 GridView1 GridView1 | | Item1 Item2 Item3 | | | | GridView1 GridView1 | | Item4 Item5 | | | | | | **Section2** | | | | GridView2 GridView2 GridView3 | | Item1 Item2 Item3 | | | | | | **Section3** | | | | GridView3 GridView3 | | Item1 Item2 | | | | | | **Section4** | | | | GirdView4 GridView4 GridView4 | | Item1 Item2 Item3 | |__________________________________| Thanks in advance for the help!
type: AnsweredQuestion
tagged with: gridview
downvote count: 0
tagged with: android-fragments
has title: Android GridView Adapter to Populate Multiple Sections
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20979037
accepted answer: http://stackoverflow.com/a/20979037

http://stackoverflow.com/comment/31579117
type: QuestionComment
has text: @AmulyaKhare It looks like, you sir, were correct. I moved the bulk of that in `doInBackround`; no crash, UI not blocked; go ahead and mark that as the answer.
score: 0
comment on: http://stackoverflow.com/q/21010566
type: Comment

http://stackoverflow.com/comment/31321449
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20873556
has text: Thank you for your response but I'm not allowed to use lists in my project!

http://stackoverflow.com/a/20957784
answers question: http://stackoverflow.com/q/20957407
type: Answer
has body: Consider to wrap Hashtable class. It does not allow nulls, however it implements Map interface. You can do this in a way as HasSet wraps HashMap. Take into account Hashtable is synchronized. Use next, but it is a really implicit and could make code reading harder HashSet&lt;String&gt; set = new HashSet&lt;String&gt;() { @Override public boolean add(String s) { if(s == null) throw new NullPointerException(); return super.add(s); } }; Use TreeMap, but before actual using it add just one element, because it accepts null only as initial element
downvote count: 1
score: -1
upvote count: 0

http://stackoverflow.com/comment/31334513
has text: @user3153149 Yes right.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20880695

http://stackoverflow.com/q/20858445
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/31291835
has title: getting "CursorIndexOutOfBoundsException "
upvote count: 1
tagged with: sqlite
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/20858710
accepted answer: http://stackoverflow.com/a/20858710
has comment: http://stackoverflow.com/comment/31291886
has body: I'm trying to retrieve the data of sqlite database . and put it on a string to display it further but I'm getting this error , Kindly help me in solving the error ! here is the logcat data showing error 12-31 13:18:55.141: E/1.6(3833): 2222 12-31 13:18:55.191: E/1.2.2(3833): android.database.CursorIndexOutOfBoundsException: Index 9 requested, with a size of 9 12-31 13:18:55.191: E/1.7(3833): 2222 and here is the piece of code which is showing the error! public String getdata() { // TODO Auto-generated method stub Log.e("1.1", "2222"); String[] column = new String[]{KEY_ROWID, KEY_NAME, KEY_HOTNESS }; Log.e("1.2", "2222"); Cursor c = ourDatabase.query(DATABASE_TABLE, column, null, null, null, null, null); Log.e("1.3", "2222"); String result = ""; Log.e("1.4", "2222"); int iRow = c.getColumnIndex(KEY_ROWID); int iName = c.getColumnIndex(KEY_NAME); int iHotness = c.getColumnIndex(KEY_HOTNESS); Log.e("1.5", "2222"); try{ for(c.moveToFirst(); !c.isAfterLast(); c.moveToNext()); { Log.e("1.6", "2222"); result = result + c.getString(0) + " " + c.getString(1) + " " + c.getString(2) + "\n"; } }catch(Exception e) { Log.e("1.2.2", e.toString()); } Log.e("1.7", "2222"); return result; } Note : after putting the below code in try catch it's moving to next activity but not showing any result data for(c.moveToFirst(); !c.isAfterLast(); c.moveToNext()); { Log.e("1.6", "2222"); result = result + c.getString(0) + " " + c.getString(1) + " " + c.getString(2) + "\n"; } next activity code : TextView tv = (TextView) findViewById(R.id.textView3); Log.e("1", "111111"); HotOrNot info = new HotOrNot(this); Log.e("2", "111111"); info.open(); Log.e("3", "111111"); String data = info.getdata(); Log.e("4", "111111"); info.close(); Log.e("5", "111111"); tv.setText(data); Log.e("6", "111111"); } }
tagged with: android
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/31391323
comment on: http://stackoverflow.com/a/20910861
type: Comment
has text: 1) Better to use line start/end anchors `^ and $` to make sure your match is most accurate. 2) In the `.+?` `?` is used to make matching non-greedy or reluctant. 3) Same as 1).
score: 0
type: AnswerComment

http://stackoverflow.com/a/20948606
answers question: http://stackoverflow.com/q/20947596
has comment: http://stackoverflow.com/comment/33510571
type: AcceptedAnswer
has body: Text showing operators While parsing a already present pdf, I am using if(op.getOperation().equals( "TJ")) to get text operators, There are more text showing operators you have to take care of in general: string Tj Show a text string. string ' Move to the next line and show a text string. This operator shall have the same effect as the code T* string Tj aw ac string " Move to the next line and show a text string, using aw as the word spacing and ac as the character spacing (setting the corresponding parameters in the text state). aw and ac shall be numbers expressed in unscaled text space units. This operator shall have the same effect as this code: aw Tw ac Tc string ' array TJ Show one or more text strings, allowing individual glyph positioning. Each element of array shall be either a string or a number. If the element is a string, this operator shall show the string. If it is a number, the operator shall adjust the text position by that amount; that is, it shall translate the text matrix, Tm. The number shall be expressed in thousandths of a unit of text space (see 9.4.4, "Text Space Details"). This amount shall be subtracted from the current horizontal or vertical coordinate, depending on the writing mode. In the default coordinate system, a positive adjustment has the effect of moving the next glyph painted either to the left or down by the given amount. (Table 109 in the Pdf specification ISO 32000-1) Text color The color used to show text depends on the current text rendering mode. The text rendering mode, Tmode, determines whether showing text shall cause glyph outlines to be stroked, filled, used as a clipping boundary, or some combination of the three. (section 9.3.6 in the Pdf specification ISO 32000-1) It is set using the Tr operator: render Tr Set the text rendering mode, Tmode, to render, which shall be an integer. Initial value: 0. (Table 105 in the Pdf specification ISO 32000-1) Depending on this mode you have to consider the current stroke color, th…
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/20947596
downvote count: 0
has comment: http://stackoverflow.com/comment/33512722

http://stackoverflow.com/comment/31476102
type: Comment
comment on: http://stackoverflow.com/a/20955727
type: AnswerComment
has text: yes I tried that too. Actually I just came up with a solution, I'll post it below.
score: 0

http://stackoverflow.com/comment/31590099
type: Comment
has text: @NicolasZozol Yes you can provide a custom comparator. Note that if you add two different people (by their name) with the same amount of money, the set will only keep one of them with the comparator you provided.
type: AnswerComment
comment on: http://stackoverflow.com/a/21016034
score: 0

http://stackoverflow.com/a/21017419
score: 1
has comment: http://stackoverflow.com/comment/31635959
upvote count: 1
has comment: http://stackoverflow.com/comment/31627110
has comment: http://stackoverflow.com/comment/31628980
has comment: http://stackoverflow.com/comment/31628191
type: Answer
has comment: http://stackoverflow.com/comment/31628512
downvote count: 0
has body: Messages are not stored in the topic. If you create a Publisher, send messages ans then start a subscriber no messages will be subscribed. At the time of publishing if there are any subscribers subscribed to that topic then only those subscribers will receive the message. If no subscribers exist then messages will be dropped. It goes into waiting state that means it is waiting for messages from the JMS server and there are no currently available. Whatever mode of subscribing you are using - asynchronous(MessageListener) or Synchronous(receive) you need to create subscriber before. You can use subscriber.receive(long timeout); if you do not want to wait indefinitely.
has comment: http://stackoverflow.com/comment/31627028
has comment: http://stackoverflow.com/comment/31630281
answers question: http://stackoverflow.com/q/21017310

http://stackoverflow.com/q/20907506
has body: I have a simple index.html file: DISPO Truck Star DISPO Fahrer: PIN: Auflieger: Zum Start PIN ändern Touren In the textfield "password" I type the password, which should be compared with the one stored in the database after a click on the button "Touren". The button click fires an event, after that the following function is called: function vergleicheFahrer(){ var pinCode = $('#password').val(); $.ajax({ type: 'GET', url: rootURL + '/' + pinCode, // var rootURL = "http://localhost:8080/DISPOTruckStar-Backend/rest/api"; dataType: "json", success: function(data){ alert("Very wonderful! You received following data:" + data); retrieveTourContent(); }, error: function(){ alert("Fehler in der Methode vergleicheFahrer()"); } });} The request goes through and a success function is called, but the Eclipse console says that com.microsoft.sqlserver.jdbc.SQLServerDriver was not found. Here the code for handling the "GET" request: @Path("/api") public class RestResource { FahrerTruckModellDAO fahrerTruckModellDAO = new FahrerTruckModellDAO(); @GET @Path("{PinCode}") @Produces({MediaType.APPLICATION_JSON}) public String getFahrerByPinCode(@PathParam("PinCode") String pinCode) { return FahrerTruckModellDAO.getFahrerByPinCode(pinCode); } } The DAO Object code: public class FahrerTruckModellDAO { /*public static void main(String[] args) { getFahrerByPinCode("1402"); }*/ public static String getFahrerByPinCode(String pinCode) { String query = "SELECT * from dbo.tDriver WHERE PinCode = ?"; Connection connection = null; try { connection = Database.getConnection(); PreparedStatement preparedStatement = connection.prepareStatement(query); preparedStatement.setString(1, pinCode); ResultSet resultSet = preparedStatement.executeQuery(); if(resultSet.next()) { String resultvalue = resultSet.getString(2); return resultvalue; } } catch (Exception e) { e.printStackTrace(); } return null; } } and finally the code of the "getConnection()" method: public static Connection getConnection() throws Ex…
has comment: http://stackoverflow.com/comment/31408611
has comment: http://stackoverflow.com/comment/31384525
tagged with: sql-server
score: 0
tagged with: jquery
tagged with: ajax
has comment: http://stackoverflow.com/comment/31384949
type: UnansweredQuestion
tagged with: jdbc
has comment: http://stackoverflow.com/comment/31384982
answer count: 0
tagged with: java
has title: java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver after calling an ajax request
type: Question

http://stackoverflow.com/comment/31584022
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21012868
has text: Yes... Able to hit the server... But, now I'm facing Invalid Request error. Debugging...
type: Comment

http://stackoverflow.com/comment/31646432
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20996544
score: 0
has text: I have no code of adding anything between rows as I simply did not know where to start from, I only do 'model.addRow( new Object[] {"","","","","","","","0","0","0","0","0","0","0","0","0","0", "0"});'

http://stackoverflow.com/q/20900931
tagged with: javascript
favorite count: 0
duplicate of: http://stackoverflow.com/q/119432
linked to: http://stackoverflow.com/q/119432
has answer: http://stackoverflow.com/a/20900962
has comment: http://stackoverflow.com/comment/31372082
upvote count: 7
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20900950
has answer: http://stackoverflow.com/a/20900950
score: 7
tagged with: java
accepted answer: http://stackoverflow.com/a/20900962
has title: how to print values in console using scriplet in javascript while a function is called
tagged with: scriptlet
has body: How to print values in console (like System.out.println() in java) using scriplet in javascript while a function is called ? if i used System.out.println("test") in scriplet the values is getting printed while a jsp form is loading but i want it to print only when a java script is called.
type: Question
answer count: 2
downvote count: 0
tagged with: jsp

http://stackoverflow.com/q/20965836
tagged with: log4j
tagged with: classloader
type: AnsweredQuestion
tagged with: java
has body: I have a shell script test.sh with following contents : echo " Running test.sh ..." | log test_cp=./test/jar/*:./test/lib/* test_main=com.test.TestApp java -cp $test_cp $test_main | log The relative paths used in the above file are correct as far as I understand. In this case, log4j jar is located at ./test/lib/ and the jar containing TestApp (test-app.jar) is located at ./test/jar/. Now, the current scenario is that log4j.properties is packaged inside test-app.jar and all Java classes are using the log4j logger to create logs. The contents of log4j.properties are as follows : log4j.rootLogger=ALL, CONSOLE, FILE log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout log4j.appender.CONSOLE.layout.ConversionPattern=%d %-5p [%t] %c %M - %n%m%n log4j.appender.FILE=org.apache.log4j.FileAppender log4j.appender.FILE.File=test-app.log log4j.appender.FILE.Append=false log4j.appender.FILE.layout=org.apache.log4j.PatternLayout log4j.appender.FILE.layout.ConversionPattern=%d %-5p [%t] %c %M - %n%m%n We want to externalize the log4j.properties and move it outside the test-app.jar. For this, I have placed log4j.properties at ./test/properties/ and modified the shell script accordingly as follows : echo " Running test.sh ..." | log test_cp=./test/properties/*:./test/jar/*:./test/lib/* test_main=com.test.TestApp java -cp $test_cp $test_main | log But I am getting the following error and no log file is generated, nor any logs get pronted on console. log4j:WARN No appenders could be found for logger (com.noknok.util.PropertiesLoader). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. I also read somewhere on the Internet that this could be a Java classloader issue, so I have tried changing the sequence of different locations in classpath, placing log4j.properties in the directories that are already included in the classpath, etc. But …
has title: Moving log4j.properties out of jar causing log4j warnings (logs are not generated)
type: Question
score: 0
answer count: 1
tagged with: shell
has answer: http://stackoverflow.com/a/20965985
accepted answer: http://stackoverflow.com/a/20965985

http://stackoverflow.com/comment/31577911
type: Comment
has text: Thank you I am going to look into the login rights tomorrow. I am also going to change the folder name then see if it gets created. I am trying to duplicate this by changing permissions.
comment on: http://stackoverflow.com/q/21009337
score: 0
type: QuestionComment

http://stackoverflow.com/a/21017484
accepted answer of: http://stackoverflow.com/q/21017410
answers question: http://stackoverflow.com/q/21017410
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has body: You can use calendar class for this purpose, YEAR and DAY_OF_YEAR are passed as your parameters: Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, 1997); cal.set(Calendar.DAY_OF_YEAR, 365); System.out.println(cal.getTime()); You can format it to your liking as well: SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-dd-MM"); System.out.println(dateFormat.format(cal.getTime())); Output: 1997-31-12
type: Answer

http://stackoverflow.com/a/20930161
upvote count: 1
has comment: http://stackoverflow.com/comment/31428032
has comment: http://stackoverflow.com/comment/31428048
score: 1
has comment: http://stackoverflow.com/comment/31428341
has comment: http://stackoverflow.com/comment/31428090
has comment: http://stackoverflow.com/comment/31428194
has comment: http://stackoverflow.com/comment/31428547
has comment: http://stackoverflow.com/comment/31428229
downvote count: 0
has comment: http://stackoverflow.com/comment/31428104
type: Answer
has comment: http://stackoverflow.com/comment/31428206
has body: Move all this inside onCreate after setContentView Spinner topSpinner; Spinner bottomSpinner; String topSpinnerVal; String bottomSpinnerVal; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); topSpinner = (Spinner) findViewById(R.id.input1Sp); bottomSpinner = (Spinner) findViewById(R.id.input2Sp); topSpinnerVal = topSpinner.getSelectedItem().toString(); bottomSpinnerVal = bottomSpinner.getSelectedItem().toString(); findViewById looks for a view with the id mentioned in the current inflated layout. So first you need to set the content of the layout to the activity and then initialize your views. Edit: You also have Spinner s1 = (Spinner) findViewById(R.id.input1Sp); Spinner s2 = (Spinner) findViewById(R.id.input2Sp); Why do you require the above when you already have the below topSpinner = (Spinner) findViewById(R.id.input1Sp); bottomSpinner = (Spinner) findViewById(R.id.input2Sp); Set the adapter to topSpinner and bottomSpinner Also if (topSpinnerVal == "Celsius") { Should be if (topSpinnerVal.equals("Celsius")) { Use .equals to compare strings. Similarly use .equals to compare strings in other places as well
answers question: http://stackoverflow.com/q/20930156
has comment: http://stackoverflow.com/comment/31428183
has comment: http://stackoverflow.com/comment/31428147

http://stackoverflow.com/comment/31402666
type: QuestionComment
comment on: http://stackoverflow.com/q/20916720
score: 3
has text: The best approach is to use a `TableCellRenderer`
type: Comment

http://stackoverflow.com/comment/31541538
has text: @Chris - yes, the setup is bizar and obscure :-), that's why I asked how to avoid it (http://stackoverflow.com/questions/20923013/is-there-an-interface-between-delphi-and-android-ndk). I edited my question to remove the obscurities you refer to, libmidi.so is a native language library and written in C. It creates its own thread. But I do not know whether I do something wrong or not when I don't know `where` Delphi/Java searches for libraries.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20982789

http://stackoverflow.com/q/20882576
possible better answer: http://stackoverflow.com/a/24167329
favorite count: 0
tagged with: spring
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/20884087
downvote count: 0
accepted answer: http://stackoverflow.com/a/20884087
tagged with: java
has answer: http://stackoverflow.com/a/24167329
has body: We have a large code base of approximately 200,00 lines where Spring 2.X is used as the basic application development framework. We are thinking of undertaking a major (and painful) upgrade to Spring 4.X because of the simple reason that Spring 2.X does not seem to have any commercial support anymore. I have also noticed that the last version of Spring Framework, 2.5.6, hasn't had any bug or security fixes for the past 5 years? Does this mean that Spring 2.X is an orphaned project? http://sourceforge.net/projects/springframework/files/?source=directory
type: Question
upvote count: 2
answer count: 2
has title: Has Spring Framework 2.X reached EOL?

http://stackoverflow.com/comment/31343771
type: QuestionComment
has text: This has nothing to do with your IDE (so don't add that tag). For better help sooner, post an [SSCCE](http://sscce.org/).
score: 2
comment on: http://stackoverflow.com/q/20886075
type: Comment

http://stackoverflow.com/comment/31310090
type: Comment
comment on: http://stackoverflow.com/a/20857030
type: AnswerComment
has text: Can you give link which can help explain this? Or elaborate?
score: 0

http://stackoverflow.com/comment/31478370
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20956837
type: AnswerComment
has text: To "listen" to your post she might need a Java Applet to change text to speech and might get malware from one of the quickly patched holes that's still left.

http://stackoverflow.com/q/20972769
favorite count: 0
tagged with: ocaml
has comment: http://stackoverflow.com/comment/31537148
upvote count: 2
tagged with: scala
has answer: http://stackoverflow.com/a/20974318
type: Question
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21010684
has answer: http://stackoverflow.com/a/21010684
has body: I'm about to write an abstract syntax for OCaml in scala, in combination with a pretty printer. After that I want execute the generated OCaml code from scala and work with the result. Is there a way to do that, without running a external OCaml compiler, execute the program and reading the result from stdout?
has title: How to execute OCaml code from Scala/Java?
tagged with: java
answer count: 2
tagged with: abstract-syntax-tree
downvote count: 0
accepted answer: http://stackoverflow.com/a/20974318

http://stackoverflow.com/q/21014902
tagged with: java
type: Question
answer count: 1
score: 4
favorite count: 0
tagged with: linux
has title: Using 'ps' command in Linux, how to see the realtime data?
upvote count: 4
downvote count: 0
tagged with: cpu
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21014989
accepted answer: http://stackoverflow.com/a/21014989
tagged with: ps
has body: I found that my java web server(tomcat) used high cpu, so I used 'ps aux' to see the process infomation, like: # ps aux | grep -E "PID|java" USER PID %CPU %MEM root 7533 143 39.8 It showed that java took 143% cpu. Then I used 'top' command to see, the cpu usage of java process was also about 140%. After that, I took the web server offline(no access, bug process still living). Then I used top to see, java used very low cpu: # top | grep -E "PID|java" PID %CPU %MEM TIME+ COMMAND 7533 0.7 39.9 455:13.81 java PID %CPU %MEM TIME+ COMMAND 'vmstat' also showed that the cpu was almost idle: # vmstat 1 -----cpu------ us sy id wa st 19 1 79 1 0 0 0 99 1 0 0 0 100 0 0 0 0 100 0 0 0 0 98 1 0 0 0 99 1 0 Then, I used 'ps' command again, the result was: #ps aux | grep -E "PID|java" USER PID %CPU %MEM root 7533 137 39.8 It showed that 7533 still takes 137% cpu! After a long time, I check 'ps' again, the result is still %137... So, dose the 'ps' command show some old data? And how can I see the realtime data by 'ps'(Because I want to use 'ps -L' to see the information of thread)? Or is that just impossible?

http://stackoverflow.com/comment/31384258
comment on: http://stackoverflow.com/q/20907386
type: Comment
type: QuestionComment
has text: If I understand correctly, you want language simpler than C (with regard to not needing pointers, memory allocation, running programs etc.), in order to teach the syntax. Although I hate to recommend it, what about javascript?
score: 0

http://stackoverflow.com/comment/31480317
type: QuestionComment
comment on: http://stackoverflow.com/q/20957536
has text: Frankly, all the guesswork going on in the answers is ridiculous. *Print out the character you are using on that line* and settle your problem. There was little point in going all the way to StackOveflow for a trifling NPE like this one.
score: 0
type: Comment

http://stackoverflow.com/q/20863935
tagged with: java
tagged with: methods
has comment: http://stackoverflow.com/comment/31303260
type: Question
tagged with: class
score: 0
tagged with: program-entry-point
answer count: 1
tagged with: string
has body: I have about a one year experience programming Java, I made a static method located in the main class, and for some reason, whenever I compile it gives me an error saying that the compareTo() method from the String class can't be found. Here's the method: public static void displaySpecificResort(String resortName, Resort[] resortList) { int low = 0; int high = resortList.length - 1; int mid; while (low &lt;= high) { mid = low + (high - low); if (resortList[mid].compareTo(resortName)&lt;0) low = mid + 1; else if (resortList[mid].compareTo(resortName)&gt;0) high = mid - 1; else resortList[mid].display(); } if(resortList[mid].getName().compareTo(resortName)!= 0) System.out.println("Resort could not be found."); } Here's the error it gives me when I try and compile: ResortOrganizer.java:157: error: cannot find symbol if (resortList[mid].compareTo(resortName)&lt;0) ^ symbol: method compareTo(String) location: class Resort ResortOrganizer.java:159: error: cannot find symbol else if (resortList[mid].compareTo(resortName)&gt;0) ^ symbol: method compareTo(String) location: class Resort 2 errors Can someone explain why it does this? I have a feeling I'm forgetting something important.
accepted answer: http://stackoverflow.com/a/20863946
has comment: http://stackoverflow.com/comment/31303502
has title: String method cannot be found in a main class method
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20863946

http://stackoverflow.com/comment/31557353
has text: Ok, what I did was to sign all the jars we used in our applet with the `<signjar>` ant task that I told you before. This way, jre stopped whining about certificates... Your application trusts every certificate it finds in its cacerts keystore in the jre directory, or you can tell it to use another keystore by code (I have done it in some webservice clients with axis or CXF, but I don't know how to apply it to your particular case :S )
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20998273

http://stackoverflow.com/a/20973767
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31519182
has body: There's no foolproof way that I know of to do this. Having said that, one approach could be to load the content from each URL, then apply the Levenshtein distance algorithm to all the pages that come under the same domain name. You could then set a threshold value as to how "similar" the content is before it's considered the same (as if the content changes slightly I'd imagine the bulk of it would still be identical.) Something like 10% of the page length could be a good starting point for that value. This might be relatively slow depending on how many sites you have, but would take into account slight differences in content on each load that a simple hash or length calculation wouldn't. To make this a bit more reliable you could check that certain things are identical (or not) across loads that you expect to be - for instance the title of the page.
type: Answer
has comment: http://stackoverflow.com/comment/31511129
has comment: http://stackoverflow.com/comment/31511376
upvote count: 2
has comment: http://stackoverflow.com/comment/31510177
answers question: http://stackoverflow.com/q/20973502
score: 2
accepted answer of: http://stackoverflow.com/q/20973502

http://stackoverflow.com/comment/31294973
type: Comment
type: QuestionComment
has text: Is this the only thing inserting into the table? If not, this won't be good enough anyway as between your check and your insert the number could be inserted. Instead, add a constraint onto the table, *try* to perform an insert, and catch whatever constraint violation exception is thrown and try again. Additionally, you should use parameterized SQL rather than string concatenation. Also look into using whatever facilities the database itself provides for this - if you *really* just want a unique ID, there are lots of ways of going about that. How important is randomness?
score: 3
comment on: http://stackoverflow.com/q/20860046

http://stackoverflow.com/comment/31624659
type: Comment
comment on: http://stackoverflow.com/a/21015239
has text: the output is wrong.. as it differ from my example the output for money is 24315, not 41325
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31345358
type: QuestionComment
has text: By a quick look at source: `DefaultSingletonBeanRegistry#beforeSingletonCreation` and `DefaultSingletonBeanRegistry#afterSingletonCreation` might be good spots for the profiling logic.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20886585

gwt
tags question: http://stackoverflow.com/q/20966133
tags question: http://stackoverflow.com/q/20940564
tags question: http://stackoverflow.com/q/20943738
tag name: gwt
tags question: http://stackoverflow.com/q/21000550
tags question: http://stackoverflow.com/q/20962961
tags question: http://stackoverflow.com/q/20994154
type: Tag
tags question: http://stackoverflow.com/q/20949540
tags question: http://stackoverflow.com/q/20979942
tags question: http://stackoverflow.com/q/20983481
tags question: http://stackoverflow.com/q/20900793
tags question: http://stackoverflow.com/q/20870082
tags question: http://stackoverflow.com/q/20964500
tags question: http://stackoverflow.com/q/20922779
tags question: http://stackoverflow.com/q/20988076
tags question: http://stackoverflow.com/q/20898241
tags question: http://stackoverflow.com/q/20894106
tags question: http://stackoverflow.com/q/20887878
tags question: http://stackoverflow.com/q/20977159
tags question: http://stackoverflow.com/q/20890346
tags question: http://stackoverflow.com/q/20910829
tags question: http://stackoverflow.com/q/20884823
tags question: http://stackoverflow.com/q/20912994
tags question: http://stackoverflow.com/q/20915197

http://stackoverflow.com/a/20919451
downvote count: 0
upvote count: 2
has body: Elegant or not, comparing the result of getClass() is standard practice. Except that you shouldn't return 0 but instead throw a ClassCastException. Returning 0 does not signal "not comparable", but "equal", and that relation has certain constraints you cannot meet with that design, such as transitivity: DiceA aLow, aHigh; DiceB b; In your case, aLow.compareTo(b) == b.compareTo(aHigh) == 0 but aLow.compareTo(aHigh) &lt; 0
answers question: http://stackoverflow.com/q/20919368
type: Answer
score: 2

http://stackoverflow.com/comment/31489043
type: AnswerComment
has text: `TextUtils.concat(WordToSpan, WordToSpan1)` worked :) I upvoted your answer. Thanks!
type: Comment
score: 0
comment on: http://stackoverflow.com/a/20961815

http://stackoverflow.com/q/20978454
favorite count: 0
tagged with: spring
possible better answer: http://stackoverflow.com/a/20981779
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20981779
tagged with: java
tagged with: spring-webflow-2
upvote count: 1
has body: How do I wire up a Spring ValidationMessages bundle in a custom Webflow Validator class? I have a validator implemented and working: public void validateBusinessReferences(BusinessReferencesViewDao businessReferences, Errors errors) { if (somecondition())) { errors.rejectValue("name", "validation.message123", "This field is bad."); } } But instead of the message from the ValidationMessages.properties file, I get the fallback default of This field is bad. All my other messages and validations work fine - it's just this custom validator/custom message scenario that's failing. I suspect a Spring configuration problem of some kind but I can't isolate it.
type: Question
has answer: http://stackoverflow.com/a/20982008
accepted answer: http://stackoverflow.com/a/20982008
answer count: 2
has title: Using ValidationMessages bundle with Spring Webflow Validation?
downvote count: 0
score: 1

http://stackoverflow.com/comment/31478677
has text: where is InstantiationException ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20957044

http://stackoverflow.com/comment/31303689
type: QuestionComment
has text: I don't know why people downvote this...and vote to close for primarily opinion based???
score: 0
comment on: http://stackoverflow.com/q/20863873
type: Comment

recursion
type: Tag
tags question: http://stackoverflow.com/q/20903309
tags question: http://stackoverflow.com/q/20923062
tag name: recursion
tags question: http://stackoverflow.com/q/20937907
tags question: http://stackoverflow.com/q/20998550
tags question: http://stackoverflow.com/q/20880744
tags question: http://stackoverflow.com/q/21009751
tags question: http://stackoverflow.com/q/20927873
tags question: http://stackoverflow.com/q/20984515
tags question: http://stackoverflow.com/q/20879602
tags question: http://stackoverflow.com/q/20875383
tags question: http://stackoverflow.com/q/20940160
tags question: http://stackoverflow.com/q/20889670

http://stackoverflow.com/comment/31489110
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20961695
has text: Thanks man, solved it. Cloning did the trick, I misunderstood the Singleton concept

http://stackoverflow.com/q/21002025
has title: Weird UnsupportedOperationException java error in cfdump
favorite count: 0
has comment: http://stackoverflow.com/comment/31564212
has body: When we log errors we like to collect some info about the state of the application to help us diagnose the cause. In our error logging code we have something like this: &lt;cfset local.scopeList = "CGI,FORM,URL,APPLICATION,REQUEST,COOKIE,CLIENT" /&gt; &lt;cfsavecontent variable="local.errorInfo"&gt; &lt;cfloop list="#local.scopeList#" index="local.scope"&gt; &lt;cfdump var="#Evaluate(local.scope)#" /&gt; &lt;/cfloop&gt; &lt;/cfsavecontent&gt; There's actually a bit more to it than that (we check whether local.scope is defined before trying to cfdump it and some other things related to our info gathering, but those are the basic bits). local.errorInfo is part of what we squirrel away for later viewing. Occasionally we'll see an exception come through and the TagContext shows that the error happened on the cfdump line in our code. The interesting thing is that in the TagContext our code is the third item. The first two are in \WEB-INF\cftags\dump.cfm and their RAW_TRACE info looks like at cfdump2ecfm1568701689._factor4({path on server}\WEB-INF\cftags\dump.cfm) and at cfdump2ecfm1568701689._factor1({path on server}\WEB-INF\cftags\dump.cfm) The actual Message item in the exception struct is empty string and the type is java.lang.UnsupportedOperationException. The strange thing is that if we run this exact code manually it clears up the issue and things go on fine for a while, but when it starts happening again it will continue to happen until we 'give it a kick' by running the code manually again. It's like something goes wonky and it can't recover until we help it. We are on CF10 and AFAIK we haven't upgraded either CF or Java any time close to the time when this first started happening. My question is what is causing this? (Bonus if you can explain why our workaround temporarily 'fixes' it.) Edit Here's a bit of the stack trace, starting at the top: java.lang.UnsupportedOperationException at coldfusion.thread.HttpServletRequestWrapper.getLocalPort(HttpServletRequestWr…
tagged with: exception
has comment: http://stackoverflow.com/comment/32612070
accepted answer: http://stackoverflow.com/a/21003608
tagged with: coldfusion
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31565008
has comment: http://stackoverflow.com/comment/31565204
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31563852
has answer: http://stackoverflow.com/a/21003608
downvote count: 0
answer count: 1

http://stackoverflow.com/q/20879108
has comment: http://stackoverflow.com/comment/31331466
has title: array assignment in c++
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20879118
has answer: http://stackoverflow.com/a/20879177
tagged with: c++
score: 2
has comment: http://stackoverflow.com/comment/31331360
tagged with: java
has comment: http://stackoverflow.com/comment/31331330
has comment: http://stackoverflow.com/comment/31331382
type: Question
has body: In c++ identifier of an array is a pointer and in java identifier of an array is a reference variable(practically a pointer). Let's say there are an array a and b. How come in java this operation is allowed: a = b; //the reference that 'b' holds will be copied to 'a' so both a and b point to the same array but in C++ the same action will be considered an invalid assignment. If a and b are both pointers in c++, why address that b holds won't be copied to a?
answer count: 2
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/31331387
tagged with: pointers
has comment: http://stackoverflow.com/comment/31331332
has comment: http://stackoverflow.com/comment/31331585
has comment: http://stackoverflow.com/comment/31331747
has comment: http://stackoverflow.com/comment/31331485

http://stackoverflow.com/q/20907872
has answer: http://stackoverflow.com/a/20908197
has comment: http://stackoverflow.com/comment/31432835
has comment: http://stackoverflow.com/comment/31385409
favorite count: 0
has title: Add zeros at the begining of a 32 -bit binary number.
type: Question
upvote count: 2
has body: I have a program that transforms decimal number into a binary number. I want the binary representation to have 32 digits, so I often need to add 0 at the beginning of the binary representation. How can I achieve it? Example: decimal: 9999999 binary: 00000000 01001100 01001011 00111111 This is the code I already have: Code: class Binaer { public static void main(String [] args) { java.util.Scanner scanner = new java.util.Scanner(System.in); long a = scanner.nextLong(); while ( a != 0) { System.out.println(Integer.toBinaryString(a)); } } }
has answer: http://stackoverflow.com/a/20908279
has comment: http://stackoverflow.com/comment/31385368
score: 0
has comment: http://stackoverflow.com/comment/31389473
tagged with: java
downvote count: 2
answer count: 3
has comment: http://stackoverflow.com/comment/31385028
has answer: http://stackoverflow.com/a/20908186
type: UnansweredQuestion

http://stackoverflow.com/comment/31429267
type: AnswerComment
comment on: http://stackoverflow.com/a/20930587
type: Comment
has text: That's the problem :). Put it after your ` ` tag (preferably just before closing the body), and let me know
score: 0

android-intent
tags question: http://stackoverflow.com/q/20984429
tags question: http://stackoverflow.com/q/20896248
tags question: http://stackoverflow.com/q/20894689
tags question: http://stackoverflow.com/q/20975784
tags question: http://stackoverflow.com/q/20956248
tags question: http://stackoverflow.com/q/20920784
tags question: http://stackoverflow.com/q/20858733
tags question: http://stackoverflow.com/q/20893682
tags question: http://stackoverflow.com/q/20970309
tags question: http://stackoverflow.com/q/20907670
tags question: http://stackoverflow.com/q/20959876
tags question: http://stackoverflow.com/q/20858568
tags question: http://stackoverflow.com/q/20878660
tags question: http://stackoverflow.com/q/21017873
tags question: http://stackoverflow.com/q/20881754
tags question: http://stackoverflow.com/q/20888182
type: Tag
tags question: http://stackoverflow.com/q/21014393
tags question: http://stackoverflow.com/q/20996397
tag name: android-intent
tags question: http://stackoverflow.com/q/20897702
tags question: http://stackoverflow.com/q/20982317
tags question: http://stackoverflow.com/q/20933492
tags question: http://stackoverflow.com/q/20875099
tags question: http://stackoverflow.com/q/20878231

http://stackoverflow.com/comment/31281436
has text: how did you set your CLASSPATH?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20852689
score: 0

http://stackoverflow.com/comment/31463054
score: 0
comment on: http://stackoverflow.com/q/20948995
type: Comment
type: QuestionComment
has text: huh ?? i am kinda lost.. solve what ? please reformat your questions as its hard to understand

http://stackoverflow.com/q/20862199
tagged with: layout
score: 0
has title: RelativeLayout all programmatically not aligning correctly
tagged with: button
has comment: http://stackoverflow.com/comment/31300303
tagged with: textview
has comment: http://stackoverflow.com/comment/31300281
has body: Below is the code and layout it is producing. public void level1() { tList = getTList(level); bList = getBList(level); // textviews RelativeLayout.LayoutParams params00 = new RelativeLayout.LayoutParams(buttonDimension, buttonDimension); gameplayRL.addView(tList[0], params00); RelativeLayout.LayoutParams params11 = new RelativeLayout.LayoutParams(buttonDimension, buttonDimension); params11.addRule(RelativeLayout.RIGHT_OF, tList[0].getId()); gameplayRL.addView(tList[1], params11); RelativeLayout.LayoutParams params22 = new RelativeLayout.LayoutParams(buttonDimension, buttonDimension); params22.addRule(RelativeLayout.BELOW, tList[0].getId()); gameplayRL.addView(tList[2], params22); RelativeLayout.LayoutParams params33 = new RelativeLayout.LayoutParams(buttonDimension, buttonDimension); params33.addRule(RelativeLayout.RIGHT_OF, tList[2].getId()); params33.addRule(RelativeLayout.BELOW, tList[0].getId()); gameplayRL.addView(tList[3], params33); // buttons RelativeLayout.LayoutParams params1 = new RelativeLayout.LayoutParams(buttonDimension, buttonDimension); gameplayRL.addView(bList[0], params1); RelativeLayout.LayoutParams params2 = new RelativeLayout.LayoutParams(buttonDimension, buttonDimension); params2.addRule(RelativeLayout.RIGHT_OF, bList[0].getId()); gameplayRL.addView(bList[1], params2); RelativeLayout.LayoutParams params3 = new RelativeLayout.LayoutParams(buttonDimension, buttonDimension); params3.addRule(RelativeLayout.BELOW, bList[0].getId()); //params3.addRule(RelativeLayout.RIGHT_OF, bList[0].getId()); // this is the problem line gameplayRL.addView(bList[2], params3); } Notice the line 3 from the bottom that is commented out. The button that is labeled "3", I want to be underneath the "2". When I uncomment that line of code, the below layout happens. I would think by uncommenting that line, it would just align that button over to the right but it screws the whole layout out of wack. How can I achieve what I am looking for? EDIT Even using this code: Relativ…
has comment: http://stackoverflow.com/comment/31301001
type: UnansweredQuestion
tagged with: android
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31300613
type: Question

http://stackoverflow.com/q/20965712
has answer: http://stackoverflow.com/a/20965904
has comment: http://stackoverflow.com/comment/31495273
has comment: http://stackoverflow.com/comment/31495319
favorite count: 0
has comment: http://stackoverflow.com/comment/31495244
has body: Could you please tell me which approach is better in below two code blocks? catch (MyException e) { throw new MyException ("Error processing request", e); } Or catch (MyException e) { throw e; }
type: Question
has comment: http://stackoverflow.com/comment/31495234
has answer: http://stackoverflow.com/a/20966039
tagged with: exception
has answer: http://stackoverflow.com/a/20965766
has answer: http://stackoverflow.com/a/20965784
has title: Catching exception and throwing the same?
possible better answer: http://stackoverflow.com/a/20965827
has answer: http://stackoverflow.com/a/20965827
upvote count: 3
tagged with: java
answer count: 7
has answer: http://stackoverflow.com/a/20965786
accepted answer: http://stackoverflow.com/a/20965784
has answer: http://stackoverflow.com/a/78982019
has comment: http://stackoverflow.com/comment/31495236
type: AnsweredQuestion
score: 3
downvote count: 0

http://stackoverflow.com/a/20872263
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/20872223
has body: They're similar but not the same. In particular, names are also used for access control in Java (where the default access makes a member available within the same package). That's not the case in .NET - namespaces don't come into accessibility at all in .NET. Additionally, the way you import types can differ between C# and Java: in Java you can import individual classes, whereas in C# the common using directive imports a whole namespace. On the other hand, C# using directives can also specify aliases, which Java doesn't support. Both packages and namespaces are ways of grouping related types, so to that extent they're the same... but they differ in the details.
answers question: http://stackoverflow.com/q/20872223
upvote count: 12
downvote count: 0
score: 12

http://stackoverflow.com/q/20971198
tagged with: java
has title: Calling Https Url
answer count: 1
downvote count: 0
tagged with: url
tagged with: tomcat
tagged with: jvm
has answer: http://stackoverflow.com/a/20971247
favorite count: 0
has body: I have written web service and hosted project on server with SSL certificate.If I want to call HTTPS url, I need to import certificate in JVM manually or through program on client side. I can't ask any client to do extra work on his side before calling my https url, I would loose my credibility. If any one knows how to deal with this, please help me on this.
type: UnansweredQuestion
upvote count: 1
tagged with: https
type: Question
score: 1

http://stackoverflow.com/q/20974960
answer count: 1
has comment: http://stackoverflow.com/comment/31538144
tagged with: security
score: 0
has answer: http://stackoverflow.com/a/21019235
type: Question
tagged with: c#
type: AnsweredQuestion
tagged with: java
has body: We wrote a c# server app that muliple clients use a couple of years ago. Some use C++ and others use c# and others use python (They can all connect). A client is trying to use Java and just can't seem to get it to work. The issue is the PublicKey representation. In c# I don't send the raw byte [] publicKey, I convert it to a blob using RSACryptoServiceProvider.ExportCspBlob(). So in the server app I simply use rsaCSP.ImportCspBlob(publicKeyBlob); QUESTION How can I use Java to create a RSACryptoServiceProvider.ExportCspBlob() byte[] representation of the publicKey C# SERVER CODE public static bool VerifySignature(byte[] hash, byte[] signature, byte[] publicKeyBlob) { RSACryptoServiceProvider rsaCSP = new RSACryptoServiceProvider(); try { rsaCSP.ImportCspBlob(publicKeyBlob); bool res = rsaCSP.VerifyHash(hash, CryptoConfig.MapNameToOID("SHA1"), signature); return res; } catch { return false; } finally { if (rsaCSP != null) rsaCSP = null; } } C# Client Code for public key that works public static byte[] getPublicKeyBlob() { RSACryptoServiceProvider rsaCspPublic = (RSACryptoServiceProvider)getCertificate() .PublicKey.Key; return rsaCspPublic.ExportCspBlob(false); } Java Client Code - In Progress (Currently gets the raw byte [] public key public static byte[] getPublicKeyBlob(){ try { byte[] ba = keystore.getCertificate("le-f0b649ee-4e25-4973-a185-efd5bd587c54") .getPublicKey().getEncoded(); return ba; }catch(Exception e){ } return null; } If anyone can assist me it would be greatly appreciated.
has comment: http://stackoverflow.com/comment/31542274
has title: What is the Java equilant of this C# method RSACryptoServiceProvider.ExportCspBlob()
linked to: http://stackoverflow.com/q/18089923
has comment: http://stackoverflow.com/comment/31512512
accepted answer: http://stackoverflow.com/a/21019235

http://stackoverflow.com/a/20971915
upvote count: 2
has comment: http://stackoverflow.com/comment/31514626
has body: Your simple use of WebAppContext means that your webapp content is being expanded / copied / moved / managed in the various servlet temp directories. Your project's *.jsp and *.js and *.css are not live. The way other tooling (like jetty-maven-plugin) accomplishes this is to restart the webapp when a file change is detected. Example (pseudo-code): String webroot = getWarRootPath(); WebAppContext webapp = new WebAppContext(webroot, "/"); server.setHandler(webapp); scanner.setMonitorDirectory(webroot); scanner.addListener(this); ... public void onScannerEvent(ScannerEvent evt) { if(!evt.path.isFile()) { return; // no point restarting on directory only event } webapp.stop(); if(evt.isNew() || evt.wasDeleted()) { reconfigureScanner(); } webapp.start(); } If you have Java 7 in use, you can look into its java.nio.file.Watch* facilities for this, or you can use the org.eclipse.jetty.util.Scanner (legacy code) to accomplish the same end goal.
has comment: http://stackoverflow.com/comment/31524036
downvote count: 0
answers question: http://stackoverflow.com/q/20964126
type: Answer
score: 2

http://stackoverflow.com/comment/31569025
type: QuestionComment
has text: `if (foo[i] != 0.0)` is perfectly fine, given your criteria.
type: Comment
comment on: http://stackoverflow.com/q/21005444
score: 4

http://stackoverflow.com/a/20890640
score: 2
downvote count: 0
has body: Yes, there is a race condition. Say i = array.length - 2, and two threads enter circularIncrementAndGet(): Thread 1: i.compareAndSet(array.length - 1, -1) results in i = array.length - 2 Thread 2: i.compareAndSet(array.length - 1, -1) results in i = array.length - 2 Thread 1: i.incrementAndGet() results in i = array.length - 1 Thread 2: i.incrementAndGet() results in i = array.length leading to an ArrayIndexOutOfBoundsException when Thread 2 reaches array[idx] = value (and on all subsequent calls to add() until i overflows). The solution proposed by @Peter Lawrey does not suffer from this problem.
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/20890554

http://stackoverflow.com/comment/31475436
comment on: http://stackoverflow.com/q/20955398
score: 0
type: Comment
has text: Did you mean _to pass_? Also, no it is not.
type: QuestionComment

http://stackoverflow.com/a/20977082
has body: I have noticed a couple of problems with the above code, although it is difficult to tell why you are taking the approach that you are to the solution. The main thing I noticed is that your replace statements do NOT remove the \n characters teHerkennenTemplate = teHerkennenTemplate.replace(templateGescheiden, "\n"); uitvoer = uitvoer.replace(templateGescheiden, "\n"); From Java Documentation: replace(char oldChar, char newChar): Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar. So, you are replacing your string templateGescheiden with \n each time you loop. Another issue would be the improper shortening of your teHerkennenTemplate string each loop, which is causing it not to terminate correctly. It will always shorten from the next space character to the end of the string (inclusive) - meaning it will never be an empty string, but will always have a " ". My advice would be to debug and go step-by-step to see where the shortening and string manipulation is not doing what you want, then evaluate why and modify the code appropriately
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20975936

http://stackoverflow.com/comment/31498339
comment on: http://stackoverflow.com/q/20967264
score: 0
type: Comment
has text: @Manitoba what should i do for this what is the exact issue? could you please explain this. Thanks a lot for your kindness.
type: QuestionComment

http://stackoverflow.com/a/21014610
has comment: http://stackoverflow.com/comment/31586039
type: Answer
accepted answer of: http://stackoverflow.com/q/21014198
has body: You should wait some time to WebElement appears after login for example the WebElement which contains the user's name. If it doesn't appear you know that the other page or a popups appeared on browser. The RemoteWebDriver has switchTo() method. You can handle popups with this method. Alert alert = driver.switchTo().alert(); driver variable is a RemoteWebDriver like FirefoxDriver and so on, you navigate an alert window in the above example. I share you an example code how it should work step by step: public void login(){ String url="URL" driver.get(url); WebElement username= driver.findElement(By.name("username")); WebElement password= driver.findElement(By.name("password")); WebElement loginButton= driver.findElement(By.name("login_button_id")); Boolean isLogged=isSuccessFullyLogged(username,password,loginButton) if(!isLogged){ //we need verification } } public boolean isLoggedSuccessfully(WebElement usr,WebElement psswd,WebElement button){ if(usr!= null &amp;&amp; psswd != null &amp;&amp; button != null){ usr.sendKeys("Blala"); psswd.sendKeys("Blalaspasswd"); button.submit(); //We wait 10 sec to Welcome page appears on screen if it does not appear then we need verification return (new WebDriverWait(driver, 10)).until(new ExpectedCondition&lt;Boolean&gt;() { public Boolean apply(WebDriver d) { return d.getTitle().toLowerCase().startsWith("welcome!"); }); } } I hope this chunk of code helps you.
answers question: http://stackoverflow.com/q/21014198
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/20884418
has comment: http://stackoverflow.com/comment/31341138
upvote count: 3
has answer: http://stackoverflow.com/a/20884542
tagged with: java
has comment: http://stackoverflow.com/comment/31340787
has comment: http://stackoverflow.com/comment/31340868
has comment: http://stackoverflow.com/comment/31341124
linked to: http://stackoverflow.com/q/4477082
type: Question
score: 3
has title: Can i implement my own JPA?
has comment: http://stackoverflow.com/comment/31340767
tagged with: eclipse
has body: I'm new to JPA, and i understands that JPA is an interface that Hibernate and eclipse link are implementing.. can i implement it myself? or use JPA without Hibernate or eclipse link ? all the tutorials and examples I've seen regards one of the implementations, but as for this answer: What is a JPA implementation? If you want your application to be portable, use only JPA. how can I use only JPA ? do someone know for such a tutorial to write my own PersistenceProvider(i thinks that's what i need to do..) Thank you.
answer count: 2
tagged with: jpa
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20884494

http://stackoverflow.com/q/20904191
type: Question
tagged with: pdfbox
answer count: 3
tagged with: http://stackoverflow.com/tag/pdf
linked to: http://stackoverflow.com/q/55596092
has answer: http://stackoverflow.com/a/47222794
downvote count: 0
favorite count: 0
has body: How can I find(in mm) the width and the height of a pdf page using PDFBox? Currently, I'm using this: System.out.println(page.getMediaBox().getHeight()); System.out.println(page.getMediaBox().getWidth()); but the result is(not in mm): 842.0 595.22
has answer: http://stackoverflow.com/a/20905166
has answer: http://stackoverflow.com/a/20905490
type: AnsweredQuestion
score: 41
accepted answer: http://stackoverflow.com/a/20905166
has title: PDFBox - find page dimensions
possible better answer: http://stackoverflow.com/a/20905490
upvote count: 41
tagged with: java

http://stackoverflow.com/comment/31353242
comment on: http://stackoverflow.com/a/20890837
score: 0
type: AnswerComment
type: Comment
has text: I think the question is asking more so if, putting stuff on the stream with no listeners has any downside

http://stackoverflow.com/comment/31588908
comment on: http://stackoverflow.com/q/21016523
has text: Why not `array.addAll()`?
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/q/20951576
has comment: http://stackoverflow.com/comment/31468307
has comment: http://stackoverflow.com/comment/31468225
has comment: http://stackoverflow.com/comment/31468146
has comment: http://stackoverflow.com/comment/31468451
has comment: http://stackoverflow.com/comment/31468118
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31468488
has title: Is there any method to store conditional statement in java?
tagged with: conditional-statements
tagged with: if-statement
has answer: http://stackoverflow.com/a/20951685
possible better answer: http://stackoverflow.com/a/20951705
has body: I wanted to know if there is any method to store if else condition in java? What I mean is like having a variable to represent the condition. This is my original code private OnClickListener click2 = new OnClickListener() { @Override public void onClick(View v) { tv1.setText(""); List&lt;Integer&gt; mClickedButtonIds = new ArrayList&lt;Integer&gt;(); int[] mDesiredOrder = new int[] { ans1.getId(), ans2.getId(), ans3.getId(), ans4.getId(), ans5.getId() }; mClickedButtonIds.add(v.getId()); if (mClickedButtonIds.size() &gt;= mDesiredOrder.length ) { if (mClickedButtonIds.get(0) == mDesiredOrder[0] &amp;&amp; mClickedButtonIds.get(1) == mDesiredOrder[1] &amp;&amp; mClickedButtonIds.get(2) == mDesiredOrder[2] &amp;&amp; mClickedButtonIds.get(3) == mDesiredOrder[3] &amp;&amp; mClickedButtonIds.get(4) == mDesiredOrder[4] ) { tv1.setText("Correct!"); } else { tv1.setText("Try Again!"); } mClickedButtonIds.clear(); } } }; I plan to change it to something like this private OnClickListener click2 = new OnClickListener() { @Override public void onClick(View v) { tv1.setText(""); List&lt;Integer&gt; mClickedButtonIds = new ArrayList&lt;Integer&gt;(); int[] mDesiredOrder = new int[] { ans1.getId(), ans2.getId(), ans3.getId(), ans4.getId(), ans5.getId(), ans6.getId() }; switch (main) { case 4 : Variable x = mClickedButtonIds.get(0) == mDesiredOrder[0] &amp;&amp; mClickedButtonIds.get(1) == mDesiredOrder[1] &amp;&amp; mClickedButtonIds.get(2) == mDesiredOrder[2] &amp;&amp; mClickedButtonIds.get(3) == mDesiredOrder[3]; case 5 : Variable x = mClickedButtonIds.get(0) == mDesiredOrder[0] &amp;&amp; mClickedButtonIds.get(1) == mDesiredOrder[1] &amp;&amp; mClickedButtonIds.get(2) == mDesiredOrder[2] &amp;&amp; mClickedButtonIds.get(3) == mDesiredOrder[3] &amp;&amp; mClickedButtonIds.get(4) == mDesiredOrder[4]; case 6: Variable x = mClickedButtonIds.get(0) == mDesiredOrder[0] &amp;&amp; mClickedButtonIds.get(1) == mDesiredOrder[1] &amp;&amp; mClickedButtonIds.get(2) == mDesiredOrder[2] &a…
has answer: http://stackoverflow.com/a/20951705
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31468109
has comment: http://stackoverflow.com/comment/31468183
accepted answer: http://stackoverflow.com/a/20951685
type: Question
has comment: http://stackoverflow.com/comment/31468182
has comment: http://stackoverflow.com/comment/31468111
answer count: 2
tagged with: android

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

http://stackoverflow.com/q/20893802
type: Question
has body: If I want to check every char in a String using String.charAt(int i), would it count from start every time or it is converted to an array automatically and get the charAt index directly? Would it be more efficient if I create a char array by String.toCharArray() and then go through the array by index? Can I check this up in JavaDoc? Where?
has answer: http://stackoverflow.com/a/20893852
upvote count: 14
has comment: http://stackoverflow.com/comment/31359286
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/31359292
tagged with: java
accepted answer: http://stackoverflow.com/a/20893852
has comment: http://stackoverflow.com/comment/31428537
tagged with: javadoc
score: 13
linked to: http://stackoverflow.com/q/13202051
type: AnsweredQuestion
tagged with: time-complexity
tagged with: string
favorite count: 0
has title: How String.charAt(int i) is implemented in Java?

http://stackoverflow.com/comment/31373802
has text: I wan't to convert this string back to json object.Give me the code for that.
type: Comment
comment on: http://stackoverflow.com/a/20902094
type: AnswerComment
score: 0

http://stackoverflow.com/q/20910755
tagged with: jms
tagged with: listener
has body: I have a JMS queue configured in a Weblogic server. Messages will be sent to this queue from an external service. I want to know : 1) If I can consume this message by setting up a message listener in a stand alone java program ? 2) Is it mandatory that all JMS queue messages should be consumed by a MDB listener set up in an application server
downvote count: 0
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
tagged with: message-queue
has title: JMS queue listeners in a stand alone java program
upvote count: 1
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/20912836
accepted answer: http://stackoverflow.com/a/20912836

http://stackoverflow.com/comment/31440654
type: Comment
type: QuestionComment
score: 0
has text: possible duplicate of [Limit text length of EditText in Android](http://stackoverflow.com/questions/3285412/limit-text-length-of-edittext-in-android)
comment on: http://stackoverflow.com/q/20936673

http://stackoverflow.com/comment/31438953
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20921952
has text: Thanks Sanket, I fixed it. turns out my code in the bindview was the issue, the newView gets called the first and only once so i found a way to save the Model using the List Items's setTag() Method so processing only happens once and i could easily get back the object on the bindView Method.
score: 0

http://stackoverflow.com/comment/31373389
comment on: http://stackoverflow.com/a/20885983
type: AnswerComment
type: Comment
score: 0
has text: Did you forget the injection part? Just adding an instance variable without assigning it won't fix this.

thread-safety
tags question: http://stackoverflow.com/q/20999625
tags question: http://stackoverflow.com/q/20876838
tags question: http://stackoverflow.com/q/20966388
tags question: http://stackoverflow.com/q/20859113
tags question: http://stackoverflow.com/q/20951312
tags question: http://stackoverflow.com/q/20944223
tags question: http://stackoverflow.com/q/20953617
tags question: http://stackoverflow.com/q/20914415
tag name: thread-safety
tags question: http://stackoverflow.com/q/20891176
type: Tag

http://stackoverflow.com/q/20968540
has comment: http://stackoverflow.com/comment/31506959
has comment: http://stackoverflow.com/comment/31544550
tagged with: web-services
has title: code 400 error on post call with android
has comment: http://stackoverflow.com/comment/31720302
tagged with: java
has comment: http://stackoverflow.com/comment/31501711
has comment: http://stackoverflow.com/comment/31554917
tagged with: post
type: Question
has comment: http://stackoverflow.com/comment/31500334
has comment: http://stackoverflow.com/comment/31553458
answer count: 1
has answer: http://stackoverflow.com/a/20973552
linked to: http://stackoverflow.com/q/3146329
has comment: http://stackoverflow.com/comment/31501498
score: 0
tagged with: android
has body: I am trying to call a WS method from an Android application with POST method. What I have done: String urlServer = GlobalSession.IP + "insert_reportByte"; Log.d("[Report]", "url address: " + urlServer); URL url = new URL(urlServer); HttpURLConnection connection = (HttpURLConnection) url .openConnection(); connection.setDoInput(true); connection.setDoOutput(true); connection.setUseCaches(false); connection.setRequestMethod("POST"); connection.setRequestProperty("Connection", "Keep-Alive"); connection.setRequestProperty("Content-Type", "multipart/form-data"); DataOutputStream outputStream = new DataOutputStream( connection.getOutputStream()); outputStream.write(outputByteArray, 0, outputByteArray.length); int serverResponseCode = connection.getResponseCode(); String serverResponseMessage = connection.getResponseMessage(); Log.d("ServerCode", "" + serverResponseCode); Log.d("serverResponseMessage", "" + serverResponseMessage); outputStream.flush(); outputStream.close(); } catch (Exception ex) { // ex.printStackTrace(); Log.e("[Report] --- /!\\ Error: ", ex.getMessage()); } return result; So I am supposed to send a byte array to the service. But I have a 400 error response. My question is: how to get the details of such an issue? Because I cannot find anything in the logs of the server and it's hard to debug if I do not have the details... The WS is defined (in ASP.NET) that way: [OperationContract] [WebInvoke(Method = "POST", UriTemplate = "insert_reportByte", BodyStyle = WebMessageBodyStyle.Bare)] void insert_reportByte(byte[] image); And the called method is the following public void insert_reportByte(byte[] image) { MyEntities entities = new MyEntities(); String base64stringimage = System.Convert.ToBase64String(image,0,image.Length); entities.insert_report("admin", "0614141.107346.2001", "test", base64stringimage, "test"); } What did I do wrong? Thank you !
type: UnansweredQuestion

http://stackoverflow.com/comment/31423291
comment on: http://stackoverflow.com/q/20927207
type: Comment
type: QuestionComment
has text: Are you actually setting environment properties named `OPENSHIFT_MYSQL_DB_HOST`?
score: 0

http://stackoverflow.com/comment/31552879
type: Comment
score: 0
type: AnswerComment
has text: As simple as that... =) thank you! Another problem that took me hours to solve was an "CannotLoadBeanClassException" after refactoring my project with maven resource filters was caused by using maven 3.11 instead of 3.05...
comment on: http://stackoverflow.com/a/20977759

http://stackoverflow.com/a/21181850
has comment: http://stackoverflow.com/comment/31929534
type: Answer
has body: getSystemService() is a method of android.content.Context. I think you get "context is not a valid object" because it is an abstract class which cannot be instantiated this way. The same for android.app.Service. "figured out is that "getSystemService(Context.BLUETOOTH_SERVICE)" seems to be called out of nowhere" - in your sample from developer.android.com it is called on this, which is likely a class derived from Activity and, as a result, Context. You need a context object to call getSystemService(). In addition, you seem to be calling object method with wrong signature: "(Ljava/lang/String;)Ljava/lang/Object;"
score: 0
answers question: http://stackoverflow.com/q/20875359

http://stackoverflow.com/comment/31388275
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20906034
has text: See trashgod's answer. It is still safe.
type: AnswerComment

http://stackoverflow.com/a/20933658
has comment: http://stackoverflow.com/comment/31434308
has comment: http://stackoverflow.com/comment/31434362
has comment: http://stackoverflow.com/comment/31456201
has comment: http://stackoverflow.com/comment/31457452
has comment: http://stackoverflow.com/comment/31451355
upvote count: 6
score: 4
downvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20933583
has comment: http://stackoverflow.com/comment/31434319
answers question: http://stackoverflow.com/q/20933583
type: Answer
has comment: http://stackoverflow.com/comment/31458857
has body: You want this: public class Parent&lt;T extends Parent&lt;T&gt;&gt; { public T foo() { return (T)this; } } public class Child extends Parent&lt;Child&gt; { public void childMethod() { System.out.println("childMethod called"); } } Child child = new Child(); child.foo().childMethod(); // compiles
has comment: http://stackoverflow.com/comment/31434421
has comment: http://stackoverflow.com/comment/31444865

http://stackoverflow.com/q/20892658
type: Question
downvote count: 2
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/20892692
accepted answer: http://stackoverflow.com/a/20892692
favorite count: 0
tagged with: random
has title: How to fill a text area with random numbers
possible better answer: http://stackoverflow.com/a/20892730
has body: I have a Java application and want to press a button to generate a 7 digit random number and put it into a text area. Here is what I have so far: private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { jTextArea1.setText(); } How do I do this?
has answer: http://stackoverflow.com/a/20892730
type: AnsweredQuestion
tagged with: numbers
tagged with: java
score: -1

http://stackoverflow.com/a/20982798
type: Answer
accepted answer of: http://stackoverflow.com/q/20982599
answers question: http://stackoverflow.com/q/20982599
score: 2
downvote count: 0
upvote count: 2
has body: By default, Android applications do not appear compatible with Google TV devices - they require the following line added to their AndroidManifest.xml: &lt;uses-feature android:name="android.hardware.touchscreen" android:required="false"/&gt; So you shouldn't have to do anything to exclude Google TV devices or any other future devices that don't have a touchscreen.
type: AcceptedAnswer

http://stackoverflow.com/comment/31366062
comment on: http://stackoverflow.com/a/20897694
type: AnswerComment
type: Comment
has text: Yes, but the string is being interpreted as a regex pattern. Though I imagine `Pattern.quote` would suffice here.
score: 0

http://stackoverflow.com/comment/31357366
comment on: http://stackoverflow.com/q/20892623
score: 0
has text: if this is a case, is it possible to fix it somehow?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31484008
type: QuestionComment
score: 7
has text: In a word, "no". Whatever you do, someone can undo.
comment on: http://stackoverflow.com/q/20959640
type: Comment

http://stackoverflow.com/comment/31502337
type: QuestionComment
comment on: http://stackoverflow.com/q/20967995
has text: No, they are in agreement as they should be.
score: 0
type: Comment

android
tags question: http://stackoverflow.com/q/20905717
tags question: http://stackoverflow.com/q/20942492
tags question: http://stackoverflow.com/q/20982533
tags question: http://stackoverflow.com/q/20863937
tags question: http://stackoverflow.com/q/21015342
tags question: http://stackoverflow.com/q/20872162
tags question: http://stackoverflow.com/q/20900882
tags question: http://stackoverflow.com/q/21010133
tags question: http://stackoverflow.com/q/20906091
tags question: http://stackoverflow.com/q/20953549
tags question: http://stackoverflow.com/q/20888170
tags question: http://stackoverflow.com/q/20886795
tags question: http://stackoverflow.com/q/20867108
tags question: http://stackoverflow.com/q/20976077
tags question: http://stackoverflow.com/q/20985094
tags question: http://stackoverflow.com/q/20912232
tags question: http://stackoverflow.com/q/20940008
tags question: http://stackoverflow.com/q/20903423
tags question: http://stackoverflow.com/q/21002746
tags question: http://stackoverflow.com/q/20860382
tags question: http://stackoverflow.com/q/20896438
tags question: http://stackoverflow.com/q/20898517
tags question: http://stackoverflow.com/q/20871030
tags question: http://stackoverflow.com/q/21013793
tags question: http://stackoverflow.com/q/20853740
tags question: http://stackoverflow.com/q/20866290
tags question: http://stackoverflow.com/q/20950732
tags question: http://stackoverflow.com/q/20852837
tags question: http://stackoverflow.com/q/21015306
tags question: http://stackoverflow.com/q/20898805
tags question: http://stackoverflow.com/q/20942664
tags question: http://stackoverflow.com/q/20850575
tags question: http://stackoverflow.com/q/20987236
tags question: http://stackoverflow.com/q/20956657
tags question: http://stackoverflow.com/q/21017031
tags question: http://stackoverflow.com/q/20855502
tags question: http://stackoverflow.com/q/20955404
tags question: http://stackoverflow.com/q/20978492
tags question: http://stackoverflow.com/q/20921901
tags question: http://stackoverflow.com/q/20977982
tags question: http://stackoverflow.com/q/21011367
tags question: http://stackoverflow.com/q/20945346
tags question: http://stackoverflow.com/q/20955353
tags question: http://stackoverflow.com/q/20993382
tags question: http://stackoverflow.com/q/20870284
tags question: http://stackoverflow.com/q/20949313
tags question: http://stackoverflow.com/q/20965807
tags question: http://stackoverflow.com/q/20903248
tags question: http://stackoverflow.com/q/20867954
tags question: http://stackoverflow.com/q/20938730
tags question: http://stackoverflow.com/q/20966501
tags question: http://stackoverflow.com/q/21003484
tags question: http://stackoverflow.com/q/20954781
tags question: http://stackoverflow.com/q/20937436
tags question: http://stackoverflow.com/q/20877251
tags question: http://stackoverflow.com/q/20958554
tags question: http://stackoverflow.com/q/20947837
tags question: http://stackoverflow.com/q/20944206
tags question: http://stackoverflow.com/q/20935926
tags question: http://stackoverflow.com/q/20924758
tags question: http://stackoverflow.com/q/20955749
tags question: http://stackoverflow.com/q/20889627
tags question: http://stackoverflow.com/q/20959640
tags question: http://stackoverflow.com/q/20998930
tags question: http://stackoverflow.com/q/20921605
tags question: http://stackoverflow.com/q/20948025
tags question: http://stackoverflow.com/q/20978261
tags question: http://stackoverflow.com/q/20859984
tags question: http://stackoverflow.com/q/20860330
tags question: http://stackoverflow.com/q/20926657
tags question: http://stackoverflow.com/q/21010069
tags question: http://stackoverflow.com/q/20883733
tags question: http://stackoverflow.com/q/21016368
tags question: http://stackoverflow.com/q/20983550
tags question: http://stackoverflow.com/q/20875585
tags question: http://stackoverflow.com/q/20987043
tags question: http://stackoverflow.com/q/20947163
tags question: http://stackoverflow.com/q/20880128
tags question: http://stackoverflow.com/q/20942506
tags question: http://stackoverflow.com/q/20915646

http://stackoverflow.com/comment/31335909
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20874218
type: Comment
has text: i know that topic like i said i googled it and didnt understand it thats why i posted my own quetion based on my problem

http://stackoverflow.com/comment/31383209
comment on: http://stackoverflow.com/a/20905476
type: AnswerComment
has text: The \w metacharacter is used to find a word character http://www.w3schools.com/jsref/jsref_regexp_wordchar.asp
type: Comment
score: 1

http://stackoverflow.com/q/20866251
tagged with: java
has title: Could anyone help me with omniORB?
type: Question
tagged with: omniorb
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/20866277
type: UnansweredQuestion
has body: I am learning omniORB recently, but found very little documentation on the Internet. Could anyone show any documentation of omniORB with Java? It would be appreciated.

http://stackoverflow.com/a/20959087
has body: Late to show with an answer, but I'm afraid a simple case insensitive search isn't necessarily going to do what you want. The keyword you want in your searches is collation (and in a wider sense locales) and PostgreSQL relies on the underlying operating-system to provide support for this. The ordering is rarely a simple character-by-character comparison. For example, in many locales spaces are ignored (that's certainly the case in en_GB). Also, this means you can end up with different sort orders on different platforms (depending on whether Apple or Microsoft agree with Linus as to the default ordering for your country). There has been some discussion as to whether it would make sense to include a BSD-licenced library to provide a consistent set of orderings across platforms. However, this is a lot of work and then means you can end up with different sorting inside your database from the rest of your operating-system. While different providers disagree on how to handle this, there's no one simple solution I'm afraid. You might want to investigate the "C" collation for "traditional" sorting. I'm afraid I can't comment on Java's handling of proper locale sorting - not my field.
has comment: http://stackoverflow.com/comment/31490696
score: 6
downvote count: 1
accepted answer of: http://stackoverflow.com/q/20957596
answers question: http://stackoverflow.com/q/20957596
has comment: http://stackoverflow.com/comment/31489255
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31485567
upvote count: 7
type: Answer

http://stackoverflow.com/a/20961844
answers question: http://stackoverflow.com/q/20961816
type: Answer
upvote count: 1
has body: You cannot put null into an int[]. You must either use an Integer[], or a distinguished "flag value" like -1.
downvote count: 0
score: 1

http://stackoverflow.com/comment/31586323
has text: +1 Nice answer. I provided a similar answer, but with random invocations. I would appreciate if you validate it.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21014673
type: Comment

http://stackoverflow.com/a/44270420
score: 8
upvote count: 8
answers question: http://stackoverflow.com/q/20962053
has body: If you don't want to add a jaxb.properties file, you can do this all in Java code. This is especially helpful for legacy systems where you don't want to risk affecting the classpath by introducing a new jaxb.properties file. import org.eclipse.persistence.jaxb.JAXBContextFactory; import org.eclipse.persistence.jaxb.JAXBContextProperties; import org.eclipse.persistence.jaxb.xmlmodel.ObjectFactory; //Set the various properties you want Map&lt;String, Object&gt; properties = new HashMap&lt;&gt;(); properties.put(JAXBContextProperties.MEDIA_TYPE, "application/json"); properties.put(JAXBContextProperties.JSON_INCLUDE_ROOT, false); //Create a Context using the properties JAXBContext jaxbContext = JAXBContextFactory.createContext(new Class[] { MyClass.class, ObjectFactory.class}, properties); Marshaller jaxbMarshaller = jaxbContext.createMarshaller(); //Marshall the object StringWriter stringWriter = new StringWriter(); jaxbMarshaller.marshal(myObject, stringWriter); String json = stringWriter.toString();
downvote count: 0
type: Answer

http://stackoverflow.com/q/20988304
has comment: http://stackoverflow.com/comment/31538115
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/20989760
type: Question
tagged with: for-loop
has comment: http://stackoverflow.com/comment/31537999
tagged with: runtime
accepted answer: http://stackoverflow.com/a/20989760
has body: I am working on the same task.I am pasting mycode. Its show runtime error when i am trying to run for large input like 1 billion (i.e. k=10^9). Could you please help me with this? import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Hashtable; import java.util.StringTokenizer; /* Name of the class has to be "Main" only if the class is public. */ class Ideone { static Long counter = (long)0; public static void main (String[] args) throws java.lang.Exception { BufferedReader ob1= new BufferedReader(new InputStreamReader(System.in)); int user_choice= Integer.parseInt(ob1.readLine()); int flag=0; while(user_choice!=0) { user_choice--; StringTokenizer obj; Long n,k; obj=new StringTokenizer(ob1.readLine()); n=Long.parseLong(obj.nextToken()); k=Long.parseLong(obj.nextToken()); Hashtable&lt;Long, Long&gt; hash= new Hashtable&lt;Long, Long&gt;(); while(n!=0) { StringTokenizer obj1; Long start,comp; Long finish; obj1=new StringTokenizer(ob1.readLine()); start=Long.parseLong(obj1.nextToken()); finish=Long.parseLong(obj1.nextToken()); comp=Long.parseLong(obj1.nextToken()); if(flag==0) { for(int i=1;i&lt;=k;i++) { hash.put((long)i,(long)0); } } Long finish1; finish1=hash.get(comp); if(finish1==0) { hash.put(comp,finish); counter++; } else if(finish1&lt;=start) { counter++; hash.put(comp,finish); } n--; flag=1; } flag=0; System.out.println(counter); counter=(long)0; /* for(int i=1;i&lt;=k;i++) System.out.println(hash.get((long)i) +" "+i );*/ } } } Input : 2 3 300000 1 3 1 4 6 2 7 10 3 3 10000000 1 3 1 4 6 2 7 10 3 Output: Runtime error time: 0.09 memory: 380160 signal:-1 3
has comment: http://stackoverflow.com/comment/31537561
answer count: 1
has title: Runtime Error for large Input
tagged with: exception
linked to: http://stackoverflow.com/q/2294268
tagged with: input
has comment: http://stackoverflow.com/comment/31538156
type: AnsweredQuestion

http://stackoverflow.com/q/20944570
downvote count: 0
accepted answer: http://stackoverflow.com/a/20960745
has comment: http://stackoverflow.com/comment/31455970
has comment: http://stackoverflow.com/comment/31459392
answer count: 1
has comment: http://stackoverflow.com/comment/31471877
favorite count: 0
has body: I am working with the Snapchat API to make a Java Client. I am using an endpoint which takes the following parameters from an HTTP POST: { username: snapchat username, timestamp: UNIX timestamp, media_id: random string, type: 0, req_token: request token, data: encrypted data } I have no problem generating the params hash, and I have the data as a File object. In Python I have confirmed that the following works: f = open('encrypted.jpg') params = { ... all params besides data ... } files = { 'data' : f } r = requests.post(path, params, files=files) That Python code gets me a 200. I am using tokens and data/files generated by Java code, so the data sent is identical. In Java I am doing the following with UniRest: Map&lt;String, Object&gt; params = ... same params ...; File f = new File('encrypted.jpg'); HttpRequestWithBody req = Unirest.post(path); req.fields(params); req.field("data", f); HttpResponse&lt;String&gt; resp = req.asString(); However this gives me a 500 response from the server. How can I write Java that emulates the Python exactly? Or how can I snoop my own network traffic to see the difference in what the code for each is doing? Seems crazy to me that one works and the other does not.
upvote count: 2
has title: Translate Python requests code to Java (UniRest)
tagged with: python
tagged with: http
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20960745
tagged with: java
tagged with: unirest
has comment: http://stackoverflow.com/comment/31455942
tagged with: post
type: Question

http://stackoverflow.com/comment/31472831
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20953905
score: 0
has text: possible duplicate of [Simplest way to print an array in Java](http://stackoverflow.com/questions/409784/simplest-way-to-print-an-array-in-java) Look at the solutions near the bottom (using for loops and for each loops)

http://stackoverflow.com/comment/31465938
score: 2
comment on: http://stackoverflow.com/a/20950251
has text: They are considered bad practice as stated in the Oracle documentation. http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html (see Default Values). Only class fields are initialized to 0, local variables are slightly different; the compiler never assigns a default value to an uninitialized local variable.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31550950
has text: @MenoHochschild I thought/hoped it could be done by using `Class<T>`, where `T` is *some* definition.
comment on: http://stackoverflow.com/q/20996001
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31451875
score: 1
has text: How do you think it should work? We can't see your code, or what you're thinking.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20942518

http://stackoverflow.com/q/20998793
tagged with: wait
has comment: http://stackoverflow.com/comment/31556010
tagged with: notify
has comment: http://stackoverflow.com/comment/31556604
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/20999005
favorite count: 0
has body: What I'm trying to do here is to upload files one by one. For example, if my file list contains 2 files ready to upload, I want to upload the second file once the first is uploaded and created. Actually, I loop the file list and upload the file from each iteration whitout waiting the last upload to finish. Here is an idea of what I'm excepecting : for(FileContainerBean fileContainer:fileContainerList){ FileUpload fileUpload=new FileUpload(fileContainer.getFile()); Thread th=new Thread(fileUpload); th.start(); //Now i want here to wait beafore moving to the next iteration while(!fileContainer.isCreated(){ wait(); } if(fileContainer.isCreated(){ notify(); } } fileContainer is a bean with getters and setters (setFile,getFile,isCreated....). When the upload is over and the file is created ( HttpResponseCode=201), fileContainer.isCreated=true. Initially, isCreated=false; I hope that I'm clear enough ! So is it possible to do that ? Thanks in advance ! Ismail
has answer: http://stackoverflow.com/a/20998847
type: AnsweredQuestion
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/20998959
tagged with: java
has comment: http://stackoverflow.com/comment/31556562
tagged with: loops
possible better answer: http://stackoverflow.com/a/20998847
type: Question
accepted answer: http://stackoverflow.com/a/20998959
tagged with: for-loop
has title: wait() before next iteration in a for loop java

http://stackoverflow.com/q/21000110
downvote count: 0
favorite count: 0
has title: Spring Data Exception Handling
score: 11
tagged with: spring
has comment: http://stackoverflow.com/comment/31558577
upvote count: 11
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21024445
tagged with: java
has comment: http://stackoverflow.com/comment/31559025
tagged with: spring-data
has answer: http://stackoverflow.com/a/21024445
type: Question
has body: I´m working on a project using Spring Data-JPA. I need to handle some exceptions in JpaRepository method calls. In the code bellow, I need to intercept primary key violations erros but I cannot catch the exception directly. In my case, when an exception of this kind occurs, the UnexpectedRollbackException exception is thrown by repository layer (JpaRepository). I need to search inside this exception object to determine what is the cause of the problem. I am wondering if there is a more "elegant" way to achieve this. public Phone insert(Phone phone) throws BusinessException { Phone result = null; try{ result = phoneRepository.save(phone); } catch(UnexpectedRollbackException ex){ if((ex.getCause() != null &amp;&amp; ex.getCause() instanceof RollbackException) &amp;&amp; (ex.getCause().getCause() != null &amp;&amp; ex.getCause().getCause() instanceof PersistenceException) &amp;&amp; (ex.getCause().getCause().getCause() != null &amp;&amp; ex.getCause().getCause().getCause() instanceof ConstraintViolationException)){ throw new BusinessException("constraint violation", ex); } } catch(Exception ex){ throw new OuvidorNegocioException("unknown error", ex); } return result; } Thanks! UPDATE: The code bellow seems to be much better. public Phone insert(Phone phone) throws BusinessException { Phone result = null; try{ result = phoneRepository.save(phone); } catch(UnexpectedRollbackException ex){ if(ex.getMostSpecificCause() instanceof SQLIntegrityConstraintViolationException){ throw new BusinessException("constraint violation", ex); } } catch(Exception ex){ throw new OuvidorNegocioException("unknown error", ex); } return result; }
has answer: http://stackoverflow.com/a/21000326
accepted answer: http://stackoverflow.com/a/21000326
tagged with: spring-data-jpa
answer count: 2

http://stackoverflow.com/q/20969428
tagged with: hardware
has answer: http://stackoverflow.com/a/20969543
type: UnansweredQuestion
has body: I have 2 xml pages, from the main page after clicking the next button it goes to the second page, but when I press on the hardware back button. It does not goes back to the main page. How do I add the code for the hardware back button? Testing on Android 4.3. &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=".MainActivity" &gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Main Page" /&gt; &lt;Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView1" android:layout_below="@+id/textView1" android:text="Go to Page 1" /&gt; &lt;/RelativeLayout&gt; java class : package com.example.linktestfyp; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button button1 = (Button) findViewById(R.id.button1); button1.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent myIntent = new Intent(); myIntent.setAction(Intent.ACTION_VIEW); myIntent.setData(android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI); setContentView(R.layout.main1); Toast.makeText(getApplicationContext(), "Button 1 clicked", Toast.LENGTH_LONG).show(); } }); } }
has answer: http://stackoverflow.com/a/20969545
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/31501932
score: 0
has answer: http://stackoverflow.com/a/20969619
tagged with: android
has title: Hardware back button does not bring me back to previous page
has answer: http://stackoverflow.com/a/20969659
has comment: http://stackoverflow.com/comment/31501955
answer count: 4
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/31587380
has text: The second approach in my post should answer your query.
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21015564

web-services
tags question: http://stackoverflow.com/q/20867549
type: Tag
tags question: http://stackoverflow.com/q/20891073
tags question: http://stackoverflow.com/q/20991866
tags question: http://stackoverflow.com/q/20904562
tags question: http://stackoverflow.com/q/20966426
tags question: http://stackoverflow.com/q/20937152
tags question: http://stackoverflow.com/q/20875700
tags question: http://stackoverflow.com/q/20967242
tags question: http://stackoverflow.com/q/20955873
tags question: http://stackoverflow.com/q/20853124
tags question: http://stackoverflow.com/q/20999991
tags question: http://stackoverflow.com/q/20858724
tags question: http://stackoverflow.com/q/20965966
tags question: http://stackoverflow.com/q/20868093
tags question: http://stackoverflow.com/q/20904011
tags question: http://stackoverflow.com/q/20885370
tags question: http://stackoverflow.com/q/20945274
tags question: http://stackoverflow.com/q/20965126
tags question: http://stackoverflow.com/q/20920693
tags question: http://stackoverflow.com/q/20891198
tags question: http://stackoverflow.com/q/20991576
tags question: http://stackoverflow.com/q/20887921
tags question: http://stackoverflow.com/q/20983348
tags question: http://stackoverflow.com/q/20948507
tags question: http://stackoverflow.com/q/20899917
tags question: http://stackoverflow.com/q/20951025
tags question: http://stackoverflow.com/q/20882120
tags question: http://stackoverflow.com/q/20953284
tags question: http://stackoverflow.com/q/20995472
tags question: http://stackoverflow.com/q/21003745
tags question: http://stackoverflow.com/q/20899520
tags question: http://stackoverflow.com/q/20961089
tags question: http://stackoverflow.com/q/20902546
tags question: http://stackoverflow.com/q/20989792
tags question: http://stackoverflow.com/q/21017782
tags question: http://stackoverflow.com/q/20968540
tags question: http://stackoverflow.com/q/20958692
tags question: http://stackoverflow.com/q/21000685
tags question: http://stackoverflow.com/q/20858159
tags question: http://stackoverflow.com/q/21003696
tags question: http://stackoverflow.com/q/20856920
tag name: web-services
tags question: http://stackoverflow.com/q/20993503
tags question: http://stackoverflow.com/q/20852837
tags question: http://stackoverflow.com/q/20856880
tags question: http://stackoverflow.com/q/20966046
tags question: http://stackoverflow.com/q/20943231
tags question: http://stackoverflow.com/q/20967299
tags question: http://stackoverflow.com/q/20905926
tags question: http://stackoverflow.com/q/20982711
tags question: http://stackoverflow.com/q/20883021
tags question: http://stackoverflow.com/q/21003461
tags question: http://stackoverflow.com/q/20897094
tags question: http://stackoverflow.com/q/20885825

http://stackoverflow.com/q/21005205
has answer: http://stackoverflow.com/a/21005398
has comment: http://stackoverflow.com/comment/31568709
answer count: 3
linked to: http://stackoverflow.com/q/28259009
favorite count: 0
has title: what causes "constant expression required" errors for the generated R.id.xxx values in switch statements?
has answer: http://stackoverflow.com/a/79324298
type: UnansweredQuestion
tagged with: android
score: 34
has answer: http://stackoverflow.com/a/21005410
upvote count: 34
tagged with: java
has comment: http://stackoverflow.com/comment/31568362
tagged with: gradle
type: Question
has body: We've got a multi-project app that we're moving to gradle. The build results in Java compilation errors like: AFragment.java:159: constant expression required case R.id.aBtn: We've confirmed that the constants reported in errors are in the generated R.java. One clue is that errors are only for switch values. For example there's no error using findViewById(R.id.aBtn). also note that the constants are from the main project, not one of the library projects. for anyone looking to get rid of the errors laalto's suggestion will solve it. the link he provided, together with the fact that eclipse doesn't show the errors that occur when building with gradle gave me another clue. the R.java generated by eclipse defines the main project constants as 'final' but the gradle generated values are not 'final'. the real solution must be in correcting the gradle build files. SOLUTION (2014-01-09) our build.gradle for the app was applying the android-library plugin instead of the android plugin. it was this: apply plugin: 'android-library' changing it to this: apply plugin: 'android' fixed the problem.
downvote count: 0

http://stackoverflow.com/a/20955617
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/31476032
has comment: http://stackoverflow.com/comment/31476101
downvote count: 0
has body: Remove this line from setupCommand() - mConversationView = (ListView) findViewById(R.id.in); and it in onCreateView(), like this- mConversationView = (ListView) rootView.findViewById(R.id.in);
score: 1
answers question: http://stackoverflow.com/q/20955526
has comment: http://stackoverflow.com/comment/31476169
accepted answer of: http://stackoverflow.com/q/20955526
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31476047

http://stackoverflow.com/comment/34626961
type: AnswerComment
has text: You're welcome! Glad I could help! When time permits, would you mind accepting my answer if you found it useful? Thanks!
type: Comment
comment on: http://stackoverflow.com/a/22621583
score: 0

http://stackoverflow.com/comment/31287065
type: AnswerComment
type: Comment
has text: I am getting errors at following line import org.apache.commons.net.ftp.FTP.FTPClient; I guess I need to add some jar for this. Can you tell me which jar need to be added in classpath?
comment on: http://stackoverflow.com/a/20855787
score: 0

http://stackoverflow.com/a/20994799
score: 4
has comment: http://stackoverflow.com/comment/31566757
has comment: http://stackoverflow.com/comment/31548647
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20994715
upvote count: 4
has body: You are starting at 0 so you will not get a value larger. If you start like this int lowest = Integer.MAX_VALUE; Also (n % 2) will only be 1 for positive numbers. If you want to test for odd negative numbers you want (n &amp; 1) != 0 Note: Integer.MAX_VALUE is an odd number so even if this is the only value it will be the maximum. However, if you want to be able to tell the difference between some one entering this value and no odd values you can use this instead. long lowest = Long.MAX_VALUE; This will allow you to tell the difference between Integer.MAX_VALUE being entered and no value as Long.MAX_VALUE is much higher.

http://stackoverflow.com/comment/31342865
type: AnswerComment
type: Comment
has text: That is really a separate question that should be asked on a ..separate question. You'll get a better response by asking a more specific GBL based question anyway. For best help be sure to include an [SSCCE](http://sscce.org/) & ASCII art (or a line drawing) of the GUI as it should appear in smallest size and (if resizable) with extra width/height.
comment on: http://stackoverflow.com/a/20877987
score: 2

http://stackoverflow.com/a/20990216
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/31565044
type: AcceptedAnswer
has body: You can declare generic methods in your interface like this: public interface Statement { &lt;T&gt; T executeTStatement(); } But in this way it doesn't make to much sense - you have a method that returns a "something", but when will "something" be defined? So T has to be bound in some way to be of any use: declare it at the Interface-Level and have to bind T when defining your reference (but you didn't want to do that) deduce the type T from some argument to the method: public interface Statement { &lt;T&gt; T executeTStatement(T argument); }
has comment: http://stackoverflow.com/comment/31547885
has comment: http://stackoverflow.com/comment/31567121
type: Answer
has comment: http://stackoverflow.com/comment/31568433
accepted answer of: http://stackoverflow.com/q/20989740
score: 2
answers question: http://stackoverflow.com/q/20989740

http://stackoverflow.com/comment/31428714
comment on: http://stackoverflow.com/q/20930400
type: Comment
type: QuestionComment
score: 1
has text: @smriti3 using intent is a better choice. secodnly using a ViewHolder pattern is good for performance.

http://stackoverflow.com/a/21011709
has comment: http://stackoverflow.com/comment/31581059
has comment: http://stackoverflow.com/comment/31581148
has comment: http://stackoverflow.com/comment/31581530
has comment: http://stackoverflow.com/comment/31580978
has comment: http://stackoverflow.com/comment/31581163
has comment: http://stackoverflow.com/comment/31581430
downvote count: 0
has comment: http://stackoverflow.com/comment/31580711
answers question: http://stackoverflow.com/q/21011609
has comment: http://stackoverflow.com/comment/31580879
has comment: http://stackoverflow.com/comment/31581716
has comment: http://stackoverflow.com/comment/31581259
type: Answer
has comment: http://stackoverflow.com/comment/31581084
has comment: http://stackoverflow.com/comment/31581813
has comment: http://stackoverflow.com/comment/31581905
has comment: http://stackoverflow.com/comment/31581753
has comment: http://stackoverflow.com/comment/31581009
score: 1
upvote count: 1
has body: Place this code:: Just replace then name of layout and button id by your import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.alayout); Button grammerButton = (Button)findViewById(R.id.aId); grammerButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(MainActivity.this, Grammer.class); startActivity(intent); } }); } } Just replace then name of layout and button id by your import android.os.Bundle; import android.app.Activity; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class Grammer extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.blayout); Button grammerButton = (Button) findViewById(R.id.aId); grammerButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { finish(); } }); } }
has comment: http://stackoverflow.com/comment/31580907
has comment: http://stackoverflow.com/comment/31581634
has comment: http://stackoverflow.com/comment/31581235
has comment: http://stackoverflow.com/comment/31581340

http://stackoverflow.com/comment/31476027
type: AnswerComment
comment on: http://stackoverflow.com/a/20950511
has text: thank you, can you provide any link of example of using JacksonJsonProvider.class for unmarshalling JSON Array
type: Comment
score: 0

http://stackoverflow.com/q/20923806
downvote count: 0
has comment: http://stackoverflow.com/comment/31415811
favorite count: 0
has title: How this Java for loop should look like in pseudocode?
has answer: http://stackoverflow.com/a/20923858
has comment: http://stackoverflow.com/comment/31415646
has comment: http://stackoverflow.com/comment/31415530
has answer: http://stackoverflow.com/a/20924014
has answer: http://stackoverflow.com/a/20923959
answer count: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20923858
upvote count: 3
has comment: http://stackoverflow.com/comment/31415436
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20923990
score: 3
has body: How should I proceed to turn this piece of code into pseudocode? ArrayList&lt;Integer&gt; check = new ArrayList&lt;Integer&gt;(); ArrayList&lt;Integer&gt; dup = new ArrayList &lt;Integer&gt; (); ArrayList&lt;Integer&gt; nonDup = new ArrayList &lt;Integer&gt; (); for (int i : listA) { nonDup.add(i); } for (int i : listB) { nonDup.add(i); } for (int i : listA) { check.add(i); } for (int i : listB) { if (check.contains(i)) { dup.add(i); nonDup.removeAll(duplicates); } } I have no idea how to turn the for loops, add(), contains() and removeAll() methods into pseudocode.
has comment: http://stackoverflow.com/comment/31415548
tagged with: pseudocode
possible better answer: http://stackoverflow.com/a/20923990

http://stackoverflow.com/comment/31427638
has text: So it is possible then? I understand that it is not practical, but I was wondering if it was possible.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/20929962
score: 0

http://stackoverflow.com/comment/31423205
score: 0
comment on: http://stackoverflow.com/q/20927649
type: Comment
type: QuestionComment
has text: Use broadcast receiver for notify the complete listener, In player activity, player should be register receiver for pause broadcast.

http://stackoverflow.com/a/21081350
answers question: http://stackoverflow.com/q/20897544
type: AcceptedAnswer
has body: I was using GLJPanel instead of GLCanvas. GLJPanel is lightweight and doesn't support more complex rendering. This was driving me crazy for the longest time.
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/69041055
accepted answer of: http://stackoverflow.com/q/20897544

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

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/20937713
tags question: http://stackoverflow.com/q/20907132
tags question: http://stackoverflow.com/q/20872443
tags question: http://stackoverflow.com/q/20869551
tags question: http://stackoverflow.com/q/20975375
tags question: http://stackoverflow.com/q/20866287
tags question: http://stackoverflow.com/q/20941152
type: Tag
tags question: http://stackoverflow.com/q/20856152
tags question: http://stackoverflow.com/q/20865561
tags question: http://stackoverflow.com/q/20998711
tags question: http://stackoverflow.com/q/20947543
tags question: http://stackoverflow.com/q/20973786
tags question: http://stackoverflow.com/q/20920237
tags question: http://stackoverflow.com/q/20872773
tags question: http://stackoverflow.com/q/20939151
tags question: http://stackoverflow.com/q/20858149
tags question: http://stackoverflow.com/q/21009487
tags question: http://stackoverflow.com/q/20858356
tags question: http://stackoverflow.com/q/20858817
tags question: http://stackoverflow.com/q/20856136
tags question: http://stackoverflow.com/q/21006662
tags question: http://stackoverflow.com/q/21014739
tags question: http://stackoverflow.com/q/20952076

http://stackoverflow.com/a/20958586
answers question: http://stackoverflow.com/q/20958537
has comment: http://stackoverflow.com/comment/31481793
has body: Connection pooling is a "server side thing". It really only makes sense if you pool connections where the database lives, for example, on an application server that might sit between your database and your clients. Q: Do you have an app server, or any kind of middleware? Or are your clients all connecting directly to the database? If the latter, what kind of database? Each vendor has their own extensions that might help.
type: Answer
score: 0

http://stackoverflow.com/a/48182974
answers question: http://stackoverflow.com/q/20965737
downvote count: 0
has body: I came up with another workaround. Enter running docker container for example using this command docker exec -it jboss_1 bash Execute this while in container: cd /usr/local/share/jboss/standalone/configuration/standalone_xml_history/ rm -rf current exit Various jboss versions might have different directories with standalone_xml_history. For example on Jboss 6.4.0 it is /opt/jboss/EAP-6.4.0/domain/configuration/domain_xml_history/
score: 1
upvote count: 1
type: Answer

http://stackoverflow.com/comment/31456327
comment on: http://stackoverflow.com/a/20944619
type: AnswerComment
score: 0
type: Comment
has text: Ok please wait .. first I will check and let you know

http://stackoverflow.com/a/21017921
accepted answer of: http://stackoverflow.com/q/21017873
type: Answer
answers question: http://stackoverflow.com/q/21017873
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/31609753
type: AcceptedAnswer
downvote count: 0
has body: You can clear whole stack using: intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); this is a solution if you want to start new activity, and close all activities that were open before it.

http://stackoverflow.com/comment/31463042
type: Comment
comment on: http://stackoverflow.com/a/20948065
has text: After removal of <security> part the application is blocked by default as it says in the documentation _If the Security Level slider in the Java Control Panel is set to Very High, the Permissions attribute is required. If it is not present, then the RIA is blocked._ Also when I change the <all-permissions /> to <sandbox /> nothing changes.
score: 0
type: AnswerComment

http://stackoverflow.com/a/20873578
answers question: http://stackoverflow.com/q/20873420
has body: Several observations : You have to make both isRunning and canRun volatile to make it work Since your other thread is only checking canRun every 1000 ms, you might still have long delay before processing your second call to mouseDoubleClick on GUI thread. It is generally a very bad idea to make threads do busy-waiting with while(true){/*do nothing*/} loop. You should definitely use wait/notify mechanism instead to sync between threads
has comment: http://stackoverflow.com/comment/31328826
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/31375754
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20873420
has comment: http://stackoverflow.com/comment/31332302
type: Answer

http://stackoverflow.com/q/21001072
has answer: http://stackoverflow.com/a/21001313
has comment: http://stackoverflow.com/comment/31560577
answer count: 4
has comment: http://stackoverflow.com/comment/31560848
score: -1
favorite count: 0
has comment: http://stackoverflow.com/comment/31560473
has comment: http://stackoverflow.com/comment/31560686
upvote count: 2
has comment: http://stackoverflow.com/comment/31560453
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31560777
has comment: http://stackoverflow.com/comment/31560694
has comment: http://stackoverflow.com/comment/31560432
has comment: http://stackoverflow.com/comment/31561158
has comment: http://stackoverflow.com/comment/31560817
has comment: http://stackoverflow.com/comment/31560997
has comment: http://stackoverflow.com/comment/31561088
tagged with: java
has comment: http://stackoverflow.com/comment/31560374
downvote count: 3
has comment: http://stackoverflow.com/comment/31561443
has body: I have this class: public class Attributes { List text = new ArrayList(); List angle = new ArrayList(); public Attributes() { } public int getHowManyNodes() { int howMany = 0; howMany += text.isEmpty() ? 0 : text.size(); howMany += angle.isEmpty() ? 0 : angle.size(); return howMany; } } And when I do: Attributes attributes = new Attributes(); System.out.print(attributes.getHowManyNodes()); It gives Exception in thread "main" java.lang.NullPointerException Weirdly tho, it only gives an error on "angle.isEmpty()" not on "text.isEmpty()" Why does it say it is null when I initialize it with: List angle = new ArrayList(); Edit1: Full error: Exception in thread "main" java.lang.NullPointerException at projectmerger1.Attributes.getHowManyNodes(Attributes.java:55) at projectmerger1.Project.listGameVariables(Project.java:235) at projectmerger1.ProjectMerger1.main(ProjectMerger1.java:289) Java Result: 1 Minor edit: Line 55 in Attributes Class is howMany += angle.isEmpty() ? 0 : angle.size(); Edit2: public class Project { Game game; public void listGameVariables() { System.out.print(game.attributes.getHowManyNodes()); } } public class Game { Attributes attributes = new Attributes(); } This is my whole setup.
has comment: http://stackoverflow.com/comment/31560513
has answer: http://stackoverflow.com/a/21001542
has comment: http://stackoverflow.com/comment/31560487
type: Question
has comment: http://stackoverflow.com/comment/31560786
has comment: http://stackoverflow.com/comment/31560919
has comment: http://stackoverflow.com/comment/31560741
has comment: http://stackoverflow.com/comment/31560756
has comment: http://stackoverflow.com/comment/31560335
has answer: http://stackoverflow.com/a/21001400
has comment: http://stackoverflow.com/comment/31561272
has comment: http://stackoverflow.com/comment/31560583
has title: Having issues with List in Java
has comment: http://stackoverflow.com/comment/31560409
has comment: http://stackoverflow.com/comment/31561036
has comment: http://stackoverflow.com/comment/31560936
has comment: http://stackoverflow.com/comment/31560604
has comment: http://stackoverflow.com/comment/31560339
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/31561159
has comment: http://stackoverflow.com/comment/31561039
has answer: http://stackoverflow.com/a/21001258
has comment: http://stackoverflow.com/comment/31560601

http://stackoverflow.com/a/20941827
upvote count: 1
answers question: http://stackoverflow.com/q/20941772
downvote count: 0
type: Answer
has body: JTextArea textArea = new JTextArea(); // instantiate the JTextArea textArea.append("text"); // append to the existing text on JTextArea textArea.setText("text"); // set the current text with the given one hope this helps :)
score: 1

http://stackoverflow.com/comment/31404264
comment on: http://stackoverflow.com/a/20917621
type: AnswerComment
has text: Funny @Sanjay T. Sharma, that's exactly what we students think! ;)
type: Comment
score: 1

http://stackoverflow.com/a/20990796
score: 1
accepted answer of: http://stackoverflow.com/q/20990644
answers question: http://stackoverflow.com/q/20990644
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: This is rather a basic step towards Java development and it's important! say you have a Java file named: Main.java , open it by your favorite editor: public class Main { public static void main(String[]args) { System.out.println("Rugal"); } } Now just exit your editor and use javac to compile: javac Main.java which will generate a Main.class file. Then you can use java to launch a JVM to execute this main method in class Main. java Main notice that as your class name is Main thus you need to execute the Main class. here you need not to include .class suffix after the class name. If you have package name in this class, just use: java your.package.name.Main to execute. Yes, is that easy? start your journey in Java!
upvote count: 1

http://stackoverflow.com/comment/31559059
score: 0
type: QuestionComment
type: Comment
has text: please format your code
comment on: http://stackoverflow.com/q/20999991

http://stackoverflow.com/q/20934831
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: file
has comment: http://stackoverflow.com/comment/31436563
type: Question
has comment: http://stackoverflow.com/comment/31437959
has answer: http://stackoverflow.com/a/20934847
tagged with: int
has body: How can I use Scanner to read from a .txt with the first value going to a int x, the second value go to int y, third go to int x and go on.. And doing validation. I wrote my code like this but it doesn't read all values: Scanner kb = new Scanner(f); while(kb.hasNextInt()) { k[n] = new Medida(); tmp = kb.nextInt(); if(tmp &gt;= 0 &amp;&amp; tmp &lt;= 100) k[n].hum = tmp; tmp1 = kb.nextInt(); if(tmp1 &gt;= -10 &amp;&amp; tmp1 &lt;= 40) k[n].temp = tmp1; n++; if(n == 31) break; } My file is like this: 12 -> int x 1 -> int y 12 -> int x 3 -> int y 13 -> int x 14 -> int y 11 -> int x
has title: How to read values from a file alternating variables?
tagged with: arrays
answer count: 1
accepted answer: http://stackoverflow.com/a/20934847

http://stackoverflow.com/comment/31451751
score: 0
comment on: http://stackoverflow.com/a/20900010
type: AnswerComment
type: Comment
has text: Nice answer! Good amount of detail there.

http://stackoverflow.com/q/20857658
upvote count: 1
tagged with: testng
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20857998
tagged with: oop
score: 1
tagged with: java
type: Question
answer count: 2
downvote count: 0
has body: There is lot of info on Dynamic dispatch in the internet, I feel like a chicken as I am not able to implement it. Please help me. Here is what I am trying to do. ClassA{ public void createReq(){ } public String postReq(){ } } ClassB{ @Test public void myTest(){ Class A = new ClassA(); a.createReq(); String test = a.getResponse(); /* Not sure how do i do this part */ } So, I get a string 'test' in myTest method. I want to create a ClassC that extends ClassB and write a method that would verify the string returned in myTest soon after the step (a.getResponse()). If there is no ClassC implemented, I would just want to simply end the test. If only ClassC exists and implements a method for verification, I want the verification to be done. How do I do this? Please help. Thanks.
has answer: http://stackoverflow.com/a/20857998
has comment: http://stackoverflow.com/comment/31290277
tagged with: dynamic-data
has comment: http://stackoverflow.com/comment/31290319
favorite count: 0
has title: Dynamic method dispatch
possible better answer: http://stackoverflow.com/a/20857977
has answer: http://stackoverflow.com/a/20857977

http://stackoverflow.com/comment/31506874
score: 2
has text: Can you provide the stack trace and show the line number that it complained on? That is usually very helpful in these situations.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20972176

http://stackoverflow.com/a/20962391
type: Answer
score: 1
answers question: http://stackoverflow.com/q/20962343
upvote count: 1
downvote count: 0
has body: Instead of an anonymous class, you could implement View.OnClickListener in an inner class, instantiate it, and use it for all buttons like this; where handleButton1/2() are methods inside your parent activity. private class MyEventListener implements View.OnClickListener { @Override public void onClick(View view) { switch (view.getId()) { case R.id.button1_id: handleButton1(); break; case R.id.button2_id: handleButton2(); break; } } } Inside main activity onCreate(): OnClickListener mMyEventListener = new MyEventListener(); button1.setOnClickListener(mMyEventListener); button2.setOnClickListener(mMyEventListener); I like this because I can group buttons with similar behavior within the case block, or I can implement multiple interfaces on the same object so all of my UI interaction/callbacks go to one easy to keep track of location, rather than a ton of duplicated code in the form of dozens of anonymous listener classes. For example, I can extend AdapterView.OnItemClickListener if I have a listview and pass mMyEventListener to ListView.setOnItemClick.

http://stackoverflow.com/a/29750756
type: Answer
has body: It happened to me, in a Windows 2012 Server and SQL Server 2012 database in a different server. It seems that sonar service maintains a connection open, created at start up time, so any disconnection (networking, database restart, etc.) causes this unrecoverable connection problem. Restarting the Sonar (SonarQube) Windows service solved the problem to me. But, if this problem is frequent, as in your case, it would be a good idea to schedule a service restart task, or find out what is taking the connection down.
score: 0
answers question: http://stackoverflow.com/q/20884909

http://stackoverflow.com/q/20988575
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/29117394
accepted answer: http://stackoverflow.com/a/21001426
downvote count: 0
has comment: http://stackoverflow.com/comment/31537987
score: 1
has answer: http://stackoverflow.com/a/29117394
tagged with: java
has title: If-Else condition is not working for my test case
tagged with: selenium
has body: I am writing an if-else condition in my test case. But function not going in else condition , it just look for if (condition).I am not able to figure out the problem. Using java with selenium webdriver public static void afterMenthod() throws InterruptedException { try { if (remoteDriver.findElementByName("Confirmation").isDisplayed()) { if (remoteDriver.findElementByName("Stop").isDisplayed()) { remoteDriver.findElementByName("Stop").click(); } else { remoteDriver.findElementByName("Resume").click(); remoteDriver.findElementByName("Navigate up").click(); remoteDriver.findElementByName("Stop").click(); } } else if (remoteDriver.findElementByName("TRY AGAIN").isDisplayed()) { System.out .println("There is some problem in deposit transaction"); remoteDriver.findElementByName("Navigate up").click(); remoteDriver.findElementByName("Stop").click(); remoteDriver.findElementByName("Stop").click(); } else if (remoteDriver.findElementByName("NEXT").isDisplayed() || remoteDriver.findElementByName("SUBMIT").isDisplayed() ) { System.out.println("There is some problem in deposit transaction"); remoteDriver.findElementByName("Navigate up").click(); remoteDriver.findElementByName("Stop").click(); } else { // if(remoteDriver.findElementByName("namaskaar").isDisplayed()) System.out .println("There is some problem in deposit transaction"); } } finally{ GeneralMethods.signout(); System.out.println("Script Over"); }} It just look for "confirmation" element, if it does not find that test get fails.
has comment: http://stackoverflow.com/comment/31587808
type: Question
has comment: http://stackoverflow.com/comment/31537910
has answer: http://stackoverflow.com/a/21001426
has comment: http://stackoverflow.com/comment/31539472
has comment: http://stackoverflow.com/comment/31537990
has comment: http://stackoverflow.com/comment/31607294
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/31568140
favorite count: 0
has comment: http://stackoverflow.com/comment/31537918
has answer: http://stackoverflow.com/a/20989647
tagged with: selenium-webdriver

http://stackoverflow.com/comment/31318427
type: QuestionComment
has text: `but if it's not possible to do so without using other methods` `translates[i].replaceAll` `replaceAll` is a method. This code is wrong? What you want?
score: 0
comment on: http://stackoverflow.com/q/20872034
type: Comment

http://stackoverflow.com/q/20948995
has comment: http://stackoverflow.com/comment/31463145
answer count: 4
has comment: http://stackoverflow.com/comment/31463054
has title: How to print day of the date in java without using inbuilt calendar packages api's
score: 0
tagged with: java
has body: in this program i got all ordinary years day approximately.. example by giving input 1 1 2014 i get output as wednesday.. but not on leap year example by giving input 1 1 2000 i'm get exact answer saturday.. but i get answer for 1 1 2000 is monday.. can anyone solve this... Reference for Day of the date //reference i made this program: http://easycalculation.com/funny/shortcuts/day.php //gd = given date //gm = given month //gy = given year //ym = year modulus (year % 100 to get last two digits) //yp = year process (ym%4 to get remainder) //wd = week days (0 for sunday, 1 for monday and so on...) //d = day calculation (to get remainder from 0 to 6 .. which represents wd[0] //for sunday so on) import java.util.Scanner; class dayof { public static void main(String arg[]) { int gd,gm,gy,ym,yp,d; int[] m=new int[]{0,3,3,6,1,4,6,2,5,0,3,5}; String[] wd=new String[]{"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"}; Scanner ip=new Scanner(System.in); System.out.println("Enter Date Month Year \"DD MM YYYY\""); gd=ip.nextInt(); gm=ip.nextInt(); gy=ip.nextInt(); ym=gy%100; yp=ym%4; d=(gd+m[gm-1]+ym+yp+1)%7; System.out.print(wd[d]); } }
type: Question
has answer: http://stackoverflow.com/a/20949083
has answer: http://stackoverflow.com/a/21170936
has comment: http://stackoverflow.com/comment/31870378
has answer: http://stackoverflow.com/a/20949062
has answer: http://stackoverflow.com/a/20949072
has comment: http://stackoverflow.com/comment/31463151
type: UnansweredQuestion

http://stackoverflow.com/comment/31364598
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20896721
type: Comment
has text: @MrPork that's a typo :P

http://stackoverflow.com/comment/31365914
has text: **For the next query** I have **carried object of Connection is it right?** or i should carry object of **Statement**. As i know statement should be created again but connection is one time activity. Right?? @CoolMonster
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/20883676
type: Comment

http://stackoverflow.com/a/20959701
accepted answer of: http://stackoverflow.com/q/20959453
answers question: http://stackoverflow.com/q/20959453
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31512818
type: Answer
has body: Please enter your name First name: Last name: I wrote correct code. There were some mistakes in html like; Another one And your Hello.html Title Content

http://stackoverflow.com/a/20908254
has comment: http://stackoverflow.com/comment/31385941
has comment: http://stackoverflow.com/comment/31385741
has comment: http://stackoverflow.com/comment/31386621
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31386369
upvote count: 28
type: Answer
has body: You could use the Hibernate Validator directly, and annotate your field with @Digits like so: @Digits(integer=5, fraction=2) @Column(name = "weight") private BigDecimal weight;
accepted answer of: http://stackoverflow.com/q/20907923
has comment: http://stackoverflow.com/comment/31386047
answers question: http://stackoverflow.com/q/20907923
score: 28

http://stackoverflow.com/q/20874792
has comment: http://stackoverflow.com/comment/31324027
downvote count: 2
has answer: http://stackoverflow.com/a/20874850
tagged with: loops
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/20874830
possible better answer: http://stackoverflow.com/a/20874822
has answer: http://stackoverflow.com/a/20874822
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/31323797
has answer: http://stackoverflow.com/a/20874853
has title: Can someone clarify this code snippet that reverses a string?
accepted answer: http://stackoverflow.com/a/20874850
has comment: http://stackoverflow.com/comment/31323800
tagged with: string
favorite count: 0
has body: Can someone explain how this code works, in particular the for loop part as I get the rest of it. String x = "hello world"; for(int i = x.length() - 1; i &gt;= 0; i--) { System.out.print(x.charAt(i)); }
has answer: http://stackoverflow.com/a/20874835
answer count: 5
type: AnsweredQuestion

http://stackoverflow.com/comment/31488649
score: 0
type: Comment
has text: @erickson Even worse, it does not accept data of over keysize - 88 bits either. So what ECB mode would that be?
type: AnswerComment
comment on: http://stackoverflow.com/a/20961878

http://stackoverflow.com/q/21001721
has body: I'm relatively new to Android development, and I was wondering if it's possible to mask a VideoView into a shape. This is what I have so far: Expected Result My XML for video view and layout: &lt;RelativeLayout 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:background="#0088ff" 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=".VideoPlayerActivity" &gt; &lt;FrameLayout android:layout_width="250dp" android:layout_height="250dp" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:background="@drawable/circular_mask" android:foreground="@drawable/circular_mask" &gt; &lt;VideoView android:id="@+id/videoView1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:fitsSystemWindows="false" android:focusable="false" android:focusableInTouchMode="false" android:scrollbarAlwaysDrawVerticalTrack="false" /&gt; &lt;Space android:layout_width="match_parent" android:layout_height="match_parent" /&gt; &lt;/FrameLayout&gt; &lt;/RelativeLayout&gt; Mask shape xml: &lt;shape xmlns:android="http://schemas.android.com/apk/res/android" android:padding="20dp" android:shape="oval" &gt; &lt;solid android:color="#FFFFFFFF" /&gt; &lt;corners android:radius="10dp" /&gt; &lt;/shape&gt; Main java: package com.example.webmvideo; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.annotation.TargetApi; import android.app.Activity; import android.view.Menu; import android.widget.MediaController; import android.widget.VideoView; import android.util.Log; import android.media.MediaPlayer; @TargetApi(Build.VERSION_CODES.HONEYCOMB) public class MainActivity extends Activity { Uri srcPath = U…
favorite count: 0
has comment: http://stackoverflow.com/comment/35356764
tagged with: android
has comment: http://stackoverflow.com/comment/35477489
has answer: http://stackoverflow.com/a/23604686
tagged with: http://stackoverflow.com/tag/xml
upvote count: 12
linked to: http://stackoverflow.com/q/22196138
tagged with: mask
has comment: http://stackoverflow.com/comment/41824773
has title: Android - Creating a circular mask on video
accepted answer: http://stackoverflow.com/a/31064523
type: AnsweredQuestion
tagged with: android-layout
tagged with: java
possible better answer: http://stackoverflow.com/a/23604686
has answer: http://stackoverflow.com/a/31064523
type: Question
has comment: http://stackoverflow.com/comment/46882136
score: 12
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/31502886
type: Comment
type: QuestionComment
has text: Unfortunately yes. Also the simulation reporting system needs those 'historical'data.
comment on: http://stackoverflow.com/q/20968797
score: 0

http://stackoverflow.com/comment/31529171
has text: I am not sure of what you mean by "Solaris resources", could you please clarify? Regarding output: yes, it's continuosly printed to the `screen` tty, so that if you detach and reattach, you will find anything that was printed during your absence. Still, the buffer is not infinite, you can increase its size (see [this answer](https://stackoverflow.com/questions/8760346/how-do-i-increase-the-scrollback-buffer-in-a-running-screen-session), for instance), but if you need a complete log, I suggest piping output to `tee`, like `java -jar /SomeApplication.jar | tee -a logfile`
comment on: http://stackoverflow.com/a/20978994
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/20987469
answer count: 1
has body: So I'm using SimonVT number picker to try and create a number picker that works with gingerbread. Unfortunately when I try to set it up as a dialog, it crashes when it tries to inflate the xml. I honestly have spent a while on this and cannot for the love of me figure out. Can anyone else? This is where it crashes: import net.simonvt.numberpicker.NumberPicker; import android.app.AlertDialog; import android.app.Dialog; import android.os.Bundle; import android.support.v4.app.DialogFragment; import android.view.View; public class setSnoozeMethodDialog extends DialogFragment{ @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); View view = getActivity().getLayoutInflater().inflate(R.layout.set_snooze_dialog, null); NumberPicker np = (NumberPicker) view.findViewById(R.id.numberPicker); np.setMaxValue(20); np.setMinValue(0); np.setFocusable(true); np.setFocusableInTouchMode(true); builder.setView(view); return builder.create(); } This is the xml that is having trouble being inflated <?xml version="1.0" encoding="utf-8"?> <net.simonvt.numberpicker.NumberPicker android:id="@+id/numberPicker" android:layout_width="wrap_content" android:layout_height="wrap_content" /> This is the error 01-07 23:44:33.308: E/AndroidRuntime(623): FATAL EXCEPTION: main 01-07 23:44:33.308: E/AndroidRuntime(623): android.view.InflateException: Binary XML file line #8: Error inflating class net.simonvt.numberpicker.NumberPicker 01-07 23:44:33.308: E/AndroidRuntime(623): at android.view.LayoutInflater.createView(LayoutInflater.java:518) 01-07 23:44:33.308: E/AndroidRuntime(623): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570) 01-07 23:44:33.308: E/AndroidRuntime(623): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623) 01-07 23:44:33.308: E/AndroidRuntime(623): at android.view.LayoutInflater.inflate(LayoutInflater.java:408) 01-07 23:44:33.308: E/AndroidRuntime(623): at android.…
has title: Using SimonVT number picker and unable to inflate xml
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/20998374
accepted answer: http://stackoverflow.com/a/20998374
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
downvote count: 0
type: Question
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/q/21003096
has comment: http://stackoverflow.com/comment/31564161
has comment: http://stackoverflow.com/comment/31564825
tagged with: java
has title: Setting an instance to null or create a new instance with new
possible better answer: http://stackoverflow.com/a/21003131
has comment: http://stackoverflow.com/comment/31565073
answer count: 3
has answer: http://stackoverflow.com/a/21003133
has answer: http://stackoverflow.com/a/21003131
favorite count: 0
has comment: http://stackoverflow.com/comment/31564429
score: 2
type: AnsweredQuestion
upvote count: 3
has body: Does this: // Class 'Refresh' inherits class 'Thread' Thread refresh = new Refresh(paramOne); ... refresh = null; refresh = new Refresh(paramTwo); And this: // Class 'Refresh' inherits class 'Thread' Thread refresh = new Refresh(paramOne); ... refresh = new Refresh(paramTwo); Have the same result? Does assigning a new class instance on an existing object null out the first class instance?
has comment: http://stackoverflow.com/comment/31565149
has comment: http://stackoverflow.com/comment/31564989
downvote count: 1
has answer: http://stackoverflow.com/a/21003255
type: Question
accepted answer: http://stackoverflow.com/a/21003255

http://stackoverflow.com/comment/31413226
type: Comment
type: QuestionComment
has text: It rotates about the center of the sprite, like so: g2d.rotate(Math.toRadians( tank1.getAngle() ), tank1.getX()+tank1.getWidth()/2, tank1.getY()+tank1.getHeight()/2);
comment on: http://stackoverflow.com/q/20922525
score: 0

http://stackoverflow.com/comment/31474325
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/20951392
type: Comment
has text: Thank you. It worked for me. What I did is that I initialized a boolean flag to false and after `handler.postDelayed(this, 3000);`, the flag is set. I added my code which is after `while(1)` and executed it if the flag is set, hence, i is incremented at the beginning after the sleep function and later increments are made in my code. :)

http://stackoverflow.com/a/20945389
answers question: http://stackoverflow.com/q/20945357
downvote count: 0
has comment: http://stackoverflow.com/comment/31456784
has comment: http://stackoverflow.com/comment/31456960
type: Answer
has body: The first one is the right choice, one method should do one thing, besides the first one is much more understandable than the second one.
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/20945357
type: AcceptedAnswer

http://stackoverflow.com/comment/31279321
has text: Hi i need to point some placemarker icons on an image on a map based on location i want. However the map will be a static image. Any help appreciated. Thanks
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20851563

http://stackoverflow.com/comment/31472881
type: AnswerComment
comment on: http://stackoverflow.com/a/20953813
type: Comment
has text: nope, when i did this i ruined the code in some other places :/ the recommendetions said "the static field Polylinje.horn should be accesed in a static way"
score: 0

tooltip
tags question: http://stackoverflow.com/q/21018083
type: Tag
tags question: http://stackoverflow.com/q/20850531
tags question: http://stackoverflow.com/q/20986685
tag name: tooltip

http://stackoverflow.com/q/20894897
type: Question
has title: Spring MBean client thinks MBean service is RMI connection
score: 1
tagged with: rmi
tagged with: java
has answer: http://stackoverflow.com/a/28511997
tagged with: mbeans
accepted answer: http://stackoverflow.com/a/28511997
answer count: 1
downvote count: 0
favorite count: 0
tagged with: spring
has comment: http://stackoverflow.com/comment/31429924
type: AnsweredQuestion
has body: I'm having problems connecting my own Spring MBean client to the "Hello World!" service as seen in the JMX examples from Oracle. The service and included client are working fine. I think it has to do with an RMI connection coming back when it's expecting something else... but I don't know what the solution would be, or even if that is a correct inference. Or am I somehow using the "wrong" MBeanServerConnectionFactoryBean ? Any ideas? Here's my spring config for this bean: &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"&gt; &lt;bean id="mBeanServerClient" class="org.springframework.jmx.support.MBeanServerConnectionFactoryBean"&gt; &lt;property name="serviceUrl" value="service:jmx:rmi://localhost/jndi/rmi://localhost:9999/jmxrmi" /&gt; &lt;/bean&gt; &lt;bean id="jmxClient" class="com.foo.jmx.MBeanPollingClient"&gt; &lt;property name="mbeanServerConnection" ref="mBeanServerClient" /&gt; &lt;/bean&gt; &lt;/beans&gt; Here's my implementing code: import org.springframework.jmx.support.MBeanServerConnectionFactoryBean; public class MBeanPollingClient { private MBeanServerConnectionFactoryBean mbeanServerConnection = null; public void setMbeanServerConnection ( MBeanServerConnectionFactoryBean m ) { mbeanServerConnection = m; } public MBeanServerConnectionFactoryBean getMbeanServerConnection ( ) { return mbeanServerConnection; } } The error I'm getting: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmxClient' defined in class path resource [jmx-beans.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection' to required type 'org.springframework.jmx.support.MBea…
tagged with: jmx
has comment: http://stackoverflow.com/comment/31477017
upvote count: 1

http://stackoverflow.com/comment/31587415
score: 0
comment on: http://stackoverflow.com/q/21015649
type: Comment
type: QuestionComment
has text: @aroun clicking you just takes me to your user page...:-P

http://stackoverflow.com/comment/31372503
score: 0
type: Comment
type: QuestionComment
has text: 1. `Is there a specific way I should insert the JTable as cell data?` - I think that SwingX site has bunch code examples, incl. description and links to APIs 2. `Thank you for your help!` - glad if help you, 3. btw question in this form isn't answerable on SO
comment on: http://stackoverflow.com/q/20900726

http://stackoverflow.com/comment/31291126
has text: Can we know why you want to declare your `String field` in subclass as `private`? If it will move this field to `SerializedConig` and declare it as `protected` (as Russell suggested) access to it will have only your subclass and classes from same package as `SerializedConig`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20857755
score: 0

http://stackoverflow.com/a/20950163
type: Answer
has body: see following example class CallsComp implements Comparator&lt;Calls&gt;{ @Override public int compare(Calls c1, Calls c2) { if(c1.getMs() &lt; c2.getMs()){ return 1; } else { return -1; } } }
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/20950066
downvote count: 0

http://stackoverflow.com/q/20938176
has title: How's the memory allocated for multidimensional array when one of the index is not specified
upvote count: 2
tagged with: java
tagged with: memory
type: Question
tagged with: arrays
has answer: http://stackoverflow.com/a/20938246
has answer: http://stackoverflow.com/a/20938236
has body: Let's say I have a Java Program int[5][] array; arr[0]= getMeArray(var); arr[1]= getMeArray(var); ..and so on public int[] getMeArray(int var){ if(var == 0) return new int[9]; else return new int[5]; } Now, is the memory allocation done on compile time, because it should be done as per my understanding, but I am not sure how to figure out how much should be allocated to array.
downvote count: 0
has answer: http://stackoverflow.com/a/20938238
has answer: http://stackoverflow.com/a/20938289
has comment: http://stackoverflow.com/comment/31443352
favorite count: 0
answer count: 5
possible better answer: http://stackoverflow.com/a/20938238
accepted answer: http://stackoverflow.com/a/20938246
has answer: http://stackoverflow.com/a/20938335
type: AnsweredQuestion
score: 2

http://stackoverflow.com/a/20867470
has comment: http://stackoverflow.com/comment/31309413
has comment: http://stackoverflow.com/comment/31309473
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31309700
has body: Where A is class typeid(A).name()
has comment: http://stackoverflow.com/comment/31309968
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/20867439

http://stackoverflow.com/comment/31348510
comment on: http://stackoverflow.com/q/20887593
score: 0
type: Comment
type: QuestionComment
has text: @David hope you understant my comments in the edited question ;)

http://stackoverflow.com/comment/31391313
has text: nice answer :) i just want to know why you add it to a panel , +1
type: Comment
score: 1
comment on: http://stackoverflow.com/a/20910881
type: AnswerComment

http://stackoverflow.com/comment/31509384
type: QuestionComment
comment on: http://stackoverflow.com/q/20967424
has text: You have to pass the *correct* arguments to the pseudo-constructor `init()` - not a method of the class. From what I can tell, the constructor for that class expects completely different arguments than what you are using anyway, hence it will not work even using `init()`. Out of curiosity, why do you need to use an internal class? What is the goal? Also, are you aware it is undocumented and may change in future versions?
score: 0
type: Comment

http://stackoverflow.com/comment/31317047
comment on: http://stackoverflow.com/q/20871428
type: Comment
type: QuestionComment
score: 0
has text: I'm looking for a system of reading and writing text, in a simple way. It seems that the writer works, but writes in a different location to where the reader reads from

http://stackoverflow.com/comment/31318070
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20871795
has text: How are you compiling and building your project?

http://stackoverflow.com/a/20916157
has comment: http://stackoverflow.com/comment/31402238
score: 2
has comment: http://stackoverflow.com/comment/31402050
upvote count: 2
has comment: http://stackoverflow.com/comment/31402224
has comment: http://stackoverflow.com/comment/31402097
has body: You can use the CDate function, and the ORDER BY is // Java style variable names. String date1 = jTextField.getText(); String date2 = jTextField2.getText(); // using CDate... pre=conn.prepareStatement("select * from Table where Date " + "between CDate(?) and CDate(?) order by Date"); pre.setString(1, date1); // bind param 1 pre.setString(2, date2); // bind param 2 ResultSet rs=pre.executeQuery(); It is also possible to convert the String(s) into Date(s) in Java using a SimpleDateFormat, but that solution is more complex. At this point, you should probably stick with the simplest (correct) solution.
has comment: http://stackoverflow.com/comment/31401677
has comment: http://stackoverflow.com/comment/31402158
accepted answer of: http://stackoverflow.com/q/20916063
has comment: http://stackoverflow.com/comment/31402089
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20916063
has comment: http://stackoverflow.com/comment/31409875
type: Answer

http://stackoverflow.com/a/21058864
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31666430
answers question: http://stackoverflow.com/q/20986116
has comment: http://stackoverflow.com/comment/31667353
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31666002
has body: You also can use struts2 tiles for your problem. Create your base layout using tiles. your layout is similar to the layout in this tutorial. So all you need is to have your menu in header part of layout. On click of button or menu youy call a particular action whic inturn call a particular tile definition which will have your concerned jsp page in the middle :)
type: Answer
has comment: http://stackoverflow.com/comment/31667625
accepted answer of: http://stackoverflow.com/q/20986116

http://stackoverflow.com/q/20976194
has comment: http://stackoverflow.com/comment/31514524
favorite count: 0
has comment: http://stackoverflow.com/comment/31515599
tagged with: http://stackoverflow.com/tag/html
answer count: 0
downvote count: 0
type: UnansweredQuestion
score: 1
has title: Webdriver : Waiting for JavaScript automation to complete (Java)
tagged with: selenium
tagged with: java
tagged with: javascript
has comment: http://stackoverflow.com/comment/31514709
has body: Im trying to write an automated test for a dynamic web application. When the page loads, all the elements are "visible" and "enabled" but my test keeps failing due to "element not clickable". This is because the page starts uses JavaScript automation where all the elements are present but hidden by another div that slow expands and reveals the elements behind it. So, using an explicit wait of visibilityof or elementtobeclickable doesn't work. They still fail as it says the div gets the click instead of the element I want to click. Any suggestions on how to wait for the JavaScript automation to complete?
type: Question
upvote count: 1
linked to: http://stackoverflow.com/q/11736027

http://stackoverflow.com/comment/31305361
comment on: http://stackoverflow.com/q/20865143
has text: I would comment such literals so that someone who reads it with a font without those characters knows what's supposed to be there, but I see no reason not to just use the first option.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20884857
tagged with: indexoutofboundsexception
tagged with: arraylist
tagged with: runtime-error
has title: java.lang.IndexOutOfBoundsException
has comment: http://stackoverflow.com/comment/31341644
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31342065
type: Question
possible better answer: http://stackoverflow.com/a/20885051
has comment: http://stackoverflow.com/comment/31341662
has answer: http://stackoverflow.com/a/20885051
has comment: http://stackoverflow.com/comment/31341620
tagged with: java
answer count: 2
has body: I use ArrayList to store the 'shadows' for every rectangle in the level but when I iterate through the like this: for(int n = 0; n &lt; shadows.size(); ++n){ g2d.fillPolygon(shadows.get(n)[0]); g2d.fillPolygon(shadows.get(n)[1]); g2d.fillPolygon(shadows.get(n)[2]); g2d.fillPolygon(shadows.get(n)[3]); g2d.fillPolygon(shadows.get(n)[4]); g2d.fillPolygon(shadows.get(n)[5]); } I get a java.lang.IndexOutOfBoundsException error that looks like this: Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: Index: 42, Size: 79 Why do I get the error even through the index number isn't equal or more than the size? The program still runs like normal but I still don't want it to have any errors. I have also tried an enchanced for loop but then I get a java.util.ConcurrentModificationException instead for(Polygon[] polys : shadows){ g2d.fillPolygon(polys[0]); g2d.fillPolygon(polys[1]); g2d.fillPolygon(polys[2]); g2d.fillPolygon(polys[3]); g2d.fillPolygon(polys[4]); g2d.fillPolygon(polys[5]); }
upvote count: 1
linked to: http://stackoverflow.com/q/13536340
has answer: http://stackoverflow.com/a/20884923
accepted answer: http://stackoverflow.com/a/20884923
tagged with: arrays

http://stackoverflow.com/comment/31542073
type: QuestionComment
score: 1
has text: I think your first option. So much so, that I have voted to close as a duplicate of a question for which that is the accepted answer.
comment on: http://stackoverflow.com/q/20991102
type: Comment

http://stackoverflow.com/q/20873005
has title: break for loop in java
has comment: http://stackoverflow.com/comment/31320372
possible better answer: http://stackoverflow.com/a/20873076
accepted answer: http://stackoverflow.com/a/20873220
tagged with: arrays
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/20873199
answer count: 5
has answer: http://stackoverflow.com/a/20873220
has answer: http://stackoverflow.com/a/20873076
has answer: http://stackoverflow.com/a/20873223
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20873172
tagged with: authentication
has comment: http://stackoverflow.com/comment/31322408
upvote count: 1
has comment: http://stackoverflow.com/comment/31320301
has comment: http://stackoverflow.com/comment/31320353
type: Question
has body: I need help, I have tired all I can to break the loop but it keeps displaying the else statement print out. I am trying to figure out how to make a log in through an array and I have not been successful. SAD. main method login import java.util.*; public class LogIn { public static void main(String[] args) { Person [] people = new Person[2]; people[0] = new Person("Heather","Ward","Davis"); people[1] = new Person("Thomas","Cummings","Tomc84"); Scanner input = new Scanner(System.in); String current_login = ""; String pass = ""; int login_count = 3; //do{ System.out.print("Enter your name: "); current_login = input.nextLine(); System.out.print("\nEnter your password: "); pass = input.nextLine(); outerloop: for (Person p: people){ if(current_login.equals(p.getF_name()) &amp;&amp; pass.equals(p.getPassword())){ System.out.println("\nHello " + p.getF_name() + " " + p.getL_name()); break outerloop; } else{ login_count--; System.out.println("\nYou have " + login_count + " tries"); } } //}while(login_count &gt; 0 ); } } public class Person { private String f_name = ""; private String l_name = ""; private String password = ""; public Person(){}; public Person(String f_name, String l_name, String password) { this.f_name = f_name; this.l_name = l_name; this.password = password; } public String getF_name() { return f_name; } public void setF_name(String f_name) { this.f_name = f_name; } public String getL_name() { return l_name; } public void setL_name(String l_name) { this.l_name = l_name; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String toString(){ return "first name: " + f_name + "Last name: " + l_name ; } }

http://stackoverflow.com/comment/31510719
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20973487
score: 0
has text: yes, that's what i did. nothing 〒_〒

http://stackoverflow.com/comment/31318573
score: 0
type: Comment
type: QuestionComment
has text: @torbinsky, i am sure i am doing the things correctly, but `System.out.println(url);` gave `null`
comment on: http://stackoverflow.com/q/20871795

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

http://stackoverflow.com/q/20866287
has comment: http://stackoverflow.com/comment/31307305
type: Question
tagged with: graphics
has answer: http://stackoverflow.com/a/20866347
has title: Basic Graphics. Need help in drawing
has comment: http://stackoverflow.com/comment/31307464
has comment: http://stackoverflow.com/comment/31307528
possible better answer: http://stackoverflow.com/a/20866347
answer count: 2
linked to: http://stackoverflow.com/q/7218309
upvote count: 0
has body: I'm just beginning to learn basic graphics, particularly drawing, and I would like to ask for suggestions on how I draw animals such as this fox. http://www.wikihow.com/images/2/2f/Draw-a-Fox-Step-9.jpg Do I use polygons and hard code the whole drawing? Or is there a program that allows me to input the image in it and it outputs the x and y coordinates of all the vertices that I'd need in order to draw it? Basically, what I have to do is I'd draw that fox in Java but I have to draw it on my own using shapes. I'd have to start from scratch and work my way up until I recreate the fox using Java's shapes. Any suggestions how I do this?
has comment: http://stackoverflow.com/comment/31307320
has answer: http://stackoverflow.com/a/20866334
favorite count: 0
has comment: http://stackoverflow.com/comment/31308124
tagged with: drawing
has comment: http://stackoverflow.com/comment/31307342
score: -1
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/20866334
downvote count: 1

http://stackoverflow.com/q/20875032
upvote count: 2
accepted answer: http://stackoverflow.com/a/20875738
downvote count: 1
tagged with: jakarta-ee
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20875378
tagged with: java
has answer: http://stackoverflow.com/a/20875378
type: Question
has title: JavaMail and linebreaks
tagged with: jakarta-mail
answer count: 2
score: 1
has body: What I'm doing is an email template module. I can send successfully but when I read the sent mail the line-breaks disappeared for example this is what I sent: " Dear ñ , ABCDEFGHIJKLMNOPQRSTUVWXYZ. abcdefghijklmnopqrstuvwxyz. 1234567890. !@#$%^&amp;*()_. Loren ipsum blahbity blahbity blah blah. WQWERTYUIOP{}ASDFGHJKL"ZXCVBNM&lt;&gt; I am white spaces " This is what I received: "Dear ñ , ABCDEFGHIJKLMNOPQRSTUVWXYZ. abcdefghijklmnopqrstuvwxyz. 1234567890. !@#$%^&amp;*()_. Loren ipsum blahbity blahbity blah blah.QWERTYUIOP{}ASDFGHJKL:"ZXCVBNM&lt;&gt; I am white spaces" Take note that the email body came body the database then stored into a pojo. The test method for sending: @Test public void sendServiceTest() { String hostName = null; // Set up the SMTP server. Properties props = new Properties(); props.put("mail.transport.protocol", "smtp"); props.put("mail.smtp.host", getHost); Session session = Session.getDefaultInstance(props); session.setDebug(true); Message msg = new MimeMessage(session); try { hostName = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { msg.setFrom(new InternetAddress(hostName)); InternetAddress manyAddressTo = null; // InternetAddress[] manyAddressCC = null; // InternetAddress[] manyAddressBCC = null; List&lt;EmailRecipient&gt; recipients = emailRecipientService .selectRecipientByCode("E1"); manyAddressTo = new InternetAddress("sample@sample.com"); msg.setRecipient(Message.RecipientType.TO, manyAddressTo); msg.setSubject(recipients.get(0).getEmailTemplate().getSubject()); msg.setContent(recipients.get(0).getEmailTemplate().getEmail_body()+"\r\n","text/html; charset=utf-8"); Transport.send(msg); } catch (MessagingException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
has answer: http://stackoverflow.com/a/20875738
favorite count: 0
tagged with: line-breaks

http://stackoverflow.com/a/21211294
has body: You need to understand first the difference between specifying base 10 numbers and base 16 numbers (hex) in Java. As others stated 0x is a prefix to a number that says it's in base 16 (hex). It's useful to specify colors in hex notation because they have components (Alpha, R, G, B), which are not obvious when you put them in base 10. See this answer for more details: https://stackoverflow.com/a/8633244/1168342
type: Answer
answers question: http://stackoverflow.com/q/20984364
score: 0

http://stackoverflow.com/a/20953246
has body: First, I/O operations are issued from JDBC driver, so if you want to use non-blocking I/O, you need async driver like adbcj. Second, a thread consumes not so much memory so the economy does not worth efforts.
type: Answer
has comment: http://stackoverflow.com/comment/31471413
has comment: http://stackoverflow.com/comment/31471544
answers question: http://stackoverflow.com/q/20952464
has comment: http://stackoverflow.com/comment/31473939
has comment: http://stackoverflow.com/comment/31473487
score: 0

http://stackoverflow.com/q/21000843
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21014939
tagged with: java
tagged with: actor
has title: How to log all incoming messages from Akka (Java)
accepted answer: http://stackoverflow.com/a/21014939
type: Question
has comment: http://stackoverflow.com/comment/31560270
upvote count: 4
tagged with: akka
answer count: 1
downvote count: 0
favorite count: 0
tagged with: scala
has comment: http://stackoverflow.com/comment/31559983
has body: In Scala you can wrap the receive function with a LoggingReceive. How do you achieve the same from the Java API? def receive = { LoggingReceive { case x ⇒ // do something } }
score: 4

http://stackoverflow.com/comment/31567292
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21004626
has text: You will get NullPointerException if you don't initialize your Students collection. So it should be initialized as `Student[] students = new Student[capacity];`
score: 0

http://stackoverflow.com/q/20868515
has body: (I wish I could tag this question for all class-constructing languages implementing threads, but here under Java, C++, C# and Ruby. Not that I am cool with all of these) I think I have seen statements to this effect (that class constructors are threadsafe) on blog posts/tutorials. I can't trace any direct statements, but many posts and tutorials make the assumption, or do not even mention the problem of threads running on constructors and destructors. Sticking to Java, which has a history and some formal approach to multi-threading, Javamex Jankov's tutorials Oracle tutorials All these articles/webpages are written in a confident way and contain rounded discussions. They all mention the Java feature of method synchronization, so you would hope they might mention how this would affect the special methods of construction and destruction. But they do not. But class constructors and destructors need to be considered like any class methods. Here is an article on Java, Safe construction techniques in Java about leaking 'this' references from constructors. And here are a couple of StackOverflow posts, Incompletely constructed objects in Java, Java constructor needs locking showing constructors with thread issues. I doubt threading issues in special methods are limited to Java. So, I'm wondering, Is the assumption of threadsafety (however defined) based on the general layout of constructors? A tightly coded constructor with not much code would be close to re-entrant code (accepting data through parameters, etc.) Or do interpreters/compilers handle constructors/destructors with special treatment or protections? For example, the Java memory model makes some comments on expectations at the end of construction, and I expect other language specifications will too. Wikipedia on constructors has little on this. In a different context this post Constructors in Programming languages contains some hints, but is not about threadsafety. While there many be information in specialist boo…
tagged with: java
has comment: http://stackoverflow.com/comment/31311321
has comment: http://stackoverflow.com/comment/31311627
linked to: http://stackoverflow.com/q/2793611
type: Question
tagged with: c#
has answer: http://stackoverflow.com/a/20868603
downvote count: 0
has comment: http://stackoverflow.com/comment/31311286
linked to: http://stackoverflow.com/q/2513597
answer count: 3
has title: Why are constructors in class-structured languages generally regarded as threadsafe?
has comment: http://stackoverflow.com/comment/31349455
favorite count: 0
tagged with: ruby
linked to: http://stackoverflow.com/q/10528572
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20868593
has answer: http://stackoverflow.com/a/20868569
tagged with: c++
score: 2
has comment: http://stackoverflow.com/comment/31311890

http://stackoverflow.com/a/20921181
type: Answer
has comment: http://stackoverflow.com/comment/31412393
upvote count: 2
has body: You can't modify a collection while iterating over it, except by using Iterator.remove(). This rule implies that you can't use two iterators simultaneously and expect remove() to work, because calling remove() on one iterator will violate the rule for the other iterator. The solution is to collect all the entries that need deleting in a separate Set, then after your logic has completed, call List.removeAll(set). Given this, you don't need iterators at all - just use the foreach syntax: For a simplistic example: List&lt;RemoveTest&gt; list = new ArrayList&lt;RemoveTest&gt;(); // populate list Set&lt;RemoveTest&gt; removals = new HashSet&lt;RemoveTest&gt;(); for (RemoveTest i : list) for (RemoveTest j : list) if (...) removals.add(i); // j will get added in another iteration list.removeAll(removals);
has comment: http://stackoverflow.com/comment/31421007
accepted answer of: http://stackoverflow.com/q/20921024
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20921024
has comment: http://stackoverflow.com/comment/31410592
has comment: http://stackoverflow.com/comment/31410878
score: 2

http://stackoverflow.com/comment/31556352
has text: Is there any way to control the spacing between the top and the bottom images? When I either do it this way or with a RelativeLayout, the spacing between the top image and the bottom two images is the whole screen.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20998978
type: Comment

http://stackoverflow.com/comment/31589827
comment on: http://stackoverflow.com/q/20893236
type: Comment
type: QuestionComment
has text: you are right, `list()` is not save (but actually I only use it, if the data is not changed anymore)... Actually I don't know where to start debugging... I know, my list is NOT recreated, because mTotalData is not null... I don't know how GreenDao restores the state of a custom field, but with debugging, I find out, that my mTotalData is NOT null, if my entity already existed once... And I don't know how `DaoSession.load(...)` does restore that field...
score: 0

http://stackoverflow.com/q/20863516
tagged with: maven
has answer: http://stackoverflow.com/a/20864998
tagged with: java
has answer: http://stackoverflow.com/a/20863546
has title: SonarQube: When running the combined-ut-it-multimodule-maven-jacoco example I get 0% coverage
tagged with: integration-testing
tagged with: sonarqube
type: Question
answer count: 2
has body: For the sonar example combined-ut-it-multimodule-maven-jacoco example I run mvn clean install sonar:sonar and get the following output that shows 0% because it cannot find the classes directories that are in each of the modules' target directories: [INFO] [13:44:38.630] Sensor JaCoCoSensor... [INFO] [13:44:38.630] Project coverage is set to 0% since there is no directories with classes. [INFO] [13:44:38.630] Sensor JaCoCoSensor done: 0 ms [INFO] [13:44:38.829] Execute decorators... [INFO] [13:44:43.156] Store results in database [INFO] [13:44:43.672] ANALYSIS SUCCESSFUL, you can browse http://vqsonar1.phx01.ebayads.com:80/dashboard/index/org.example.app-example:parent [INFO] [13:44:43.776] Executing post-job class org.sonar.plugins.core.issue.notification.SendIssueNotificationsPostJob [INFO] [13:44:43.777] Executing post-job class org.sonar.plugins.core.batch.IndexProjectPostJob [INFO] [13:44:44.112] Executing post-job class org.sonar.plugins.dbcleaner.ProjectPurgePostJob [INFO] [13:44:44.181] -&gt; Keep one snapshot per day between 2013-12-03 and 2013-12-30 [INFO] [13:44:44.182] -&gt; Keep one snapshot per week between 2013-01-01 and 2013-12-03 [INFO] [13:44:44.182] -&gt; Keep one snapshot per month between 2009-01-06 and 2013-01-01 [INFO] [13:44:44.183] -&gt; Delete data prior to: 2009-01-06 [INFO] [13:44:44.308] -&gt; Clean JaCoCo Examples :: app-example :: parent [id=11975] [INFO] [13:44:44.379] &lt;- Clean snapshot 14448 [INFO] [13:44:53.292] -&gt; Clean JaCoCo Examples :: app-example :: app [id=11976] [INFO] [13:44:53.354] -&gt; Clean JaCoCo Examples :: app-example :: app-it [id=11977] [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] JaCoCo Examples :: app-example :: parent .......... SUCCESS [2:32.824s] [INFO] JaCoCo Examples :: app-example :: app ............. SUCCESS [1.596s] [INFO] JaCoCo Examples :: app-example :: app-it .......... SUCCESS [0.422s] [INFO] --------------------------------…
score: 0
type: UnansweredQuestion

http://stackoverflow.com/q/20928381
tagged with: java
type: Question
has title: How to declare an imageIcon array?
answer count: 1
has body: I am somewhat new to Java, so excuse this really dumb question. I was just wondering, how does one declare a 2D array of ImageIcons?
score: 0
tagged with: multidimensional-array
accepted answer: http://stackoverflow.com/a/20928396
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20928396

maven
tags question: http://stackoverflow.com/q/20929933
tags question: http://stackoverflow.com/q/20887366
tags question: http://stackoverflow.com/q/20884909
tags question: http://stackoverflow.com/q/20862365
tags question: http://stackoverflow.com/q/20973589
type: Tag
tags question: http://stackoverflow.com/q/20922572
tags question: http://stackoverflow.com/q/20861324
tags question: http://stackoverflow.com/q/20990077
tags question: http://stackoverflow.com/q/21000822
tags question: http://stackoverflow.com/q/20886373
tags question: http://stackoverflow.com/q/21010193
tags question: http://stackoverflow.com/q/20907912
tags question: http://stackoverflow.com/q/20978169
tags question: http://stackoverflow.com/q/20898797
tags question: http://stackoverflow.com/q/20988000
tags question: http://stackoverflow.com/q/20956559
tags question: http://stackoverflow.com/q/20993594
tags question: http://stackoverflow.com/q/20951546
tags question: http://stackoverflow.com/q/20912994
tags question: http://stackoverflow.com/q/21015897
tags question: http://stackoverflow.com/q/20852946
tags question: http://stackoverflow.com/q/20896312
tags question: http://stackoverflow.com/q/20967315
tags question: http://stackoverflow.com/q/20906609
tags question: http://stackoverflow.com/q/20945811
tags question: http://stackoverflow.com/q/20957422
tags question: http://stackoverflow.com/q/20940881
tags question: http://stackoverflow.com/q/20960414
tags question: http://stackoverflow.com/q/20988736
tags question: http://stackoverflow.com/q/20863516
tags question: http://stackoverflow.com/q/21011092
tags question: http://stackoverflow.com/q/20919204
tags question: http://stackoverflow.com/q/20867949
tags question: http://stackoverflow.com/q/20924833
tags question: http://stackoverflow.com/q/20860493
tags question: http://stackoverflow.com/q/20974642
tags question: http://stackoverflow.com/q/20975751
tags question: http://stackoverflow.com/q/20932033
tags question: http://stackoverflow.com/q/20960915
tags question: http://stackoverflow.com/q/20953630
tags question: http://stackoverflow.com/q/20934542
tags question: http://stackoverflow.com/q/20914953
tags question: http://stackoverflow.com/q/20909634
tags question: http://stackoverflow.com/q/20947271
tags question: http://stackoverflow.com/q/20937537
tags question: http://stackoverflow.com/q/20977654
tags question: http://stackoverflow.com/q/21004704
tags question: http://stackoverflow.com/q/20997479
tags question: http://stackoverflow.com/q/21016211
tags question: http://stackoverflow.com/q/20988598
tags question: http://stackoverflow.com/q/20915271
tags question: http://stackoverflow.com/q/20924823
tags question: http://stackoverflow.com/q/20877662
tags question: http://stackoverflow.com/q/20964516
tags question: http://stackoverflow.com/q/20927903
tags question: http://stackoverflow.com/q/20870046
tags question: http://stackoverflow.com/q/20883654
tags question: http://stackoverflow.com/q/20981387
tags question: http://stackoverflow.com/q/20902177
tags question: http://stackoverflow.com/q/20993038
tags question: http://stackoverflow.com/q/20902675
tags question: http://stackoverflow.com/q/21006026
tags question: http://stackoverflow.com/q/21001073
tags question: http://stackoverflow.com/q/20876951
tags question: http://stackoverflow.com/q/20969409
tags question: http://stackoverflow.com/q/20890051
tags question: http://stackoverflow.com/q/20881565
tags question: http://stackoverflow.com/q/20984497
tags question: http://stackoverflow.com/q/20993336
tags question: http://stackoverflow.com/q/20876695
tags question: http://stackoverflow.com/q/20960699
tags question: http://stackoverflow.com/q/21005268
tags question: http://stackoverflow.com/q/20994125
tags question: http://stackoverflow.com/q/20931337
tags question: http://stackoverflow.com/q/20907011
tags question: http://stackoverflow.com/q/20949618
tags question: http://stackoverflow.com/q/20972527
tags question: http://stackoverflow.com/q/20913283
tags question: http://stackoverflow.com/q/20987647

http://stackoverflow.com/a/20988682
has comment: http://stackoverflow.com/comment/31539238
has comment: http://stackoverflow.com/comment/31538364
has comment: http://stackoverflow.com/comment/31539096
has comment: http://stackoverflow.com/comment/31539533
answers question: http://stackoverflow.com/q/20988152
score: 3
has body: As mentioned that the date stored as 2013-01-10 00:00:00 is to be converted to 2013-01-10 23:59:59.999 and then take that as end date. MySql DATE_ADD() When you query your date time field, you can advance your endtime by one day as follows DATE_ADD('your_datetime_field', INTERVAL 1 DAY) OR Java code SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // rs is ResultSet reference long dt = rs.getTimestamp("your_datetime_field").getTime(); // pick calendar instance and set time Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(dt); // this will print `2013-01-10 00:00:00` System.out.println(sdf.format(calendar.getTime())); // advance the date by 1 day calendar.add(Calendar.Date, 1); // this is print `2013-01-11 00:00:00` System.out.println(sdf.format(calendar.getTime())); Now, you can compare with this Calendar object as well. Hope this helps.
has comment: http://stackoverflow.com/comment/31538941
has comment: http://stackoverflow.com/comment/31539562
has comment: http://stackoverflow.com/comment/31539607
has comment: http://stackoverflow.com/comment/31539371
downvote count: 1
type: Answer
upvote count: 4

http://stackoverflow.com/a/21017438
type: Answer
score: 1
upvote count: 1
has body: In my experience I have found POI very useful for reading Excel files, but quite time and memory consuming when it comes to generate them. I can offer you 3 options: 1) By the classes you use (HSSF*), I think you may be using an older version of POI. I would suggest you to switch to the latest version and see if there comes any improvement. With little code changes you can even get to a version of the code that generates both .xls and .xlsx formats, so you can profile both options (assuming you can generate any other format than .xls) -- EDITED: I have had recently the chance to test SXSSF performance and it has a great performance, both in terms of memory and speed 2) As someone else suggested, generating a .csv would be much faster, but you would lose any formatting (and that assuming you can generate a format other than .xls) 3) If you can use a format different from .xls, I suggest you have a look at the Excel XML Spreadsheet format. We have been using it for years, the downfall being that we had to work our own implementation of the format. However, if you are willing to invest a day or two implementing it, your implementation should be much more efficient than POI in time and memory use. http://msdn.microsoft.com/en-us/library/office/aa140066%28v=office.10%29.aspx
has comment: http://stackoverflow.com/comment/31590838
answers question: http://stackoverflow.com/q/21017231
downvote count: 0
has comment: http://stackoverflow.com/comment/39336542

http://stackoverflow.com/q/20888125
has body: I am using the animation class to make a simple animation, with only 2 frames. With animation, i can get the index, or texture region at the current time. if (!animation.isAnimationFinished(time)) time += Gdx.graphics.getDeltaTime(); else time = 0; But the problem is, that I can't load any texture, its width and height must be a power of 2, so i got a big 1024x1024 texture, that has the 2 images. With sprite.setTexture() i can only put a Texture, but animation.getframe returns a texture region. Is there a way to change the sprite texture with an animation? Also sprite.setTexture(animation.getKeyFrame(time).getTexture()); Does not work. This works sprite = new Sprite(animation.getKeyFrame(time)); But I don't think is the best idea... I think is slow can can make bugs.
tagged with: sprite
type: Question
tagged with: libgdx
has title: libgdx- changing the sprite texture with animation
score: 3
accepted answer: http://stackoverflow.com/a/20891587
downvote count: 0
answer count: 1
favorite count: 0
tagged with: animation
type: AnsweredQuestion
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/20891587

http://stackoverflow.com/comment/31509643
has text: It's not duplicate fabian. I have had read this thread before, but I would not like to call some special class or method, which will log data. Then annotation would be nonsense when static method can be called
score: 0
comment on: http://stackoverflow.com/q/20973396
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20908708
tagged with: arrays
tagged with: class
score: 0
answer count: 2
tagged with: abstract
has answer: http://stackoverflow.com/a/20908794
has answer: http://stackoverflow.com/a/20908889
has title: Adding strings to an Array in Abstract class A, from an extended class B in Java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31386829
has body: I'm writing a small program to demonstrate the factory design pattern. It's a food court application which serves different types of food like Chinese, Italian, Sushi etc. I've created an array in the abstract class below, and I'm trying to populate it by adding a string via an extended class. abstract public class FoodCourt { String name; //e.g. italian, chinese etc... static String [] dailySpecial = new String[10]; int idx = new Random().nextInt(dailySpecial.length); String random = (dailySpecial[idx]); public String getName() { return name; } public void takeOrder() { System.out.println("You ordered " + random + " from our list of Daily Specials"); } public void serve() { System.out.println(" -&gt; Serving " + random + " from our " + name + " menu"); //Serving Chow Mein from our Chinese menu } public void printList() { for (String name : dailySpecial) { System.out.println(name); } } } Extended class public class Chinese extends FoodCourt { public Chinese() { name = "Chinese"; String s = "Chicken Chow Mein"; dailySpecial[0] = s; } } Each extended class (there are 4) will add a special dish to the array but it is being output to the screen as follows: You ordered null from our list of Daily Specials -&gt; Serving null from our Chinese menu Chinese food served When it should be something like You ordered Chicken Chow Mein from our list of Daily Specials -&gt; Serving Chicken Chow Mein from our Chinese menu Chinese food served If anyone could help out and see why nothing is being added in that would be great. (If necessary I can post the rest of the classes).
tagged with: java
type: Question

http://stackoverflow.com/comment/31353744
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20890202
has text: The most likely problem is that all of the sub directories in the path MUST exist before you create the file. `FileWriter` will not do this. We need more detail, such as where are you saving the file? What is the value you pass to the method in peopledetails_file etc.

http://stackoverflow.com/comment/124667891
score: 0
has text: This only works for 4-digit integers.
comment on: http://stackoverflow.com/a/20947343
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/31469220
type: QuestionComment
has text: With my design it means a bit of additional code but this certainly is a working solution.
score: 0
comment on: http://stackoverflow.com/q/20951032
type: Comment

http://stackoverflow.com/q/20956152
tagged with: application-server
favorite count: 0
has title: Socket bindings in JBoss EAP 6.1
score: 2
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: jakarta-ee
has body: What is the difference between outbound-socket-binding and socket-binding? When should I use one over another? I guess there are differences but I am not able to find any documentation on it. Tried to read the XSD, but didn't find any interesting. &lt;socket-binding name="smtp-noreply" port="465" fixed-port="false"/&gt; &lt;outbound-socket-binding name="mail-smtp"&gt; &lt;remote-destination host="localhost" port="25"/&gt; &lt;/outbound-socket-binding&gt;
tagged with: jboss
downvote count: 0

http://stackoverflow.com/a/20998978
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 2
has body: Use this one: <?xml version="1.0" encoding="utf-8"?> <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:src="@drawable/ic_launcher" /> <ImageView android:id="@+id/imageView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_launcher" /> <ImageView android:id="@+id/imageView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_launcher" />
has comment: http://stackoverflow.com/comment/31556433
score: 2
has comment: http://stackoverflow.com/comment/31557055
accepted answer of: http://stackoverflow.com/q/20998436
has comment: http://stackoverflow.com/comment/31556352
answers question: http://stackoverflow.com/q/20998436

http://stackoverflow.com/comment/140035390
score: 0
has text: Not sure if this post has anything to do with the OP's question! But I think that's rubbish, `char` is a primitive type and (as all primitive) types is immutable. Perhaps what you meant to say was exactly that char is primitive and as such more performant (NTW project valhalla?) than String. No Comment on the String Pool however.
type: Comment
comment on: http://stackoverflow.com/a/20880763
type: AnswerComment

http://stackoverflow.com/a/20888276
answers question: http://stackoverflow.com/q/20888069
has comment: http://stackoverflow.com/comment/31349055
has body: As Bosko mentioned, you need to "lazy" load your images off the main UI thread. I find a great way to take away all the pain of doing this is to use a library like Picasso which makes it dead simple. It handles all of pitfalls you will encounter if you try to create a lazy loader yourself.
type: AcceptedAnswer
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/31349139
accepted answer of: http://stackoverflow.com/q/20888069

http://stackoverflow.com/comment/31396481
comment on: http://stackoverflow.com/a/20913315
score: 0
type: Comment
has text: Thinks @Mitesh ,,,,,,,
type: AnswerComment

http://stackoverflow.com/q/20936163
has answer: http://stackoverflow.com/a/20936183
score: 0
has answer: http://stackoverflow.com/a/20936323
tagged with: android
accepted answer: http://stackoverflow.com/a/20936323
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31439531
tagged with: java
has title: Export java file as external jar in android
answer count: 2
has body: how can i export one of my classes (non activity) and use it as external jar in my application. I need to do this because of reasons. I have tried to remove my package name from top of my class. Then via eclipse export as jar file and added to my projects. I got no errors in the code but when I ran the application it crashed with: E/AndroidRuntime(12762): FATAL EXCEPTION: main E/AndroidRuntime(12762): java.lang.Error: Unresolved compilation problem: E/AndroidRuntime(12762): The declared package "" does not match the expected package "com.myapp" The thing is I wish that this jar can be used in any other application and package
tagged with: jar
possible better answer: http://stackoverflow.com/a/20936183

http://stackoverflow.com/a/20855047
score: 0
has body: Add this code in your web.xml contextConfigLocation /WEB-INF/loginDispacher-servlet.xml And this ligne code in your loginDispacher-servlet. <context:annotation-config /> In the following share examples with spring mvc : link
type: Answer
answers question: http://stackoverflow.com/q/20851236
has comment: http://stackoverflow.com/comment/31285338

http://stackoverflow.com/q/20942291
has answer: http://stackoverflow.com/a/20942347
has comment: http://stackoverflow.com/comment/31453008
type: AnsweredQuestion
has body: Ok, so this question is mostly just related to: is there a better way to do this? I have a phonebook application, and you can add users to it, delete them, and such, with each person being assigned a distinct ID#. A Person class stores lastIDused as a static class variable. The phonebook class has a vector of Persons. My workaround thought is this: create a new non-static variable for the Person class, and upon serializing/saving, for the 1st element in the vector only, store the static variable's data into this new variable. Then, when de-serializing, re-set the static variable using the 1st Person's such-variable. Going back to my original question: is there a better/more-formal/proper way to do this?
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/20942347
has answer: http://stackoverflow.com/a/20942462
has title: Java serialization: static variables not serializable: workaround
possible better answer: http://stackoverflow.com/a/20942462
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/817853
tagged with: serialization
tagged with: static

http://stackoverflow.com/a/20851108
has comment: http://stackoverflow.com/comment/31278744
has comment: http://stackoverflow.com/comment/31278709
has comment: http://stackoverflow.com/comment/31278437
accepted answer of: http://stackoverflow.com/q/20851092
answers question: http://stackoverflow.com/q/20851092
score: 4
has comment: http://stackoverflow.com/comment/31278902
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has body: You probably want imageStatues.get(position) != null or something similar. Alternatively, if imageStatues.get(position) is supposed to be a Boolean, you are probably using a raw map and need to specify a generic parameter type in the declaration of imageStatues. You could also simply try casting imageStatues.get(position) to a Boolean.
type: Answer

http://stackoverflow.com/q/20878894
answer count: 5
has answer: http://stackoverflow.com/a/20878952
upvote count: 6
has comment: http://stackoverflow.com/comment/31330968
has answer: http://stackoverflow.com/a/20878919
has body: I know that the String can be converted to a long using Long.parseLong(String) method and Long(String) constructor. String str="12356"; Long myvar= Long.parseLong(str); Long myvar2 = new Long(str); Both of them gives same output. Value of myvar and myvar2 is same. I would like to know which one gives better performance and when to use parseLong and when to use new Long(String s).
score: 6
has title: Difference between Long.parseLong(String s) and new Long(String s)?
has comment: http://stackoverflow.com/comment/31331053
has comment: http://stackoverflow.com/comment/31331031
has answer: http://stackoverflow.com/a/20878917
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20878958
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/408661
accepted answer: http://stackoverflow.com/a/20878919
tagged with: long-integer
downvote count: 0
tagged with: string
has answer: http://stackoverflow.com/a/20879247
favorite count: 0
possible better answer: http://stackoverflow.com/a/20878952

http://stackoverflow.com/a/20998665
answers question: http://stackoverflow.com/q/20989015
score: 0
has body: 1) Make sure your pojo implements Serializable. 2) You can annotate the studentId as a NaturalId. @NaturalId @Column(name = "student_id") public Integer getStudentId() { return this.studentId; } And you can access it by: session.bySimpleNaturalId(StudentTestMapping.class) .load(studentId) 3) Your entity must have an id. You can add an auto incrementing identity column or as mentioned you can create a composite key with all the columns. Basic O/R Mapping
type: Answer

http://stackoverflow.com/a/20931939
accepted answer of: http://stackoverflow.com/q/20931859
has comment: http://stackoverflow.com/comment/31431748
type: Answer
has comment: http://stackoverflow.com/comment/31431699
upvote count: 3
answers question: http://stackoverflow.com/q/20931859
has comment: http://stackoverflow.com/comment/31431416
has comment: http://stackoverflow.com/comment/31431504
score: 3
has comment: http://stackoverflow.com/comment/31431561
has comment: http://stackoverflow.com/comment/31431454
has comment: http://stackoverflow.com/comment/31431475
has comment: http://stackoverflow.com/comment/31431490
has comment: http://stackoverflow.com/comment/31431380
has comment: http://stackoverflow.com/comment/31431249
has comment: http://stackoverflow.com/comment/31431527
has comment: http://stackoverflow.com/comment/31431523
has body: You can overcome this issue by inserting in the List every 2 lines reading. A description for this code is that: "Bold is the true case" Read the first line (count is 0) If (secondLine is false) ==> Save the line to CipherText variable, make secondLine = true Else If (secondLine is true) ==> Add to list (CipherText, line), make secondLine = false Read the second line (count is 1) If (secondLine is false) ==> Save the line to CipherText variable, make secondLine = true Else If (secondLine is true) ==> Add to list (CipherText, line), make secondLine = false String cipherText; boolean secondLine = false; String inFile = new File(firstArg).getAbsolutePath(); Path file = new File(inFile).toPath(); try { InputStream in = Files.newInputStream(file); BufferedReader reader = new BufferedReader(new InputStreamReader(in))) { String line = null; while ((line = reader.readLine()) != null) { if (!secondLine) //first line reading { cipherText = line; secondLine = true; } else if (secondLine) //second line reading { cipherKeyPairs.put(cipherText, line); secondLine = false; } } } catch (IOException x) { System.err.println(x); }
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31431331
has comment: http://stackoverflow.com/comment/31431446

http://stackoverflow.com/q/20909339
score: 1
favorite count: 0
type: Question
has title: How to print excel file from java?
has comment: http://stackoverflow.com/comment/31389111
answer count: 1
has comment: http://stackoverflow.com/comment/31477348
has body: First Question on the community! Let me explain a little the question. I have a user interface, that allows me to create an excel file. And I want to add at that ui the a "print Document" button. This button is supposed to allow the user to print that excel document. So what I need is a way to call the windows printing dialog for that file, so the user can print the file. I have read http://docs.oracle.com/javase/tutorial/2d/printing/printable.html, But I can not find the way of telling the printing dialog what file to print. Thanks in advance!
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/20911056
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31391892
has comment: http://stackoverflow.com/comment/31506618
tagged with: printing
has comment: http://stackoverflow.com/comment/31390072

http://stackoverflow.com/a/20965010
type: Answer
has body: You can create a custom action in another app. for example &lt;intent-filter&gt; &lt;action android:name="android.intent.action.run" /&gt; &lt;category android:name="android.intent.category.DEFAULT"/&gt; &lt;/intent-filter&gt; Then, in you app, you just need to use this action string Intent intent = new Intent("android.intent.action.run"); startActivity(intent);
answers question: http://stackoverflow.com/q/20964647
score: 0

http://stackoverflow.com/q/20864032
score: 0
tagged with: android
tagged with: sqlite
has answer: http://stackoverflow.com/a/20864092
accepted answer: http://stackoverflow.com/a/20864092
has title: getting " (1) no such column: _id10 " error
type: Question
type: AnsweredQuestion
tagged with: java
answer count: 1
has body: I'm trying to retrieve the data of a particulate row in a sqlite database . and trying to display it to on a EditText but I'm getting this error , Kindly help me in solving the error ! Thanks in advance :) here is the logcat data showing error 12-31 22:28:17.731: E/2.4(12285): 111111 12-31 22:28:17.741: E/2.5(12285): 111111 12-31 22:28:17.771: E/SQLiteLog(12285): (1) no such column: _id10 12-31 22:28:17.791: D/AndroidRuntime(12285): Shutting down VM here is the code : ( of the function getName , which is being used to retrieve the data of column 1 ) [getting error after log.e("2.5".... ) ] public String getName(long l) { // TODO Auto-generated method stub Log.e("2.4","111111"); String[] column = new String[]{KEY_ROWID, KEY_NAME, KEY_HOTNESS }; Log.e("2.5","111111"); Cursor c = ourDatabase.query(DATABASE_TABLE, column, KEY_ROWID + "" + l, null, null, null, null); Log.e("2.6","111111"); if(c != null) { Log.e("2.7","111111"); c.moveToFirst(); Log.e("2.8","111111"); String name = c.getString(1); Log.e("2.9","111111"); return name; } return null; } public String getHotness(long l) { Log.e("3.1","111111"); // TODO Auto-generated method stub String[] column = new String[]{KEY_ROWID, KEY_NAME, KEY_HOTNESS }; Log.e("3.2","111111"); Cursor c = ourDatabase.query(DATABASE_TABLE, column, KEY_ROWID + "" + l, null, null, null, null); Log.e("3.3","111111"); if(c != null) { Log.e("3.4","111111"); c.moveToFirst(); Log.e("3.5","111111"); String hotness = c.getString(2); Log.e("3.6","111111"); return hotness; } return null; } And is the code of the activity which is calling this function case R.id.bgetInfo: String s = sqlRow.getText().toString(); long l = Long.parseLong(s); HotOrNot hon = new HotOrNot(this); hon.open(); String returnedName = hon.getName(l); String returnedHotness = hon.getHotness(l); hon.close(); Log.e("1.2","111111"); sqlName.setText(returnedName); Log.e("1.3","111111"); sqlHotness.setText(returnedHotness); Log.e("1.4","111111"); break;

http://stackoverflow.com/comment/31429425
has text: @mplungjan Hi, thanks for the comment, yes i am checking the blank or empty before passing it to ajax and if its blank or empty than i am calling event.preventDefault(), the problem is both controller submit method and ajax call for controller validateResult method is getting invoke simultaneously.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20930752
score: 0

http://stackoverflow.com/q/20993426
has comment: http://stackoverflow.com/comment/31546701
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31546496
upvote count: 1
has title: Removing class-wide object instantiations from constructor in class file
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31546552
downvote count: 0
favorite count: 0
has body: I'm working on a project involving a memory analysis tool for Java. The tool works on class files and gives an upper bound for memory consumption for a given class. Currently, the tool isn't perfect, for example in the following code: class Example { public Object o; public Example() { o = new Object(); } } The space required by the Object o is counted double, because of the instantiation in the constructor. Currently, the user is required to manually remove the class-wide object instantiations from the constructor in order to get a more accurate upper bound of memory required. Since we don't have the possibility to make changes to the analysis tool, we'd like to automate the process of stripping the object instantiations from constructors. However, since this would happen right before the tool does its magic, it happens on classfile-level. How can we achieve this? I've been looking at ASM. However, I haven't found a way to achieve what I want. All help is appreciated.

http://stackoverflow.com/comment/31395727
type: Comment
type: AnswerComment
has text: Also TalhaQ, i did copy the code as it was originally, so i left out any additions you made, and it worked. it really must have been the order of operations that prevented R.java from updating properly.
score: 0
comment on: http://stackoverflow.com/a/20898726

http://stackoverflow.com/q/20873021
has comment: http://stackoverflow.com/comment/31320581
tagged with: key-bindings
type: AnsweredQuestion
tagged with: keyevent
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/12041277
has comment: http://stackoverflow.com/comment/31320773
has comment: http://stackoverflow.com/comment/31320735
type: Question
has title: Java: Call original key action after override
has comment: http://stackoverflow.com/comment/31320429
accepted answer: http://stackoverflow.com/a/20873262
answer count: 1
has comment: http://stackoverflow.com/comment/31321234
favorite count: 0
has comment: http://stackoverflow.com/comment/31321263
has comment: http://stackoverflow.com/comment/31320323
has body: For a Text-Editor I'm developing I have overriden the default Action to the HOME-key. However in some cases I would still like to make use of the original HOME action (to jump to the beginning of the line). How can I fire this original action? Example-code: //Add the homekey and its action to the text-editor: Key homeKey = KeyStroke.getKeyStroke("HOME"); editor.getInputMap().put(homeKey, new HomeCommand()); ... private class HomeCommand extends AbstractAction { @Override public void actionPerformed(ActionEvent ev) { if(doSomethingSpecial()) performSpecialHomeAction(); else performRegularHomeAction(); //How to get the regular action?? } } Note: I'm looking for the elegant solution, I'd prefer not to write my own version of the HomeKey-Action. I have googled and tried several approaches, none of them worked: Action a = area.getActionMap().get(KeyStroke.getKeyStroke("HOME")); Resulted in null. Simulate pressing the Home Key via the Robot class. That however just fires my own custom Action.
tagged with: action
has comment: http://stackoverflow.com/comment/31320723
upvote count: 2
tagged with: swing
has answer: http://stackoverflow.com/a/20873262
downvote count: 1

http://stackoverflow.com/comment/31380086
comment on: http://stackoverflow.com/a/20903371
has text: Thank you, your help was precious!
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31460700
type: QuestionComment
score: 0
has text: sorry for that ,i think problem on messenger server
comment on: http://stackoverflow.com/q/20946493
type: Comment

http://stackoverflow.com/comment/31309135
type: Comment
has text: This could be a limitation of SDN simple mapping, you could try advanced mapping, it's more flexible and you don't need to declare fetch strategies at all. More on this at [this link](http://docs.spring.io/spring-data/data-neo4j/docs/2.3.3.RELEASE/reference/html/programming-model.html#reference_mapping).
type: QuestionComment
comment on: http://stackoverflow.com/q/20867175
score: 1

http://stackoverflow.com/comment/31375782
type: QuestionComment
has text: I'll post an SSCCE, but based on what I wrote above - would you say that that structure should work in the game? Or is the thread/swing-timer thing critical?
comment on: http://stackoverflow.com/q/20902662
score: 0
type: Comment

http://stackoverflow.com/q/20920448
has answer: http://stackoverflow.com/a/20920517
has answer: http://stackoverflow.com/a/20920586
type: UnansweredQuestion
tagged with: string-formatting
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31409063
has body: I am trying to convert an array that holds string values into integer values, I have used the parseInt function but get an error message (java.lang.NullPointerException) at the point of execution. My code snippet is below public int NumberOfColumns; public int[][]CMax,CMin; for (int i = 1; i &lt; datas.length; i++) { for (int j = 1; j &lt; NumberOfColumns+1; j++) { CMax[i][j] = Integer.parseInt(datas[i][j]); System.out.println(CMax[i][j]); System.out.println(datas[i][j]); } } I have a feeling that I am getting this error message because my data array contains some characters like "-". Examples of some values stored in my data array include 0-31, 8-*, &lt;4-7>. How can I successfully resolve this problem? Also, I need help on how to extract only the integer numbers out of these strings (e.g. 0-31). I will like to store the upper limit (e.g. 31) into a separate integer array and the lower limit(e.g. 0) into another integer array. Below is an extract of some of the values in my data array. &lt;0-15&gt; &lt;0-7&gt; &lt;0-15&gt; &lt;0-7&gt; &lt;0-15&gt; &lt;0-7&gt; &lt;32-47&gt; &lt;0-7&gt; &lt;32-47&gt; &lt;0-7&gt;
tagged with: string-conversion
has comment: http://stackoverflow.com/comment/31409040
score: 0
answer count: 2
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/31409093
tagged with: string
has title: Complex String Conversion to integer

http://stackoverflow.com/a/20901020
downvote count: 0
type: Answer
upvote count: 3
has body: I would go for an ScheduledExecutorService. Create a thread and as long as isOverloaded() returns true re schedule the execution.
accepted answer of: http://stackoverflow.com/q/20900885
answers question: http://stackoverflow.com/q/20900885
score: 3
type: AcceptedAnswer

http://stackoverflow.com/comment/42482648
type: Comment
comment on: http://stackoverflow.com/q/20904131
type: QuestionComment
has text: @Vigneshwaran, have you made any progress with this?
score: 0

http://stackoverflow.com/q/20937849
type: UnansweredQuestion
tagged with: java
has body: I am starting work with ESAPI but I have a problem. I am trying to create an example rule (Validator.Single=[A-Z]$). I validate if a String only have an uppercase character. I put Validator.Single=[A-Z]$ in the validator.properties file but when I use in the code: System.out.println(v.isValidInput("Single", "A", "Single", 1, true)); The output tells me SecurityConfiguration for Validator.Single not found in ESAPI.properties. Using default: false And returns me a false, against of a true, because the "A" is a valid letter. Anyone knows what more I nedd to do? Or I make the rule bad? Thanks for your responses.
upvote count: 1
has comment: http://stackoverflow.com/comment/41493893
has title: Create rule in ESAPI validator
type: Question
has comment: http://stackoverflow.com/comment/42137183
has answer: http://stackoverflow.com/a/21235688
has answer: http://stackoverflow.com/a/26424712
answer count: 3
tagged with: validation
has comment: http://stackoverflow.com/comment/42137239
downvote count: 0
score: 1
favorite count: 0
tagged with: esapi
has answer: http://stackoverflow.com/a/65738964

http://stackoverflow.com/comment/31356881
type: Comment
comment on: http://stackoverflow.com/a/20892472
type: AnswerComment
has text: I haven't downvoted, but you should put all that, in detail, in the answer.
score: 0

http://stackoverflow.com/q/20887829
answer count: 4
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/20887964
tagged with: java
tagged with: error-handling
accepted answer: http://stackoverflow.com/a/20887888
type: Question
tagged with: try-catch
possible better answer: http://stackoverflow.com/a/20887964
has answer: http://stackoverflow.com/a/34228892
has answer: http://stackoverflow.com/a/42113108
has title: System.exit(1) and return
has answer: http://stackoverflow.com/a/20887888
score: 12
favorite count: 0
upvote count: 12
has body: import java.io.FileNotFoundException; import java.util.Formatter; import java.util.FormatterClosedException; import java.util.NoSuchElementException; import java.util.Scanner; public class CreateTextFile { private Formatter formatter; public void openFile() { try { formatter = new Formatter("clients.txt"); } catch (SecurityException securityException) { System.err.println("You do not have permission to access this file"); System.exit(1); } catch (FileNotFoundException fileNotFoundException) { System.err.println("Error opening or creating the file"); System.exit(1); } } public void addRecords() { AccountRecord accountRecord = new AccountRecord(); Scanner scanner = new Scanner(System.in); System.out.printf("%s%n%s%n%s%n%s%n", "To terminate input, type the end-of-file indicator", "when you are prompted to enter input", "On Unix/Linux/Mac OS X type &lt;control&gt; d then press Enter", "On Windows type &lt;ctrl&gt; z then press Enter"); while (scanner.hasNext()) { try { accountRecord.setAccountNumber(scanner.nextInt()); accountRecord.setFirstName(scanner.next()); accountRecord.setLastName(scanner.next()); accountRecord.setBalance(scanner.nextDouble()); if (accountRecord.getAccountNumber() &gt; 0) formatter.format("%d %s %s %,.2f%n", accountRecord.getAccountNumber(), accountRecord.getFirstName(), accountRecord.getLastName(), accountRecord.getBalance()); else System.out.println("Account number must be greater than 0"); } catch (FormatterClosedException formatterClosedException) { System.err.println("Error writing to file"); return; } catch (NoSuchElementException noSuchElementException) { System.err.println("Invalid input. Try again"); scanner.nextLine(); } System.out.printf("%s %s%n%s", "Enter account number (&gt;0),", "first name, last name and balance.", "?"); } scanner.close(); } public void closeFile() { if (formatter != null) formatter.close(); } } I was just wondering why in openFile() the catch blocks are terminated with System.exit() and the catch blocks in addRec…
linked to: http://stackoverflow.com/q/3715967

http://stackoverflow.com/comment/31413613
score: 0
comment on: http://stackoverflow.com/q/20922777
has text: Why do you want to use a regular expression for this???
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20962964
tagged with: ghostdriver
answer count: 0
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: hadoop
has body: I have the following method that I run from my map task in a multithreaded execution , however this works fine in a standalone mod e, but when I runt this in Hadoop YARN it runs out of the physical memory of 1GB and the virtual memory also shoots up. I need to know if I am doing anything wrong from a programming perspective, I think I am closing all the streams that I am opening ASAP , so I see no reason for a memory leak to happen . Please advise. Thanks. public static void manageTheCurrentURL(String url) { logger.trace("Entering the method manageTheCurrentURL "); InputStream stream = null; InputStream is = null; ByteArrayOutputStream out = null; WebDriver driver = null; try { if (StringUtils.isNotBlank(url)) { caps.setJavascriptEnabled(true); // not really needed: JS // enabled by default caps.setCapability( PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, "/usr/local/bin/phantomjs"); // Launch driver (will take care and ownership of the phantomjs // process) driver = new PhantomJSDriver(caps); driver.get(url); String htmlContent = driver.getPageSource(); if (htmlContent != null) { is = new ByteArrayInputStream(htmlContent.getBytes()); ByteArrayDocumentSource byteArrayDocumentSource = new ByteArrayDocumentSource( is, url, "text/html"); Any23 runner = new Any23(); runner.setHTTPUserAgent("test-user-agent"); out = new ByteArrayOutputStream(); TripleHandler handler = new NTriplesWriter(out); try { runner.extract(byteArrayDocumentSource, handler); } catch (ExtractionException e) { } finally { if (driver != null) { driver.quit(); //driver.close(); } try { handler.close(); } catch (TripleHandlerException e) { } if (is != null) { try { is.close(); } catch (IOException e) { } } } if (out != null) { stream = new ByteArrayInputStream(out.toByteArray()); Iterator&lt;Node[]&gt; it = new DeltaParser(stream); if (it != null) { SolrCallbackForNXParser callback = new SolrCallbackForNXParser( url); callback.startStory(); while (it.hasNext()) { Node[] abc = it.next(); cal…
upvote count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: hadoop-yarn
tagged with: selenium-webdriver
has title: Hadoop YARN Map Task running out of physical and virtual memory

http://stackoverflow.com/a/20952292
score: 5
accepted answer of: http://stackoverflow.com/q/20952230
has body: Yes it will help you. An BigInteger can be as big as you want. Till there is not enough RAM. With BigInteger bigInt = BigInteger.valueOf(long); you can convert the Long to an BigInteger. And an BigInteger is immutable. So if you divide it like this bigInt = bigInt.divide(BigInteger.valueOf(200)); You have to reassign it. A more precise option would be the method BigInteger.divideAndRemainder().
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20952230
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/31471327
downvote count: 0
has comment: http://stackoverflow.com/comment/31470409

http://stackoverflow.com/a/20969556
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20940814
has body: My souspicioun would be that "OneToOne" means "OneToOne" excluding the possibility of "OneToZero" if you don't set Optional to true like this: @OneToOne(optional=true) But just a guess.. I'm not sure
downvote count: 0

http://stackoverflow.com/q/20982449
tagged with: manifest
favorite count: 0
type: Question
tagged with: android
has body: I am new to android and I am having a minor problem installing the app. When installing two instances appear on my device, One instance goes to MainActivity (as it should) the other goes directly to the nWiFiScans Activity when clicked. i know its a problem in my manifest, but i am just not sure how to properly declare a new activity in my manifest. Any advice/help/angry comment are welcome.... The following is my AndroidManifest <?xml version="1.0" encoding="utf-8"?> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="18" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
accepted answer: http://stackoverflow.com/a/20982479
has comment: http://stackoverflow.com/comment/31526894
upvote count: 2
has title: TWO instances of my android app being installed AT ONCE! What would cause this?
has comment: http://stackoverflow.com/comment/31526790
tagged with: android-manifest
answer count: 1
tagged with: java
has answer: http://stackoverflow.com/a/20982479
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31526872
downvote count: 0

http://stackoverflow.com/a/20915210
upvote count: 2
downvote count: 0
has body: Here is something that might help. Use the root privileges. if you have .bin then simply add the execution permission to the bin file. chmod a+x jdk*.bin next step is to run the .bin file which is simply ./jdk*.bin in the location you want to install. you are done.
has comment: http://stackoverflow.com/comment/31403503
type: Answer
answers question: http://stackoverflow.com/q/20901442
score: 2

http://stackoverflow.com/q/20871618
linked to: http://stackoverflow.com/q/4096973
has comment: http://stackoverflow.com/comment/31342226
has comment: http://stackoverflow.com/comment/31318259
has answer: http://stackoverflow.com/a/20885101
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/mp3
has body: Problem I want to display file properties like title and author of an mp3 from: I have tried using http://javamusictag.sourceforge.net/ but it doesnt actually get the information input into the properties details (see picture). How do I get that information such as the 'Test Song' by 'John Smith'? Of course I have the file available on java: File file = new File(path); Thanks in anticipation! If you need more info just ask. ps: I looked at this and it doesn't work or I don't understand it (summary question)
type: Question
has title: Get the title attribute from an mp3 file
has comment: http://stackoverflow.com/comment/31317440
tagged with: properties
score: 0
has comment: http://stackoverflow.com/comment/31317936
tagged with: java
has comment: http://stackoverflow.com/comment/31317909
answer count: 1
has comment: http://stackoverflow.com/comment/31319535
has comment: http://stackoverflow.com/comment/31319899

http://stackoverflow.com/comment/31541420
type: Comment
has text: session-timeout value is define is web.xml. So in this case how could i read it from java script, so i can keep track of when user idle for 2 minits before session-timeout value and prompt the dialogue.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20990205

http://stackoverflow.com/a/20939307
has comment: http://stackoverflow.com/comment/31446305
accepted answer of: http://stackoverflow.com/q/20938976
answers question: http://stackoverflow.com/q/20938976
has comment: http://stackoverflow.com/comment/31447511
has comment: http://stackoverflow.com/comment/31445916
type: AcceptedAnswer
downvote count: 0
has body: Any operating system can swap or page memory, but I don't see why it concerns you. The 'guaranteed life' of a file-scoped variable in C is the life of the process.
has comment: http://stackoverflow.com/comment/31446419
has comment: http://stackoverflow.com/comment/31445635
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/31446084
upvote count: 1

http://stackoverflow.com/comment/31575642
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21008761
has text: @WillBD That's what I originally had and making the return wrong values. Once 1 Exception is thrown the program should stop.
type: AnswerComment

http://stackoverflow.com/a/21002605
has body: you need to specify -Djavax.net.ssl.trustStore="&lt;ketstore path&gt;" in VM arguments.
type: Answer
answers question: http://stackoverflow.com/q/21000682
score: 0

http://stackoverflow.com/comment/60631307
type: QuestionComment
has text: @GregHewgill When I had this question and searched Google, it brought me here. I'm sure glad Brutal_JL asked this question and other people actually answered it! :)
type: Comment
score: 0
comment on: http://stackoverflow.com/q/20917617

http://stackoverflow.com/comment/31446779
comment on: http://stackoverflow.com/a/20939692
type: Comment
has text: That's not related to this problem. Just initialise the next for loop with `int i=count-1` instead of `int i=count`. The value of count is correct, but the last element of an array/etc is accessed as `count-1`. Remember you're using 0-based indexing.
type: AnswerComment
score: 0

http://stackoverflow.com/a/21012475
answers question: http://stackoverflow.com/q/21012360
score: 5
accepted answer of: http://stackoverflow.com/q/21012360
type: AcceptedAnswer
upvote count: 5
has body: Can ArrayList's capacity larger than the largest int number in Java(2^32)? No. Because it's array-backed, it can't be larger than 2^31-1. This applies to all Collections if you want the size() and toArray() methods to work. You'll need to store lists of lists, but I bet there's a library that can do it. I haven't used that part of it, but Fastutil has big data structures in addition to its primitive data structures.
type: Answer
downvote count: 0

http://stackoverflow.com/q/20947747
downvote count: 2
has comment: http://stackoverflow.com/comment/31460859
answer count: 3
tagged with: google-maps-api-2
favorite count: 0
tagged with: android-studio
has comment: http://stackoverflow.com/comment/31520730
possible better answer: http://stackoverflow.com/a/20947840
tagged with: android
has title: Android Studio: GoogleMaps can not load
has answer: http://stackoverflow.com/a/44241409
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/31461064
tagged with: java
has comment: http://stackoverflow.com/comment/31461350
type: Question
has answer: http://stackoverflow.com/a/20947840
score: -2
has body: I have tryed to add my Android App, which I develope with Android Studio 0.4.0, a GoogleMap with the API v2. I have downloaded with the Sdk-Manager the GooglePlayServices Packages. But if I start the App in the Emulator, it crashes with this message: 01-06 05:07:25.214 1137-1137/com.abc.example E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.abc.example, PID: 1137 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.abc.example/com.abc.example.MainActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class fragment at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2176) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226) at android.app.ActivityThread.access$700(ActivityThread.java:135) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4998) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593) at dalvik.system.NativeStart.main(Native Method) Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class fragment at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713) at android.view.LayoutInflater.inflate(LayoutInflater.java:469) at android.view.LayoutInflater.inflate(LayoutInflater.java:397) at android.view.LayoutInflater.inflate(LayoutInflater.java:353) at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290) at android.app.Activity.setContentView(Activity.java:1928) at com.gpspointsorg.gpspoints.MainActivity.onCreate(MainActivity.java:19) at android.app.Activity.performCreate(Activity.java:5243) at android.app.Instrumentation…
has answer: http://stackoverflow.com/a/20947842
accepted answer: http://stackoverflow.com/a/20947842

http://stackoverflow.com/q/20991567
upvote count: 1
has comment: http://stackoverflow.com/comment/31555101
favorite count: 0
has title: Not able to configure EhCache for hibernate 4.1.1 as it throws " net/sf/ehcache/CacheException"
tagged with: ehcache
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate
has body: org.hibernate.cache.ehcache.EhCacheRegionFactory true true These are the properties i defined in hibernate.cfg.xml. When I used the similar way in hibernate 3 versions it worked but in 4.1.1 hibernate it is throwing " net/sf/ehcache/CacheException". I have included hibernate-ehcache-4.1.1 jar also. I even tried adding the ehcache 2.8 jar. Still each addition adds to the list of errors. Please help me. The stacktrace is below... java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389) at java.lang.Class.getConstructor0(Class.java:2699) at java.lang.Class.getConstructor(Class.java:1657) at org.hibernate.cfg.SettingsFactory.createRegionFactory(SettingsFactory.java:386) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:251) at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2273) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2269) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1738) at com.gau.dbaccess.HibernateUtilities.<clinit>(HibernateUtilities.java:31) at com.gau.dbaccess.ComponentsDetailsAccess.resetOnlinePsdLockAfterServerStart(ComponentsDetailsAccess.java:3503) at com.gau.controller.ApplicationContextController.contextInitialized(ApplicationContextController.java:132) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:657) at org.apache.catalina.startu…
tagged with: caching
type: Question
answer count: 1
tagged with: database
has comment: http://stackoverflow.com/comment/31542836
has answer: http://stackoverflow.com/a/20992942

http://stackoverflow.com/comment/31520360
type: QuestionComment
has text: Same thing happens in http://imageresizenow.in/split-image-equal-pieces/
comment on: http://stackoverflow.com/q/20979024
score: 0
type: Comment

http://stackoverflow.com/q/20993382
has answer: http://stackoverflow.com/a/20993596
downvote count: 2
possible better answer: http://stackoverflow.com/a/20993535
type: Question
tagged with: java
upvote count: 2
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/20993433
accepted answer: http://stackoverflow.com/a/20993433
linked to: http://stackoverflow.com/q/20995493
has answer: http://stackoverflow.com/a/20993535
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/31546585
type: AnsweredQuestion
has title: Create single instance by extending Application?
has body: I want an array of string to be available in 3 different activities and I want the changes done in any activity to be reflected in all the 3 activities. So I came across the singleton and application class patterns. Somehow I prefer the application class pattern. I referred to this and this. Still I am unsure how can I create a single instance of the variable. I have a array list of strings. How can I create a single instance of it?

http://stackoverflow.com/q/20922058
has answer: http://stackoverflow.com/a/20922083
favorite count: 0
upvote count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/40480
tagged with: parameter-passing
type: Question
tagged with: java
has body: Please have a look at the code below : public class SampleClass{ String name; public SampleClass(){ } public void setName(String s){ name = s; } public String getName() { return name; } public static void main(String d[]){ PojoClass p = new PojoClass(); SampleClass s = new SampleClass(); s.setName("jack"); System.out.println(s.getName()); p.setSample(s); System.out.println(p.getSample().getName()); s.setName("Fgk"); System.out.println(p.getSample().getName()); p.recMod(s); System.out.println(p.getSample().getName()); p.changeVal(s); System.out.println(p.getSample().getName()); } } class PojoClass{ SampleClass s; public void setSample(SampleClass d){ s=d; } public SampleClass getSample() { return s; } public void recMod(SampleClass s){ SampleClass g = new SampleClass(); s=g; //g.setName("FGH"); s.setName("hjk"); } public void changeVal(SampleClass s){ s.setName("hjkjkl;k;k"); } } I am trying to run this code but unable to get why we get the output as Fgk when we call recMod() method. Also if I uncomment g.setName("FGH") then also the output remains the same.
score: -1
answer count: 1
duplicate of: http://stackoverflow.com/q/40480
has title: expalin output of the below java program
downvote count: 1

http://stackoverflow.com/comment/31377914
comment on: http://stackoverflow.com/a/20903854
score: 2
type: AnswerComment
has text: Ok, there is no problem. you can easily do this. First write your background task code inside doInBackground() method and after that in the last you can use this or you can also write sharedpreference code inside onPostExecute() method.
type: Comment

http://stackoverflow.com/a/20895689
has body: The problem is thread in Server class tries to unlock but has not lock the Lock lock.unlock(); Please see ReentrantLock documentation where is clearly stated: If the current thread is not the holder of this lock then IllegalMonitorStateException is thrown.
has comment: http://stackoverflow.com/comment/31378227
type: Answer
accepted answer of: http://stackoverflow.com/q/20894516
answers question: http://stackoverflow.com/q/20894516
has comment: http://stackoverflow.com/comment/31371895
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/20901796
has comment: http://stackoverflow.com/comment/31374368
has comment: http://stackoverflow.com/comment/31375585
possible better answer: http://stackoverflow.com/a/20902037
has body: How is the new Handler(clientSocket); instantiated without an object?. Can somebody give some insight? public class Server1 { public static void main(String[] args) { try { ServerSocket serverSocket = new ServerSocket(15897); while (true) { Socket clientSocket = serverSocket.accept(); new Handler(clientSocket); } } catch (IOException e) { System.out.println("problem here 1"); } } } class Handler implements Runnable { int red; int reads, r; Socket clientSocket; Handler(Socket s) { this.clientSocket = s; new Thread(this).start(); } public void run(){ BufferedReader bufferedReader; try { bufferedReader = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); String inputLine = bufferedReader.readLine();
has answer: http://stackoverflow.com/a/20902037
score: 0
has answer: http://stackoverflow.com/a/20902202
answer count: 3
has answer: http://stackoverflow.com/a/20902113
has title: Threads and Handlers in server socket
tagged with: sockets
accepted answer: http://stackoverflow.com/a/20902202
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31375767
tagged with: java
tagged with: multithreading
type: Question

http://stackoverflow.com/q/20874204
has comment: http://stackoverflow.com/comment/31322762
has answer: http://stackoverflow.com/a/20874562
answer count: 1
has body: This is somewhat of a mess. I am getting an error when my remote object on the server tries to access other objects on the server. I think that what is happening is that the client is instantiating its own object of the remote implementation class, but I really know very little about this. Here's the error (I am really sorry about the assert message; I assumed no one else would read this): Exception in thread "AWT-EventQueue-0" java.lang.AssertionError: WTF? at com.eotg.WebInterface.GlobalNetIO.registerAccount(GlobalNetIO.java:123) at com.eotg.Client.ClientIO.registerAccount(ClientIO.java:92) at com.eotg.Client.GUI.actionPerformed(GUI.java:260) 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.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$200(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) a…
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/31323094
tagged with: rmi
tagged with: java
type: Question
has title: RMI Complicated Issues
tagged with: codebase

http://stackoverflow.com/a/20978642
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20978161
has body: You're going to run into security problems as pointed out in the comments. Options 1 Create a job that retrieves the data from the external URL and loads it into your own server side database. You would then need a server side servlet (perhaps a REST service) on the same host that loaded your applet to retrieve the data from your database. Options 2 Server side servlet that retrieves the data from the remote URL and pipes it to the HTTP response, this way no load job or database is needed. The only other option is setting up a reverse proxy to bypass the same origin policy which is a terrible hacky idea.
downvote count: 0
type: Answer

http://stackoverflow.com/a/20871901
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20869819
answers question: http://stackoverflow.com/q/20869819
type: Answer
has body: Check with your firewall setting.

http://stackoverflow.com/q/20952464
tagged with: blocking
type: UnansweredQuestion
has body: let's say some blocking I/O is done in Java such as a long running db query. Is there in general a way in Java that some Java database driver can tell the JVM scheduler that the call has left the JVM and is now being processed by some external system? The JVM could then assign the thread that served the db query for some other operation until the reply from the db has arrived. This way the blocking db query would effectively become non-blocking. Just wonder whether this can be done on the JVM in general. I do Java for many years now, but I admittedly don't know what the Java scheduler is doing in such a situation.
upvote count: 6
has answer: http://stackoverflow.com/a/20953023
tagged with: java
tagged with: multithreading
score: 6
linked to: http://stackoverflow.com/q/17953269
type: Question
has title: Are DB queries initiated from Java always blocking I/O?
tagged with: scheduling
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/20952546
has answer: http://stackoverflow.com/a/20953246
favorite count: 0

http://stackoverflow.com/comment/31775056
score: 0
has text: If you plan to use XML serialization i'd suggest JAXB
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20972877

http://stackoverflow.com/q/20868082
upvote count: 1
tagged with: baseadapter
favorite count: 0
has comment: http://stackoverflow.com/comment/31310472
tagged with: arraylist
has comment: http://stackoverflow.com/comment/31313469
linked to: http://stackoverflow.com/q/978324
tagged with: android
score: -3
downvote count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20868107
possible better answer: http://stackoverflow.com/a/20868112
has answer: http://stackoverflow.com/a/20868112
type: Question
has title: What does the null ? 0 and null ? null mean in android?
tagged with: java
has comment: http://stackoverflow.com/comment/31310600
answer count: 3
has body: I have see the following code , but I don't know what it mean. public class FileListAdapter extends BaseAdapter { private Context mContext; private LayoutInflater mInflater ; private ArrayList&lt;FileNode&gt; mFileList ; private Map&lt;Integer, Boolean&gt; mSelectMap = new HashMap&lt;Integer, Boolean&gt;(); ． ． ． @Override public int getCount() { return mFileList == null ? 0 : mFileList.size() ; } @Override public Object getItem(int position) { return mFileList == null ? null : mFileList.get(position) ; } } First Question What are the mFileList == null ? 0 : mFileList.size(); and mFileList == null ? null : mFileList.get(position); mean ?? Second Question If I want to modify the code in the above from type object to int , how to do ? from @Override public Object getItem(int position) { return mFileList == null ? null : mFileList.get(position) ; } To @Override public Integer getItem(int position) { return ??? //what should I return for? } Does somebody can help me to answer these two question ? Thanks inadvance.
has answer: http://stackoverflow.com/a/20868102
accepted answer: http://stackoverflow.com/a/20868102

swing
tags question: http://stackoverflow.com/q/20864431
tags question: http://stackoverflow.com/q/20954170
tags question: http://stackoverflow.com/q/20939759
tags question: http://stackoverflow.com/q/21014029
tags question: http://stackoverflow.com/q/21007061
tags question: http://stackoverflow.com/q/20858109
tags question: http://stackoverflow.com/q/21018083
tags question: http://stackoverflow.com/q/20902662
tags question: http://stackoverflow.com/q/20972412
tags question: http://stackoverflow.com/q/20959053
tags question: http://stackoverflow.com/q/20916867
tags question: http://stackoverflow.com/q/20986525
tags question: http://stackoverflow.com/q/20889887
tags question: http://stackoverflow.com/q/20930443
tags question: http://stackoverflow.com/q/20931994
tags question: http://stackoverflow.com/q/20998762
tags question: http://stackoverflow.com/q/20895621
tags question: http://stackoverflow.com/q/20929618
tags question: http://stackoverflow.com/q/20863860
tags question: http://stackoverflow.com/q/20927902
tags question: http://stackoverflow.com/q/20897726
tags question: http://stackoverflow.com/q/20913632
tags question: http://stackoverflow.com/q/20865690
tags question: http://stackoverflow.com/q/20884464
tags question: http://stackoverflow.com/q/20969877
tags question: http://stackoverflow.com/q/20928680
tags question: http://stackoverflow.com/q/20984503
tags question: http://stackoverflow.com/q/20925109
tags question: http://stackoverflow.com/q/20940913
tags question: http://stackoverflow.com/q/20968499
tags question: http://stackoverflow.com/q/20900726
tags question: http://stackoverflow.com/q/20861588
tags question: http://stackoverflow.com/q/20962007
tags question: http://stackoverflow.com/q/21012751
tags question: http://stackoverflow.com/q/20902932
tags question: http://stackoverflow.com/q/20965175
tags question: http://stackoverflow.com/q/20891355
tags question: http://stackoverflow.com/q/21002730
tags question: http://stackoverflow.com/q/20943327
tags question: http://stackoverflow.com/q/20965340
tags question: http://stackoverflow.com/q/21006776
tags question: http://stackoverflow.com/q/20928163
tags question: http://stackoverflow.com/q/20920181
tags question: http://stackoverflow.com/q/20920237
tags question: http://stackoverflow.com/q/20967741
tags question: http://stackoverflow.com/q/20995141
tags question: http://stackoverflow.com/q/20972742
tags question: http://stackoverflow.com/q/20923809
tags question: http://stackoverflow.com/q/20865824
tags question: http://stackoverflow.com/q/20892336
tags question: http://stackoverflow.com/q/21000998
tags question: http://stackoverflow.com/q/20916720
tags question: http://stackoverflow.com/q/20899532
tags question: http://stackoverflow.com/q/20916268
tags question: http://stackoverflow.com/q/20898619
tags question: http://stackoverflow.com/q/20985622
tags question: http://stackoverflow.com/q/20905810
tags question: http://stackoverflow.com/q/20950106
tags question: http://stackoverflow.com/q/20985239
tags question: http://stackoverflow.com/q/20975592
tags question: http://stackoverflow.com/q/20932764
tags question: http://stackoverflow.com/q/20952058
tags question: http://stackoverflow.com/q/20873255
tags question: http://stackoverflow.com/q/20868677
tags question: http://stackoverflow.com/q/20858149
tags question: http://stackoverflow.com/q/20876121
tags question: http://stackoverflow.com/q/20980975
tags question: http://stackoverflow.com/q/20887317
tags question: http://stackoverflow.com/q/20938806
tags question: http://stackoverflow.com/q/20985305
tags question: http://stackoverflow.com/q/20910597
tags question: http://stackoverflow.com/q/21010609
tags question: http://stackoverflow.com/q/20936277
tags question: http://stackoverflow.com/q/20940056
tags question: http://stackoverflow.com/q/21010464
tags question: http://stackoverflow.com/q/20872118
tags question: http://stackoverflow.com/q/20874656
tags question: http://stackoverflow.com/q/20872390
tags question: http://stackoverflow.com/q/20873021
tags question: http://stackoverflow.com/q/20940921

http://stackoverflow.com/comment/47635156
score: 1
has text: figured out - http://stackoverflow.com/questions/11189708/is-it-possible-to-tell-intellij-idea-to-automatically-invoke-tostring-on-the-o
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21076722

http://stackoverflow.com/q/20987838
type: Question
has answer: http://stackoverflow.com/a/20988058
has answer: http://stackoverflow.com/a/54996763
score: 0
has body: I am make a project on cars. How can I make distributor frame popup and cars frame not visible and close automatic? Kindly send any solution in simple and effective way. I have done coding this way:- { Cars frm1=new Cars(); Distributor frm2=new Distributor(); frm2.setVisible(true); frm1.setVisible(false); frm1.setDefaultCloseOperation(frm1.DISPOSE_ON_CLOSE); }
tagged with: user-interface
has comment: http://stackoverflow.com/comment/31540873
tagged with: jframe
has answer: http://stackoverflow.com/a/52334695
accepted answer: http://stackoverflow.com/a/20988058
answer count: 4
type: AnsweredQuestion
tagged with: netbeans
has answer: http://stackoverflow.com/a/26585575
has comment: http://stackoverflow.com/comment/31536823
has title: How to connect two JFrames in netbeans without using swing?
tagged with: java
has comment: http://stackoverflow.com/comment/31540800
tagged with: swing
possible better answer: http://stackoverflow.com/a/26585575

http://stackoverflow.com/comment/31450302
score: 0
has text: (When replying to someone, don't leave a space between the `@` and their name.) That doesn't answer my question, if you take a second to really answer it, you will get your answer.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20941624

http://stackoverflow.com/comment/104148328
type: AnswerComment
has text: As simple as the answer should be.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/41305318

http://stackoverflow.com/q/20955155
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20955572
tagged with: nhibernate-validator
type: Question
tagged with: java
tagged with: hibernate
score: 0
tagged with: validation
has answer: http://stackoverflow.com/a/20955572
answer count: 1
has body: I want to use Hibernate Validator, In first step I checked and studied the following reference : Hibernate Validator JSR 349 Reference Implementation Reference Guide 5.0.2.Final first sample in page 3 is my problem I cloud not find this imports packages (javax.validation.*) in hibernate-validator-5.0.2.Final.jar I found only (org.hibernate.validator.*) but these classes did not exist package org.hibernate.validator.referenceguide.chapter01; import java.util.Set; // ????? import javax.validation.ConstraintViolation; // Not Found import javax.validation.Validation; // Not Found import javax.validation.Validator; // Not Found import javax.validation.ValidatorFactory; // Not Found // ????? import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.assertEquals; public class CarTest { private static Validator validator; @BeforeClass public static void setUp() { // ????? ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); validator = factory.getValidator(); // ????? } @Test public void manufacturerIsNull() { Car car = new Car(null, "DD-AB-123", 4); Set&lt;ConstraintViolation&lt;Car&gt;&gt; constraintViolations = validator.validate(car); assertEquals(1, constraintViolations.size()); assertEquals("may not be null", constraintViolations.iterator().next().getMessage()); } please help me and guide me what is necessary packages for the following code ? ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); validator = factory.getValidator();
has title: Validation in Hibernate Validator

http://stackoverflow.com/a/20997017
answers question: http://stackoverflow.com/q/20975917
score: 0
type: AcceptedAnswer
type: Answer
has body: Ok, i figured it out. Here is explained, how to obtain screenshots from controls in Java independent from their visibility.
accepted answer of: http://stackoverflow.com/q/20975917

buildpath
tags question: http://stackoverflow.com/q/20861752
type: Tag
tags question: http://stackoverflow.com/q/20936174
tag name: buildpath

http://stackoverflow.com/q/20924758
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20924953
accepted answer: http://stackoverflow.com/a/20924953
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20924865
has title: ProgressDialog is not shown if I get the result of AsyncTask class from another class
type: Question
answer count: 2
upvote count: 1
linked to: http://stackoverflow.com/q/16752073
downvote count: 0
tagged with: progressdialog
favorite count: 0
tagged with: runtime-error
tagged with: android
possible better answer: http://stackoverflow.com/a/20924865
tagged with: android-asynctask
linked to: http://stackoverflow.com/q/4489399
has body: If I take the results given from an AsynkTask class from one another like this: Register.java: public void onClick(View v) { LoadFermate backgroundFermate = new LoadFermate(Register.this); ArrayList&lt;HashMap&lt;String, String&gt;&gt; fermate; try{ fermate = backgroundFermate.execute().get(); for (HashMap&lt;String, String&gt; fermata:fermate){ Toast.makeText(Register.this , fermata.get("Nome"), Toast.LENGTH_SHORT).show(); } }catch (InterruptedException e){ e.printStackTrace(); }catch (ExecutionException e){ e.printStackTrace(); } } the ProgressDialog is not shown. If instead I do all this stuff in the onPostExecute method, it is shown. How is that possible? I learned the way for getting the value from the othe class in that question. Here I post the class where I use the ProgressDialog: LoadingFermate.java: package com.PacchettoPrincipale.app; import [...] public class LoadFermate extends AsyncTask&lt;Void, Void, ArrayList&lt;HashMap&lt;String, String&gt;&gt;&gt; { private Context context; public LoadFermate(Context context){ this.context = context; } private ProgressDialog pDialog; private JSONArray mComments = null; private ArrayList&lt;HashMap&lt;String, String&gt;&gt; mCommentList; //testing on Emulator: private static final String DOWNLOAD_FERMATE_URL = "http://10.0.2.2/PrimaAppAndroid/fermate.php"; //JSON IDS: private static final String TAG_COD = "CodFermata"; private static final String TAG_POSTS = "posts"; private static final String TAG_NOME = "Nome"; @Override protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDialog(context); //HERE I START THE PDIALOG, and in the onPostExecute method I dismiss it pDialog.setMessage("Download fermate..."); pDialog.setIndeterminate(false); pDialog.setCancelable(true); pDialog.show(); } @Override protected ArrayList&lt;HashMap&lt;String, String&gt;&gt; doInBackground(Void... voids) { updateJSONData(); return mCommentList; } @Override protected void onPostExecute(ArrayList&lt;HashMap&lt;String, St…

http://stackoverflow.com/q/20947964
score: 0
tagged with: c#
tagged with: performance
has comment: http://stackoverflow.com/comment/31463871
tagged with: java
tagged with: memory
type: Question
answer count: 1
has title: How to find the objects in virtual memory?
has answer: http://stackoverflow.com/a/20949410
tagged with: virtual
has body: Is there a way that I can use Java or C# to print the objects in the virtual memory of a specific process? I would like to see which objects of my C# application are consuming too much memory. So I would like to print the current running objects in the process. If its not possible are there any software that I could use for this purpose? Please advice
type: UnansweredQuestion

http://stackoverflow.com/a/20891476
accepted answer of: http://stackoverflow.com/q/20891226
has comment: http://stackoverflow.com/comment/31355340
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31357854
has comment: http://stackoverflow.com/comment/31361024
type: Answer
score: 0
answers question: http://stackoverflow.com/q/20891226
has body: I'm pretty sure there are a bunch of buggy problems with using the XML to define an onClick method. I would suggest two possible solutions: According to this solution you should try cleaning the project in Eclipse. If that doesn't work, they said the final solution was to delete the emulator to get it working. The other solution would be to implement a onClick handler in the onCreate method of the activity for the button. An example is shown here.

http://stackoverflow.com/q/21015180
has title: access assigned display in java for Mac OS X 10.9
tagged with: macos
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has body: I have a java swing application that tries to center some dialogs that have no parents on the screen. Since Mac OS X 10.9, spaces can be separated per display and you can assign an application to a space and thereby also to a display. Is there any way I can get that display before opening a new window/dialog? I tried: GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); but that returns always the "main" screen, not the one the application is assigned to. Using the wrong screen to compute the position can lead to dialogs partially (or in extreme cases even fully) out of the screen. For now I made a workaround and store the screen the application was running on the last time and use that to identify the correct screen. But it would be nice to get a clean way to find the correct screen.
score: 2
answer count: 0
tagged with: java
tagged with: swing
type: Question
tagged with: osx-mavericks
downvote count: 0

http://stackoverflow.com/q/20899579
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20899630
type: Question
linked to: http://stackoverflow.com/q/1778744
tagged with: java
possible better answer: http://stackoverflow.com/a/20899698
has title: What does Mockito.anyLong() do?
has answer: http://stackoverflow.com/a/20899698
has body: I have to test a method which takes a Long as argument. I have to test it for any value of the Long and also in case it's null. Does Mockito.anyLong() automatically test both cases? null and any value of the Long? Or randomly picks up a value between any long value and null? Considering that these are the docs about anyLong(): anyLong public static long anyLong() any long, Long or null. See examples in javadoc for Matchers class Returns: 0. Thanks in advance.
answer count: 2
tagged with: mockito
tagged with: junit
downvote count: 0
has comment: http://stackoverflow.com/comment/31369330
favorite count: 0
score: 8
has answer: http://stackoverflow.com/a/20899630
has comment: http://stackoverflow.com/comment/102007591
upvote count: 8
has comment: http://stackoverflow.com/comment/109655920

http://stackoverflow.com/comment/31423979
comment on: http://stackoverflow.com/a/20916280
type: Comment
has text: This could very well be it. The problem is the Raspbian repos don't seem to have 45 but only 25. :(
type: AnswerComment
score: 0

http://stackoverflow.com/q/20886463
tagged with: solaris
tagged with: awt
has comment: http://stackoverflow.com/comment/31344520
score: 0
has comment: http://stackoverflow.com/comment/31367628
has comment: http://stackoverflow.com/comment/31345459
has body: My code that was generating PI charts in our Solaris system was working fine earlier, but somehow now the Java is exiting with an Exception saying "No graphics environment found", even if X11 is running. I am sure that no code was changed. What are some possible issues in terms of Unix? Our system admin has provided the following details from the Solaris server: $:/root# ps -ef | grep -i Xsun root 25920 25246 0 10:34:24 pts/3 0:00 grep -i Xsun root 18528 4999 0 Jan 01 ? 0:00 /usr/openwin/bin/Xsun :0 +nkeyboard +nmouse -dev vfb Is there anything else I should look for? This is what the script says: #!/bin/sh # Copyright 2002, 2003 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # Split off Server Number ServerNumber=\`echo $1 |grep ":"\` if [ "$ServerNumber" ] then shift fi exec /usr/openwin/bin/Xsun $ServerNumber +nkeyboard +nmouse -dev vfb $*
has comment: http://stackoverflow.com/comment/31483095
tagged with: unix
has answer: http://stackoverflow.com/a/20887066
has comment: http://stackoverflow.com/comment/31345250
type: UnansweredQuestion
has title: "No graphics environment found" while X11 is running
tagged with: java
tagged with: headless
has comment: http://stackoverflow.com/comment/31345119
type: Question
answer count: 1

http://stackoverflow.com/comment/31484791
type: QuestionComment
comment on: http://stackoverflow.com/q/20959803
score: 1
has text: `putParcelableArrayList` goes with ... `getParcelableArrayList`
type: Comment

http://stackoverflow.com/a/21011811
accepted answer of: http://stackoverflow.com/q/21011609
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 2
answers question: http://stackoverflow.com/q/21011609
has body: Check this OnClickListener() must override a superclass method? Uncheck "Enable project specific settings", click "Configure Workspace Settings..." and change "Compiler Compliance Level" to 1.6 or above Have this import statement import android.view.View.OnClickListener; There is no need to remove @Override Annotation. Also calling finish() is not necessary. The hardware back button does the job. When you press back button in Grammar Activity your current activity is popped from the back stack and the previous activity in the back stack takes focus. So there is no need to call finish() on button click. http://developer.android.com/guide/components/tasks-and-back-stack.html Also if you have a Button with id grammar in activity_grammer.xml it is ok. Make sure you have a button with id grammar in activity_grammer.xml You can read the topic id http://developer.android.com/guide/topics/ui/declaring-layout.html An ID need not be unique throughout the entire tree, but it should be unique within the part of the tree you are searching.
upvote count: 2

http://stackoverflow.com/q/20969292
accepted answer: http://stackoverflow.com/a/20969665
type: Question
possible better answer: http://stackoverflow.com/a/20970092
has body: I'm using org.apache.commons.math3.distribution.NormalDistribution in a large distributed Scala &amp; Akka application. During debugging I found sample() was occasionally returning NaN, which propagated silently and caused threads to hang in org.apache.commons.math3.ode.nonstiff.DormandPrince853Integrator The NaN can be reproduced simply with parallel colelctions (doesn't happen in sequential code): val normal = new NormalDistribution(0,0.1) (1 to 1000000000).par.foreach{i =&gt; val r = normal.sample if(r.isNaN()) throw new Exception("r = "+r) } Obviously moving the val normal inside the foreach solves the issue in this case. I've looked at the docs but can't see anything warning me of such issues. Have I failed to grasp a more fundamental concept about thread safety? Needless to say I'm now checking for NaN.
has answer: http://stackoverflow.com/a/20969665
tagged with: apache-commons-math
upvote count: 3
has title: Thread safety warnings
has answer: http://stackoverflow.com/a/20969817
has answer: http://stackoverflow.com/a/20969735
favorite count: 0
tagged with: scala
has answer: http://stackoverflow.com/a/20970092
tagged with: multithreading
answer count: 4
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
tagged with: concurrency

android-asynctask
tags question: http://stackoverflow.com/q/20886329
tags question: http://stackoverflow.com/q/20888037
tags question: http://stackoverflow.com/q/20931084
type: Tag
tag name: android-asynctask
tags question: http://stackoverflow.com/q/20873004
tags question: http://stackoverflow.com/q/20922568
tags question: http://stackoverflow.com/q/20945475
tags question: http://stackoverflow.com/q/20930182
tags question: http://stackoverflow.com/q/20868167
tags question: http://stackoverflow.com/q/20915832
tags question: http://stackoverflow.com/q/20888069
tags question: http://stackoverflow.com/q/20878902
tags question: http://stackoverflow.com/q/20943837
tags question: http://stackoverflow.com/q/20891374
tags question: http://stackoverflow.com/q/20874677
tags question: http://stackoverflow.com/q/20956657
tags question: http://stackoverflow.com/q/20956248
tags question: http://stackoverflow.com/q/20932732
tags question: http://stackoverflow.com/q/20889576
tags question: http://stackoverflow.com/q/20951825
tags question: http://stackoverflow.com/q/20920894
tags question: http://stackoverflow.com/q/20872162
tags question: http://stackoverflow.com/q/20924758
tags question: http://stackoverflow.com/q/20889627

http://stackoverflow.com/comment/31333453
comment on: http://stackoverflow.com/q/20879988
has text: So, Are you have boolean property? Can you mark which line throw NullPointer in XML?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/129751478
has text: What you said is true, but it does not answer to the OP's question. OP muddied the waters by providing two very different code examples, one of which showed the use of double-checked locking to initialize a singleton object, but the actual question was about the relative merits of `synchronized` _blocks_ in Java vs. `synchronized` _methods._
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20907034
type: Comment

http://stackoverflow.com/a/20967504
type: Answer
answers question: http://stackoverflow.com/q/20967382
score: 2
downvote count: 0
upvote count: 2
has body: "Now I understand that console1 is an object of ConsoleWriter while console is just a reference type to ConsoleWriter." - Wrong. Both console and console1 are references.. The difference is that console1 points to a ConsoleWriter object whereas console doesnt point to anything. So. console.anyFunction() will give you an exception (NulPointerException) because console is not initialized whereas console1.someFunction() will work as console1 points to a ConsoleWriter Object.

http://stackoverflow.com/comment/31326718
type: Comment
has text: please ping me at my gmail rishikesh.rv I am unable to send my code .
comment on: http://stackoverflow.com/a/20872244
score: 0
type: AnswerComment

http://stackoverflow.com/a/21860328
upvote count: 5
has comment: http://stackoverflow.com/comment/33313326
score: 3
has comment: http://stackoverflow.com/comment/33152904
has comment: http://stackoverflow.com/comment/43815735
has body: An additional point none of the other answers seem to have considered: if you really need generics with run-time typing, you can implement it yourself like this: public class GenericClass&lt;T&gt; { private Class&lt;T&gt; targetClass; public GenericClass(Class&lt;T&gt; targetClass) { this.targetClass = targetClass; } This class is then able to do all the things that would be achievable by default if Java did not use erasure: it can allocate new Ts (assuming T has a constructor that matches the pattern it expects to use), or arrays of Ts, it can dynamically test at run time if a particular object is a T and change behaviour depending on that, and so on. For example: public T newT () { try { return targetClass.newInstance(); } catch(/* I forget which exceptions can be thrown here */) { ... } } private T value; /** @throws ClassCastException if object is not a T */ public void setValueFromObject (Object object) { value = targetClass.cast(object); } }
type: Answer
has comment: http://stackoverflow.com/comment/33155996
downvote count: 2
answers question: http://stackoverflow.com/q/20918650
has comment: http://stackoverflow.com/comment/43803596

http://stackoverflow.com/a/20901917
has comment: http://stackoverflow.com/comment/31373648
has comment: http://stackoverflow.com/comment/31374392
has comment: http://stackoverflow.com/comment/31373808
has comment: http://stackoverflow.com/comment/31373937
has comment: http://stackoverflow.com/comment/31374014
answers question: http://stackoverflow.com/q/20901770
score: 4
has comment: http://stackoverflow.com/comment/31374239
upvote count: 4
downvote count: 0
has body: All the code executed by an event listener. The code in your main method, the code executed inside a thread that you explicitely started, or that has been started by the usage of a Timer or SwingWorker. When creating a Swing GUI in your main method. Or when you want to interact with a Swing component (or its model) from inside a background thread. When this piece of code is blocking (like long IO) or is taking more than a few milliseconds to execute. All the code executed from inside the EDT prevent this thread from doing its main job: repainting the GUI and reacting to events.
has comment: http://stackoverflow.com/comment/31373859
type: Answer
has comment: http://stackoverflow.com/comment/31373739
has comment: http://stackoverflow.com/comment/31374299
has comment: http://stackoverflow.com/comment/31373865

cisco
type: Tag
tags question: http://stackoverflow.com/q/20867066
tags question: http://stackoverflow.com/q/20988578
tag name: cisco

http://stackoverflow.com/q/20857723
answer count: 1
favorite count: 0
type: UnansweredQuestion
score: 2
downvote count: 0
tagged with: java
tagged with: lwjgl
tagged with: eclipse
type: Question
has title: lockAndInitHandle error on Windows 8
has body: I am developing a Java App using Lwjgl-2.9.1 on a Windows 8 PC. I am using Eclipse (Kepler) as developing Tool. Running the App in Eclipse works fine. But when I pack the App in a jar file, and run it from a .bat file, using Jdk 1.7-45, I get the following error: Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: org.lwjgl.opengl.AWTSurfaceLock.lockAndInitHandle(Ljava/nio/ByteBuffer;Ljava/awt/Canvas;Z)Z at org.lwjgl.opengl.AWTSurfaceLock.lockAndInitHandle(Native Method) at org.lwjgl.opengl.AWTSurfaceLock.access$100(AWTSurfaceLock.java:51) at org.lwjgl.opengl.AWTSurfaceLock$1.run(AWTSurfaceLock.java:94) at org.lwjgl.opengl.AWTSurfaceLock$1.run(AWTSurfaceLock.java:92) at java.security.AccessController.doPrivileged(Native Method) at org.lwjgl.opengl.AWTSurfaceLock.privilegedLockAndInitHandle(AWTSurfaceLock.java:92) at org.lwjgl.opengl.AWTSurfaceLock.lockAndGetHandle(AWTSurfaceLock.java:66) at org.lwjgl.opengl.WindowsAWTGLCanvasPeerInfo.doLockAndInitHandle(WindowsAWTGLCanvasPeerInfo.java:58) at org.lwjgl.opengl.PeerInfo.lockAndGetHandle(PeerInfo.java:85) at org.lwjgl.opengl.AWTGLCanvas.paint(AWTGLCanvas.java:320) at sun.awt.RepaintArea.paintComponent(RepaintArea.java:264) at sun.awt.RepaintArea.paint(RepaintArea.java:240) at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:347) at java.awt.Component.dispatchEventImpl(Component.java:4937) at java.awt.Component.dispatchEvent(Component.java:4687) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735) 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.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87) at java.awt.EventQueue$4.run(EventQueue.java:708) at java.awt.EventQueue$4.run(EventQueue.java:706) at…
has answer: http://stackoverflow.com/a/20857879
upvote count: 2
tagged with: windows

proxy
tags question: http://stackoverflow.com/q/20884101
tags question: http://stackoverflow.com/q/20899331
type: Tag
tags question: http://stackoverflow.com/q/20988626
tags question: http://stackoverflow.com/q/20935617
tags question: http://stackoverflow.com/q/20849936
tags question: http://stackoverflow.com/q/21008459
tag name: proxy
tags question: http://stackoverflow.com/q/20989128

http://stackoverflow.com/q/20890768
has comment: http://stackoverflow.com/comment/31353250
has comment: http://stackoverflow.com/comment/31353624
type: Question
has title: Simple Divison for Calculator not working
has answer: http://stackoverflow.com/a/20890886
answer count: 1
downvote count: 0
favorite count: 0
has body: I'm Trying to make a calculator that will figure in tax, tip, and splitting between multiple people, but the last feature isn't working and I can't figure out why. I know it will probably be a simple fix but I'm new to Java so I just can't find it. Note: this is my first actual Java program so please be understanding with my probably obvious mistake. import java.util.Scanner; import javax.swing.JOptionPane; public class TaxFinder { static Scanner scan = new Scanner(System.in); public static double priceD, taxD, totalTax, total, priceTipped, pricePP; public static int peopleI; public static String price, tax, people, ifTip, tip, ifSplit; public static void main(String args[]){ ifTip = JOptionPane.showInputDialog("Was your purchase in a restaurant?"); if (ifTip.equalsIgnoreCase("yes")){ price = JOptionPane.showInputDialog("What was the cost of your bill ($)?"); priceD = Double.parseDouble(price); tax = JOptionPane.showInputDialog("What is your tax rate (decimal)?"); taxD = Double.parseDouble(tax); tip = JOptionPane.showInputDialog("Do you want to tip 5, 10, 15, or 20% ?"); if (tip.equals("5")){ priceTipped = priceD * .05; } else if (tip.equals("10")){ priceTipped = priceD * .1; //System.out.println("Your price tipped is " + priceTipped); } else if (tip.equals("15")){ priceTipped = priceD * .15; } else if (tip.equals("20")){ priceTipped = priceD * .2; } totalTax = priceD * taxD; total = priceD + totalTax + priceTipped; } else if (ifTip.equalsIgnoreCase("no")){ price = JOptionPane.showInputDialog("How much did your purchase cost ($)?"); priceD = Double.parseDouble(price); tax = JOptionPane.showInputDialog("What is your tax rate (decimal)?"); taxD = Double.parseDouble(tax); totalTax = priceD * taxD; total = priceD + totalTax; } JOptionPane.showMessageDialog(null, "Your total is: $" + total, "Shopping Calculator", JOptionPane.PLAIN_MESSAGE); ifSplit = JOptionPane.showInputDialog("Are you splitting the cost with other people?"); if (ifSplit.equalsIgnoreCase("yes")){ people…
tagged with: joptionpane
has comment: http://stackoverflow.com/comment/31353175
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31353529
tagged with: division
upvote count: 1
tagged with: swing
score: 1
tagged with: java

http://stackoverflow.com/comment/31438675
type: AnswerComment
comment on: http://stackoverflow.com/a/20935930
score: 0
type: Comment
has text: Thanks that works! I did not know that the order matters until now :)

http://stackoverflow.com/comment/31467321
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20950881
type: Comment
has text: So, you can get rid of the parent's layout_weight="1".

http://stackoverflow.com/a/20980683
accepted answer of: http://stackoverflow.com/q/20980149
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20980149
has comment: http://stackoverflow.com/comment/31525376
type: Answer
score: 0
has body: As mentioned in a comment, this is correct: class BinaryTree&lt;E extends Comparable&lt;E&gt;&gt;{ INSERT CODE HERE } You would then implement all methods of BinaryTree - Using x.compareTo(y) instead of comparator operators for your isInOrder() method. There may be other modifications necessary but I haven't looked at all of your code. The benefit to this is having a BinaryTree class that you can insert any Object into, as long as it implements Comparable

http://stackoverflow.com/comment/31622185
type: AnswerComment
type: Comment
has text: It's not something else. It's a function of the version of dev environment and it doesn't matter if it's the main project or a library project .. all the R resource identifiers are not declared final. You just need to move the switch to ann if-else structure
comment on: http://stackoverflow.com/a/21005410
score: 0

http://stackoverflow.com/q/20916720
has comment: http://stackoverflow.com/comment/31402666
possible better answer: http://stackoverflow.com/a/20916784
answer count: 6
has answer: http://stackoverflow.com/a/20916790
tagged with: jtable
has answer: http://stackoverflow.com/a/20916784
favorite count: 0
has answer: http://stackoverflow.com/a/20918860
accepted answer: http://stackoverflow.com/a/20918860
has answer: http://stackoverflow.com/a/20916764
tagged with: swing
downvote count: 1
type: AnsweredQuestion
has title: Don't want time on JTable
has body: When I fetch data from database it gives me Date as 04/01/2014 00:00:00 and it is displayed on JTable. Now I want to display only date on table and discard the time. How can I do it? EDIT: public Vector getDateCustomer(String name,String name1)throws Exception { Vector&lt;Vector&lt;String&gt;&gt; getdatecustomerVector = new Vector&lt;Vector&lt;String&gt;&gt;(); Connection conn = dbConnection(); pre1=conn.prepareStatement("select * from Debit where Date " + "between CDate(?) and CDate(?) order by Date ASC"); pre1.setString(1, name); // bind param 1 pre1.setString(2, name1); // bind param 2 ResultSet rs1 = pre1.executeQuery(); while(rs1.next()) { Vector&lt;String&gt; getdatecustomer = new Vector&lt;String&gt;(); getdatecustomer.add(rs1.getString(1)); getdatecustomer.add(rs1.getString(2)); getdatecustomer.add(rs1.getString(3)); getdatecustomer.add(rs1.getString(4)); Date myDate=(Date)format.parse(rs1.getString(5).substring(0, 10)); getdatecustomer.add(format.format(myDate)); getdatecustomer.add(rs1.getString(6)); getdatecustomerVector.add(getdatecustomer); } /*Close the connection after use (MUST)*/ if(conn!=null) conn.close(); return getdatecustomerVector; } This is how I am getting values from database. Getting error java.text.ParseException: Unparseable date: "2014-01-01" at java.text.DateFormat.parse(DateFormat.java:357) at shop.DBEngine.getDateCustomer(DBEngine.java:548) at shop.DCSTable.&lt;init&gt;(DCSTable.java:127) at shop.DCS.actionPerformed(DCS.java:273) 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:6505) at javax.swing.JComponent.processMouseEvent(JComp…
has answer: http://stackoverflow.com/a/20916906
tagged with: java
score: -1
tagged with: date
type: Question
has answer: http://stackoverflow.com/a/20923819
upvote count: 0

http://stackoverflow.com/comment/31320773
type: QuestionComment
has text: @MadProgrammer something like my answer xD?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20873021

http://stackoverflow.com/q/20932490
has title: Hibernate: How to get new id created as a result of insert
type: Question
score: 0
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/20932509
answer count: 1
has body: I have a hibernate code which insert a new role to the table as follows: Staff staff = new Staff(staffDTO); Session session = sessionManager.getSession(); session.beginTransaction(); session.save(staff); session.getTransaction().commit(); Staff is defined as entity. My question is that how can I get the newly generated row id by the database? Many thanks.
accepted answer: http://stackoverflow.com/a/20932509
type: AnsweredQuestion

http://stackoverflow.com/a/20999860
has comment: http://stackoverflow.com/comment/31558687
has comment: http://stackoverflow.com/comment/31558547
downvote count: 0
has comment: http://stackoverflow.com/comment/31558296
has comment: http://stackoverflow.com/comment/31559483
has comment: http://stackoverflow.com/comment/31559699
type: Answer
has comment: http://stackoverflow.com/comment/31572056
answers question: http://stackoverflow.com/q/20998375
has comment: http://stackoverflow.com/comment/31558302
has comment: http://stackoverflow.com/comment/31560173
has comment: http://stackoverflow.com/comment/31560690
score: 1
has comment: http://stackoverflow.com/comment/31560379
has comment: http://stackoverflow.com/comment/31578712
upvote count: 1
has comment: http://stackoverflow.com/comment/31558935
has comment: http://stackoverflow.com/comment/31578871
has body: Are you certain your page is completely loaded after you sign in? Did you set a timeout for your webdriver? (how long it has to wait for elements). Probably it reads your html before it's completey loaded. Webdriver driver = new FirefoxDriver(); driver.manage().timeouts().implicitlyWait(50, TimeUnit.SECONDS); To find out quickly if this is the problem do Thread.sleep(8000) after you do wb2.click();
has comment: http://stackoverflow.com/comment/31558606
has comment: http://stackoverflow.com/comment/31563022
has comment: http://stackoverflow.com/comment/31558008
has comment: http://stackoverflow.com/comment/31558781
has comment: http://stackoverflow.com/comment/31560606

http://stackoverflow.com/q/20850815
has comment: http://stackoverflow.com/comment/31277898
tagged with: acm-java-libraries
tagged with: java
downvote count: 1
upvote count: 0
has body: well,i am trying to create a program that allocates 10000 rational objects without saving any of them in variables so that they all become garbage. After that i have to measure the amount of free memory before and after garbage collection and use the difference to report how many bytes were freed. So far, i have created two .java file. The Rational.java and gc.java. I create the constructor Rational so i can "call" it in my void run method of the gc.java files. The constructor creates a new rational object with the value x/y. BUT,i get the error: Java error: cannot find symbol symbol method gcd(Math.abs(x),Math.abs(y)); location class Rational 1 error Here is my TWO JAVA FILES: RATIONAL.java import acm.program.*; public class Rational { public Rational(int x,int y) { int g = gcd(Math.abs(x),Math.abs(y)); int num; int den; num = x/g; den = Math.abs(y)/g; if (y&lt;0) { num = -num; } } } AND GC.java import acm.program.*; public class gc extends ConsoleProgram { public void run() { println("Allocating 10000 objects"); for(int i = 0;i&lt;10000;i++) { new Rational(i+1,i+2); } Runtime myTime = Runtime.getRuntime(); long a = myTime.freeMemory(); println(a); myTime.gc(); long b = myTime.freeMemory(); println(b); println((a-b)); } } I can't find were my mistake is,so i can fix it. Your help would be appreciated problem is,according to the compiler here: int g = gcd(Math.abs(x),Math.abs(y)); EDIT: WORKED!! Just created the gcd method right!
has title: Java error: Cannot find symbol (acm)
type: UnansweredQuestion
favorite count: 0
has answer: http://stackoverflow.com/a/20850852
score: -1
tagged with: compiler-errors
type: Question
has comment: http://stackoverflow.com/comment/31277932
answer count: 1

http://stackoverflow.com/q/20948361
has answer: http://stackoverflow.com/a/20948471
linked to: http://stackoverflow.com/q/383551
has body: Boolean data type only evaluates to true or false, so it is always going to take only one bit of memory. So why is there a need of extra 7 bit of memory, isn't it a waste of memory?
has answer: http://stackoverflow.com/a/20948556
accepted answer: http://stackoverflow.com/a/20948403
downvote count: 1
upvote count: 24
has comment: http://stackoverflow.com/comment/31462262
possible better answer: http://stackoverflow.com/a/20948556
type: AnsweredQuestion
tagged with: java
score: 23
type: Question
has answer: http://stackoverflow.com/a/20948694
has answer: http://stackoverflow.com/a/20948403
has comment: http://stackoverflow.com/comment/31462318
has comment: http://stackoverflow.com/comment/31464902
favorite count: 0
duplicate of: http://stackoverflow.com/q/1907318
has answer: http://stackoverflow.com/a/20948438
has title: Why does the boolean data type need 8 bits?
answer count: 5

http://stackoverflow.com/comment/31600099
type: Comment
has text: I've been avoiding 'sharing' since Eclipse was born. The whole idea that your code should 'live in the workspace' has always seemed bad to me; I prefer to control where my code lives and just be able to point the IDE at it.
type: AnswerComment
comment on: http://stackoverflow.com/a/21019069
score: 0

http://stackoverflow.com/q/20879487
has body: I have class In java: A. And class B which extends class A. Class A hold instance of class B. I notice that when I call the constructor of class B (when I init this parameter in class A), It does super(), create a new instance of A and init all it fields. How I can tell class B that the concrete instance of class A (which init it field) - it his parent class?
has comment: http://stackoverflow.com/comment/31332015
score: 0
has answer: http://stackoverflow.com/a/20879578
has comment: http://stackoverflow.com/comment/31332014
has comment: http://stackoverflow.com/comment/31332234
has comment: http://stackoverflow.com/comment/31332090
has answer: http://stackoverflow.com/a/20879534
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31332388
has title: Instance of child in parent class
tagged with: java
has comment: http://stackoverflow.com/comment/31332717
type: Question
answer count: 2

http://stackoverflow.com/comment/31546876
comment on: http://stackoverflow.com/a/20993226
has text: @SergiyMedvynskyy repaint makes a request to the RepaintManager, which posts a repaint event onto the event queue, which is the processed by the a EDT, so that the actual paint is completed within the context of the EDT
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/20936341
accepted answer of: http://stackoverflow.com/q/20936174
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20936174
has body: TO READ Two possible causes: you are trying to access the project.txt through java.io and not as resource (please post the code) you access through ClassLoader.class.getResourceAsStream("/res/project.txt"); but the file was not exported into the jar (please post the code) in othe words: the "./res/project.txt" is near the eclipse project path but outside the scope of the jar. TO WRITE Finally the writing into the jar file is absolutly not Java compliant, it should work in some cases such as ear or war and not jar.
score: 1

http://stackoverflow.com/comment/31455409
type: AnswerComment
comment on: http://stackoverflow.com/a/20925545
type: Comment
has text: Can You explain little more about this.Should i have to place all these files at one particular location in SVN.
score: 0

http://stackoverflow.com/a/20876449
has comment: http://stackoverflow.com/comment/31326868
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31326942
has body: you need to first create a jar file consisting all your class files as follows then follow the below instructions Sun developed a generic JavaScript to handle all the specific browser quirks, so that you don't have to worry about browser compatibility. Add this to your section: &lt;script src="//www.java.com/js/deployJava.js"&gt;&lt;/script&gt; And this to section: &lt;script&gt; var attributes = {codebase: 'http://my.url/my/path/to/codebase', code: 'my.main.Applet.class', archive: 'my-archive.jar', width: '800', height: '600'}; var parameters = {java_arguments: '-Xmx256m'}; // customize per your needs var version = '1.5'; // JDK version deployJava.runApplet(attributes, parameters, version); &lt;/script&gt; See Java™ Rich Internet Applications Deployment Advice for a detailed explanation of the script and all the possible options.
accepted answer of: http://stackoverflow.com/q/20876326
type: Answer
answers question: http://stackoverflow.com/q/20876326

http://stackoverflow.com/a/63486989
answers question: http://stackoverflow.com/q/21006136
downvote count: 0
has body: I managed to fix this by changing settings for new projects: File -&gt; New Projects Settings -&gt; Settings for New Projects -&gt; Java Compiler -&gt; Set the version File -&gt; New Projects Settings -&gt; Structure for New Projects -&gt; Project -&gt; Set Project SDK + set language level Remove the projects Import the projects
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/20979163
has comment: http://stackoverflow.com/comment/31546270
downvote count: 0
score: 1
has body: My droidQuery library has some methods that can greatly simplify this task: $.getJSON(jsonurl, null, new Function() { @Override public void invoke($ d, Object… args) { JSONObject json = (JSONObject) args[0]; JSONObject query = json.getJSONObject(TAG_QUERY); JSONObject pages = json.getJSONObject(TAG_PAGES); Map<String, ?> map = $.map(pages); for (Entry<String, ?> entry : map.entrySet()) { String key = entry.getKey();//this is the number, such as 53113 JSONObject value = (JSONObject) entry.value(); Map<String, ?> data = $.map(value);//contains all the fields you need String title = (String) data.get("title");//<--- THIS IS THE TITLE FIELD JSONArray array = (JSONArray) data.get("coordinates"); Object[] data = $.array(array); for (Object o : data) { //loops through each coordinates object JSONObject coordinates = (JSONObject) o;//<--- THIS IS THE FIRST COORDINATE OBJECT //now handle this coordinates data: Map<String, ?> coords = $.map(coordinates); double lat = (double) coords.get("lat"); double lon = (double) coords.get("lon"); //etc... } } } });
answers question: http://stackoverflow.com/q/20977275
upvote count: 1
type: Answer

http://stackoverflow.com/comment/31507205
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20972181
type: Comment
has text: Yeah, one word can make a big difference hehehe. Fixed, thank you.

http://stackoverflow.com/a/20940728
type: Answer
score: 0
has body: FYI, you can pass that string directly to a constructor in Joda-Time 2.3. No need for a formatter. Joda-Time uses that standard ISO 8601 format as its default, even tolerating the lack of a colon in the offset. Instead of passing DateTimeZone.UTC as I did in my example code below, you would pass the specific time zone of your interest. // © 2013 Basil Bourque. This source code may be used freely forever by anyone taking full responsibility for doing so. // import org.joda.time.*; // import org.joda.time.format.*; String string = "2014-01-02T23:03:30-0500"; DateTime dateTime = new DateTime( string, DateTimeZone.UTC ); System.out.println( "dateTime: " + dateTime ); When run: dateTime: 2014-01-03T04:03:30.000Z
answers question: http://stackoverflow.com/q/20922933

spring
tags question: http://stackoverflow.com/q/20928163
tags question: http://stackoverflow.com/q/20884141
tags question: http://stackoverflow.com/q/20854585
tags question: http://stackoverflow.com/q/21016408
tags question: http://stackoverflow.com/q/20934625
tags question: http://stackoverflow.com/q/20956515
tags question: http://stackoverflow.com/q/20987720
tags question: http://stackoverflow.com/q/21011092
tags question: http://stackoverflow.com/q/21017420
tags question: http://stackoverflow.com/q/20896485
tags question: http://stackoverflow.com/q/20926983
tags question: http://stackoverflow.com/q/20992797
tags question: http://stackoverflow.com/q/20965050
tags question: http://stackoverflow.com/q/20954358
tags question: http://stackoverflow.com/q/20907206
tags question: http://stackoverflow.com/q/20945447
tags question: http://stackoverflow.com/q/20934542
tags question: http://stackoverflow.com/q/20999874
tags question: http://stackoverflow.com/q/20954632
tags question: http://stackoverflow.com/q/20946063
tags question: http://stackoverflow.com/q/20974420
tags question: http://stackoverflow.com/q/21018383
tags question: http://stackoverflow.com/q/20961379
tags question: http://stackoverflow.com/q/20867794
tags question: http://stackoverflow.com/q/20971932
tags question: http://stackoverflow.com/q/20878221
tags question: http://stackoverflow.com/q/20857020
tags question: http://stackoverflow.com/q/21002992
tags question: http://stackoverflow.com/q/20854890
tags question: http://stackoverflow.com/q/20941673
tags question: http://stackoverflow.com/q/20886585
tags question: http://stackoverflow.com/q/20978454
tags question: http://stackoverflow.com/q/20918825
tags question: http://stackoverflow.com/q/20867175
tags question: http://stackoverflow.com/q/21003179
tags question: http://stackoverflow.com/q/20982180
tags question: http://stackoverflow.com/q/20978235
tags question: http://stackoverflow.com/q/20956537
tags question: http://stackoverflow.com/q/20961329
tags question: http://stackoverflow.com/q/20971850
tags question: http://stackoverflow.com/q/20875656
tags question: http://stackoverflow.com/q/20878389
tags question: http://stackoverflow.com/q/21015891
tags question: http://stackoverflow.com/q/20934985
tags question: http://stackoverflow.com/q/20888590
tags question: http://stackoverflow.com/q/20852201
tags question: http://stackoverflow.com/q/20944770
tags question: http://stackoverflow.com/q/20946573
type: Tag
tags question: http://stackoverflow.com/q/20849929
tags question: http://stackoverflow.com/q/20970702
tags question: http://stackoverflow.com/q/21015278
tags question: http://stackoverflow.com/q/20981387
tags question: http://stackoverflow.com/q/20953068
tags question: http://stackoverflow.com/q/20902177
tags question: http://stackoverflow.com/q/20852457
tags question: http://stackoverflow.com/q/20925199
tags question: http://stackoverflow.com/q/20931053
tags question: http://stackoverflow.com/q/21016151
tags question: http://stackoverflow.com/q/21010600
tags question: http://stackoverflow.com/q/20967397
tags question: http://stackoverflow.com/q/20858483
tags question: http://stackoverflow.com/q/20947841
tags question: http://stackoverflow.com/q/20867791
tags question: http://stackoverflow.com/q/20863873
tags question: http://stackoverflow.com/q/21011881
tags question: http://stackoverflow.com/q/20851236
tags question: http://stackoverflow.com/q/20950346
tags question: http://stackoverflow.com/q/20986163
tags question: http://stackoverflow.com/q/20867130
tags question: http://stackoverflow.com/q/20876951
tags question: http://stackoverflow.com/q/20979942
tags question: http://stackoverflow.com/q/20872058
tags question: http://stackoverflow.com/q/20966046
tags question: http://stackoverflow.com/q/20993264
tags question: http://stackoverflow.com/q/20981987
tags question: http://stackoverflow.com/q/20970793
tags question: http://stackoverflow.com/q/21003252
tags question: http://stackoverflow.com/q/20990389
tags question: http://stackoverflow.com/q/20901210

http-redirect
tags question: http://stackoverflow.com/q/20958755
tags question: http://stackoverflow.com/q/21006840
tags question: http://stackoverflow.com/q/20870733
type: Tag
tags question: http://stackoverflow.com/q/20972048
tags question: http://stackoverflow.com/q/20859359
tags question: http://stackoverflow.com/q/20853666
tag name: http-redirect
tags question: http://stackoverflow.com/q/20994626

http://stackoverflow.com/comment/31456935
comment on: http://stackoverflow.com/a/20945438
score: 0
type: AnswerComment
has text: Actually `Chatlength = new String[10];` is fine. It's probably a class member that's `String[]`.
type: Comment

http://stackoverflow.com/q/20880545
answer count: 2
tagged with: enums
has answer: http://stackoverflow.com/a/20880605
score: 0
has title: enum with string and list?
has body: Is it possible to write an enum in java as below? public enum SomeEnum{ ADDRESS("someData", arraylist); } Basically is it possible to keep list inside Enum ?
tagged with: string
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31333913
tagged with: java
has answer: http://stackoverflow.com/a/20880646
accepted answer: http://stackoverflow.com/a/20880646
possible better answer: http://stackoverflow.com/a/20880605
type: Question

http://stackoverflow.com/comment/31494971
score: 0
type: AnswerComment
type: Comment
has text: let me try this and let u know. Thanks for ur answer
comment on: http://stackoverflow.com/a/20965370

http://stackoverflow.com/comment/31360734
type: AnswerComment
has text: Absolutely. If no one tells me I will never learn to do it right. Thanks again :)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20894245

http://stackoverflow.com/comment/31456201
comment on: http://stackoverflow.com/a/20933658
type: Comment
has text: @newacct Actually, it is perfectly safe! In fact, `this` *must* extend `Parent<T>`, because the "recursive" typing prevents the type `T` being anything but the declaring class, ie `Child extends Parent<String>` is a compile error, you can only code `Child extends Parent<Child>` etc. And `this` *is* the subclass instance (not the `Parent` type, but the subclass type, `Child` in this example). There is actually no way for this to cause an error.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31501366
comment on: http://stackoverflow.com/a/20965843
score: 0
type: Comment
has text: Yes. But is the init cost of the collection much worse than the set up for the Array?
type: AnswerComment

http://stackoverflow.com/comment/31418159
score: 0
type: Comment
type: QuestionComment
has text: @AndrewThompson I will definitely try out Swing
comment on: http://stackoverflow.com/q/20903193

http://stackoverflow.com/q/20967953
has comment: http://stackoverflow.com/comment/32896951
has title: Composition is not rendered in Richfaces tabPanel
has comment: http://stackoverflow.com/comment/31501077
tagged with: richfaces
has comment: http://stackoverflow.com/comment/32897205
has comment: http://stackoverflow.com/comment/32895506
upvote count: 1
accepted answer: http://stackoverflow.com/a/20970160
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31507601
tagged with: jsf
score: 1
tagged with: java
has body: I am a user of JSF and Richfaces. I will simplify the code about my question to make things easier. I have a composition named 'mytab.xhtml' defined like following: &lt;cc:interface&gt; &lt;cc:attribute name="header" required="true"/&gt; &lt;/cc:interface&gt; &lt;cc:implementation&gt; &lt;rich:tab id="my-tab" header="#{cc.attrs.header}" &gt; &lt;cc:insertChildren /&gt; &lt;/rich:tab&gt; &lt;/cc:implementation&gt; This composition is used in another xhtml file like following: &lt;rich:tabPanel id="tp" switchType="ajax" headerPosition="top" &gt; &lt;ic:mytab id="tab1" header="header1"&gt; &lt;h:outputText&gt;content1&lt;/h:outputText&gt; &lt;/ic:mytab&gt; &lt;ic:mytab id="tab2" header="header2"&gt; &lt;h:outputText&gt;content1&lt;/h:outputText&gt; &lt;/ic:mytab&gt; &lt;/rich:tabPanel&gt; But it is very strange that the tab is not rendered at all. To find the reason, if I add an outputText in the composition definition file like this: &lt;cc:interface&gt; &lt;cc:attribute name="header" required="true"/&gt; &lt;/cc:interface&gt; &lt;cc:implementation&gt; &lt;h:outputText&gt;#{cc.attrs.header}&lt;/h:outputText&gt; &lt;rich:tab id="my-tab" header="#{cc.attrs.header}" &gt; &lt;cc:insertChildren /&gt; &lt;/rich:tab&gt; &lt;/cc:implementation&gt; The outputText will be rendered, but tab is not rendered. Or, if I change one of the tab to richfaces tab directly: &lt;rich:tabPanel id="tp" switchType="ajax" headerPosition="top" &gt; &lt;ic:mytab id="tab1" header="header1"&gt; &lt;h:outputText&gt;content1&lt;/h:outputText&gt; &lt;/ic:mytab&gt; &lt;rich:tab id="tab2" header="header2"&gt; &lt;h:outputText&gt;content1&lt;/h:outputText&gt; &lt;/rich:tab&gt; &lt;/rich:tabPanel&gt; The first tab will not be rendered, but the second tab will be rendered. Thank you if you could give me any help.
has comment: http://stackoverflow.com/comment/32710047
has comment: http://stackoverflow.com/comment/32896155
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32708803
has comment: http://stackoverflow.com/comment/32535183
has answer: http://stackoverflow.com/a/20970160

http://stackoverflow.com/comment/31393520
score: 2
has text: phaaa very nice question, I'll be wainting for answer to this question too
comment on: http://stackoverflow.com/q/20911867
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20864696
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: stream
type: Question
tagged with: hashmap
has title: How to fix this logical error in reading a file to a hashmap
accepted answer: http://stackoverflow.com/a/20864832
has body: I am passing in String str = "First Name: John\n Last Name: GrannySmith\nBirthday: January 1 2014\n First Name: George\n Last Name: Smith\nBirthday: January 2 2014 "; into the following method public static void sortMap(String str) { String[] parsedInput = str.split("\n"); Set&lt;String&gt; information = new HashSet&lt;String&gt;(); Map&lt;String, Set&lt;String&gt;&gt; myMap = new HashMap&lt;String, Set&lt;String&gt;&gt;(); for (int i = 0; i &lt; parsedInput.length; i++) { String firstName = ""; if (parsedInput[i].startsWith("First Name")) { firstName = parsedInput[i].split(": ")[1]; } else { while (!(parsedInput[i].startsWith("First Name"))) { information.add(parsedInput[i].split(": ")[1]); } } myMap.put(firstName, information); System.out.println(myMap.get(firstName)); } } What I am trying to do is store my data into a hashmap where utimatley if the user enters in their first name then i can display their entire information. The information is being stored in a file. The file is being read. I have split the file where ever there is a next line. If the next like happens to be First name I then know that I want to have a new key and value that is why I have the if statements. The while loop is to ensure that all the information of that person is stored for that particular key (such that if I add in address, id etc it will all be stored within that particular key). When I run this I get a result of "[]". As opposed to the information. I am not sure where I am going wrong with my logic here? It also seems that I am stuck in an infinite loop.
answer count: 1
has answer: http://stackoverflow.com/a/20864832

http://stackoverflow.com/a/20897781
has comment: http://stackoverflow.com/comment/31366538
type: Answer
has comment: http://stackoverflow.com/comment/31366637
has comment: http://stackoverflow.com/comment/31366488
has body: I did a demo for you, note JTextPane related problem seemed a littile complex ,I haven't master it all sides. The demo give you some possible way to do it,you need to improve it to meet your need. Select the text and click the button to see the style change. code as follow: package com.learningjava; import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.text.AttributeSet; import javax.swing.*; import javax.swing.text.*; /** * Note: code is a possible way to do * you need to improved it to meet your requirements * * @author wangdq * 2013-1-3 */ public class TextPaneStyleTest { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable(){ @Override public void run() { // TODO Auto-generated method stub JFrame frame = new TextStyleTestFrame(); frame.setSize(300, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } } /** * TextPane style test frame * Select text and click the button to see style change */ class TextStyleTestFrame extends JFrame { public TextStyleTestFrame() { super("TextPaneStyle Test"); textPane.setText("Smaple String"); this.add(textPane,BorderLayout.CENTER); JPanel panel = new JPanel(); panel.add(btnStyle); this.add(panel,BorderLayout.NORTH); btnStyle.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { changeStyle(); } }); } /** * change style according to your rule */ private void changeStyle() { //get selected text style StyledDocument doc=(StyledDocument)textPane.getDocument(); int selectionEnd=textPane.getSelectionEnd(); int selectionStart=textPane.getSelectionStart(); if(selectionStart == selectionEnd) { return; } Element element=doc.getCharacterElement(selectionStart); AttributeSet as = element.getAttributes(); //apply a new style based on previous MutableAttributeSet asNew = new SimpleAttributeSet(as.copyAttributes()); StyleConstants.setBold…
score: 0
answers question: http://stackoverflow.com/q/20897208
has comment: http://stackoverflow.com/comment/31366368

http://stackoverflow.com/comment/31513806
has text: @TimB is there anything I can/should do to improve the question, or should I just wait it out and see how the voting goes? I've been a reader for many years, but am a new poster, and I want to be a "good citizen".
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20957314
score: 0

http://stackoverflow.com/comment/31281708
type: Comment
type: QuestionComment
has text: http://stackoverflow.com/questions/27581/overriding-equals-and-hashcode-in-java
comment on: http://stackoverflow.com/q/20852961
score: 0

http://stackoverflow.com/comment/31418113
score: 0
comment on: http://stackoverflow.com/a/20923805
type: Comment
type: AnswerComment
has text: this is the log: [ec2-user@ip-172-31-8-38 datastore]$ ant createschema [schematool] Exception Details: [schematool] Location: [schematool] ips/data/entities/BaseStation.jdoReplaceFlags()V @4: ifnull [schematool] Reason: [schematool] Expected stackmap frame at this location. [schematool] Bytecode: [schematool] 0000000: 2ab4 00a6 c600 112a 2ab4 00a6 2ab9 0107 [schematool] 0000010: 0200 b501 09b1 [schematool]

google-cloud-datastore
tags question: http://stackoverflow.com/q/21001260
tags question: http://stackoverflow.com/q/20944368
tag name: google-cloud-datastore
tags question: http://stackoverflow.com/q/20881819
tags question: http://stackoverflow.com/q/20882174
tags question: http://stackoverflow.com/q/20852505
type: Tag
tags question: http://stackoverflow.com/q/20937071

http://stackoverflow.com/q/20910832
tagged with: regex
has body: In Java, I'm trying to write a regex to match a special kind of HTTP URL: http://&lt;any-string-of-1-or-more-chars&gt;/#&lt;any-string-of-0-or-more-chars&gt; So the string has 4 segments: The string literal: "http://"; then Any string of 1+ chars; then The string literal: "/#"; then Any string of 0+ char Examples of "passing" strings: http://example.com/# http://example.com/#fizz http://z.example.com/# etc. My best attempt is: String regex = "http://*/#*"; However when I try it out: String test = "http://example.com/#"; String regex = "http://*/#*"; if(test.matches(regex)) System.out.println("I match!"); else System.err.println("I don't match!"); Where am I going wrong, and what should my regex be (and why)?
score: 2
type: AnsweredQuestion
has title: Java regex for special URL
tagged with: java
has comment: http://stackoverflow.com/comment/31391100
accepted answer: http://stackoverflow.com/a/20910861
type: Question
possible better answer: http://stackoverflow.com/a/20910868
has answer: http://stackoverflow.com/a/20910868
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/20910861
upvote count: 2

http://stackoverflow.com/q/20927971
has answer: http://stackoverflow.com/a/20928011
upvote count: 1
tagged with: collections
possible better answer: http://stackoverflow.com/a/20928127
has answer: http://stackoverflow.com/a/20928127
type: AnsweredQuestion
tagged with: list
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31423834
has title: Using Collections method to sort something specific from a class
has comment: http://stackoverflow.com/comment/31423837
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/20928011
downvote count: 0
tagged with: sorting
tagged with: arraylist
favorite count: 0
has body: Making an assignment and I've stumbled upon something I can't seem to fix nor properly seem to Google. So I made a basic class like this with 3 attributes: public class Planeet { private int diameter; private String naam; private double relatieveMassa; public Planeet(int diameter, String naam, double relatieveMassa) { this.diameter = diameter; this.naam = naam; this.relatieveMassa = relatieveMassa; }} Now I made another class where I made an ArrayList from the class above and it contains methods to print out the list in different kinds: public class Planeten { private List&lt;Planeet&gt; planeten = new ArrayList&lt;Planeet&gt;(); public void sorteer(){ Collections.sort(??); }} Now my question is, how can I sort it on a specific attribute from my first class? Thanks in advance and sorry if this is a silly question.
has comment: http://stackoverflow.com/comment/31423904

http://stackoverflow.com/a/20977779
has comment: http://stackoverflow.com/comment/31517815
has comment: http://stackoverflow.com/comment/31518070
answers question: http://stackoverflow.com/q/20977361
upvote count: 2
type: Answer
has body: static Pattern validPattern = Pattern.compile("^(\\-{0,1}\\d+\\s)*(\\-){0,1}\\d+$"); public static void main(String[] args) { isStringValid("1 2 3 4 5"); isStringValid("1 26 35 44 53"); isStringValid("1 2a 3s 4 5"); isStringValid("1234"); isStringValid("1"); isStringValid("1 "); isStringValid("a b c"); isStringValid("1 b c"); isStringValid("1 1 2 33333"); isStringValid("-1 1 2 33333"); isStringValid("1 1 2 -33333"); isStringValid("1 1 2 ----33333"); isStringValid("---1 1 2 -33333"); } public static boolean isStringValid(String s){ s = s.trim(); boolean b = validPattern.matcher(s).find(); if (b){ System.out.printf("%s: is valid.\n", s); }else{ System.out.printf("%s: is NOT valid.\n", s); } return(b); } Result: 1 2 3 4 5: is valid. 1 26 35 44 53: is valid. 1 2a 3s 4 5: is NOT valid. 1234: is valid. 1: is valid. 1: is valid. a b c: is NOT valid. 1 b c: is NOT valid. 1 1 2 33333: is valid. -1 1 2 33333: is valid. 1 1 2 -33333: is valid. 1 1 2 ----33333: is NOT valid. ---1 1 2 -33333: is NOT valid.
score: 1
downvote count: 1

http://stackoverflow.com/comment/31401501
score: 0
has text: To go into your problem, the model is not something you should need to change as your content changes. The model is the responsible for handling the changes and accesing the data. Then the JTable displays the data provided by the model. Try to start over and do what you are trying to do with a simple little table independent of the rest of your program. Look at the tutorials and examples to know how to make changes in the data and properly notify the table of them. In the AbstractTableModel there are even `fireTableXXX()` to notifiy the table.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20915678

http://stackoverflow.com/q/20985481
favorite count: 0
tagged with: rest
has body: So I have this HATEOAS entity. @Entity @Table(name="users") public class User extends ResourceSupport { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name="id") private long id; public User() { } public Long getId() { return new Long(id); } public void setId(Long id) { this.id = id.longValue(); } } My entity has an id of type long, but HATEOAS's ResourceSupport requires that getId return a Link. The entity has a Long id because the db has a long id, and it is a persisted entity. How can I implement this entity with HATEOAS?
tagged with: spring
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20985555
has comment: http://stackoverflow.com/comment/31532676
has comment: http://stackoverflow.com/comment/31532770
tagged with: java
tagged with: spring-hateoas
score: 9
type: Question
upvote count: 9
answer count: 2
possible better answer: http://stackoverflow.com/a/29841099
has answer: http://stackoverflow.com/a/20985555
has title: Java: compile conflict: return type is incompatible with HATEOAS ResourceSupport.getId
tagged with: jpa
downvote count: 0
has answer: http://stackoverflow.com/a/29841099

http://stackoverflow.com/comment/31320468
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20873096
has text: This does not compile.
score: 0

http://stackoverflow.com/q/20919219
answer count: 1
favorite count: 0
has title: Advantage of using @Test(enabled = false) over the commenting @Test annotation in TestNG
tagged with: testng
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/20919522
type: Question
accepted answer: http://stackoverflow.com/a/20919522
has body: I know that @Test(enabled = false) will ignore the test for the annotated method. But why can't we just Comment the annotation to ignore. I mean what is the advantage of using @Test(enabled = false) over the commenting @Test annotation?
downvote count: 0

http://stackoverflow.com/comment/31593001
has text: Meno Hochschild: Thank you.I will make lenient to be false.
comment on: http://stackoverflow.com/a/20994992
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31596989
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21017190
has text: The hoster is an id to a fragment encapsulating the viewpager.

http://stackoverflow.com/comment/31393637
type: Comment
has text: Thanks, I was looking for something like `System.getProperty("file.separator")`.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/20911494

http://stackoverflow.com/comment/31341124
has text: Just thinking about having to (yet again) solve the problem of tracing changes to managed entities gives me cold chills. Please: use an existing ORM package. If you don't want to take my word for it, check out how huge the source code of OpenJPA is and then ask yourself the question: do I really believe I am so good that I can do it with less code than that?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20884418
score: 1

http://stackoverflow.com/comment/31476547
score: 2
has text: There are many definitions of "not working". Which one are you referring to?
comment on: http://stackoverflow.com/q/20956020
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31488273
score: 0
type: Comment
has text: @acarlon: Yes I meant \t in all the above and not /t, sorry for that. The string is read from a text file. These are actual tabs and I used a symbols because tabs are not typed here. The first part of matching (using ptrn1, matcher1) goes through correctly. The debugger shows that for example, in the first iteration, the value of next piece is set to "Be plan,/t". This looks like a literal string, which is used as an argument to ptrn2.matcher(nextpiece). However, like I ve mentioned, matcher2.group() gives an error, and matcher2.matches() returns false.
comment on: http://stackoverflow.com/a/20960600
type: AnswerComment

http://stackoverflow.com/comment/31502965
type: QuestionComment
comment on: http://stackoverflow.com/q/20969932
score: 0
has text: _"Do I really need setters and getters in my Hero class and I have the feeling that I am using them incorrectly."_ - `private` fields with getters and setters is good practice. And you seem to be using them fine.
type: Comment

http://stackoverflow.com/a/20878166
accepted answer of: http://stackoverflow.com/q/20877662
type: Answer
answers question: http://stackoverflow.com/q/20877662
upvote count: 24
has body: It seems your FILE appender has the wrong class. I use ch.qos.logback.core.rolling.RollingFileAppender You miss the .rolling in the path.
score: 24
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/65410660
type: Answer
has body: As part of traversing the Tree with BFS and storing the elements in Q. In each level, you can check how many elements are in the Q before adding the next level elements. Queue&lt;Node&gt; q = new LinkedList&lt;&gt;(); q.offer(head); while (!q.isEmpty()){ int levelSize = q.size(); for (int i=0; i&lt;levelSize; i++){ Node n = q.poll(); System.out.print(n.val); if (n.left!=null) q.offer(n.left); if (n.right!=null) q.offer(n.right); } System.out.println(&quot;&quot;); }
answers question: http://stackoverflow.com/q/20902223
score: 0

http://stackoverflow.com/a/20921305
has comment: http://stackoverflow.com/comment/31410805
has comment: http://stackoverflow.com/comment/31411210
has comment: http://stackoverflow.com/comment/31410956
has comment: http://stackoverflow.com/comment/31411132
type: Answer
has comment: http://stackoverflow.com/comment/31410862
answers question: http://stackoverflow.com/q/20921083
has comment: http://stackoverflow.com/comment/31410772
has comment: http://stackoverflow.com/comment/31410960
has comment: http://stackoverflow.com/comment/31410909
has comment: http://stackoverflow.com/comment/31411182
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31410816
has comment: http://stackoverflow.com/comment/31410885
has comment: http://stackoverflow.com/comment/31410928
has body: One way to do what I think you're asking for is to use a CyclicBarrier (from java.util.concurrent), parameterising it with two "parties". The first thread to call await on the barrier will be suspended/blocked until a second thread also calls await, at which point both threads can proceed. Here's a simple code sample: import java.util.concurrent.CyclicBarrier; public class Test { public static void main(String[] args) { // a barrier requiring two threads to call await before // any thread can proceed past the barrier final CyclicBarrier barrier = new CyclicBarrier(2); new Thread(){ @Override public void run() { try { // do some stuff System.out.println("in thread, before the barrier"); // calling await blocks until two threads // (this one and one other) have called await barrier.await(); // do some more stuff System.out.println("in thread, after the barrier"); } catch (Exception e) { e.printStackTrace(); } } }.start(); try { System.out.println("main thread, before barrier"); // calling await blocks until two threads // (this one and one other) have called await barrier.await(); System.out.println("main thread, after barrier"); } catch (Exception exc) { exc.printStackTrace(); } } }
has comment: http://stackoverflow.com/comment/31410896
has comment: http://stackoverflow.com/comment/31410760
has comment: http://stackoverflow.com/comment/31411190
has comment: http://stackoverflow.com/comment/31410734
has comment: http://stackoverflow.com/comment/31411014
has comment: http://stackoverflow.com/comment/31410891
upvote count: 1
has comment: http://stackoverflow.com/comment/31410689
has comment: http://stackoverflow.com/comment/31410904
has comment: http://stackoverflow.com/comment/31411186
has comment: http://stackoverflow.com/comment/31411031
has comment: http://stackoverflow.com/comment/31410913

http://stackoverflow.com/q/20881957
has comment: http://stackoverflow.com/comment/31336328
tagged with: date
has comment: http://stackoverflow.com/comment/31337668
type: Question
tagged with: boolean
answer count: 2
tagged with: validation
possible better answer: http://stackoverflow.com/a/20882090
has answer: http://stackoverflow.com/a/20882090
has comment: http://stackoverflow.com/comment/31336322
tagged with: class
score: 0
has comment: http://stackoverflow.com/comment/31336372
has answer: http://stackoverflow.com/a/20882095
has comment: http://stackoverflow.com/comment/31336330
has comment: http://stackoverflow.com/comment/31336344
accepted answer: http://stackoverflow.com/a/20882095
has body: Any idea why my code won't show the result? Maybe I messed up something, just new to programming by the way. The goal of the program is to see if the date given by the main class is valid or not, it's not that specific on details such as the month of February and leap years so its pretty simple. This is my DataRec.java : public class DateRec { int month, day, year; boolean good; public DateRec (){ month = 1; day = 1; year = 2008; good = true; } public DateRec (int setMonth, int setDay, int setYear){ month = setMonth; day = setDay; year = setYear; } public void validate (){ if ((month &lt; 0) || (month &gt; 12)){ good = false; if (year == 0) good = false; if ((day &lt; 0) || (day &gt; 31)) good = false; } } @Override public String toString() { if (good = true) { return String.format("%dd/%dd/%dddd", month, day, year); } else { return String.format("%dd/%dd/%dddd", month, day, year); } } } This is my main class DataRecTest.java: public class DateRecTest { public static void main (String[] args){ DateRec today = new DateRec(1,2,2014); DateRec anyDay = new DateRec(); DateRec noDay = new DateRec(13,31,2014); anyDay.validate(); today.validate(); noDay.validate(); today.toString(); anyDay.toString(); noDay.toString(); } }
type: AnsweredQuestion
tagged with: java
has title: Result does not show, date validation

http://stackoverflow.com/q/20979270
tagged with: swing
has answer: http://stackoverflow.com/a/20979288
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: keylistener
tagged with: jtextfield
has body: I'm trying to make a JTextField which will only allow numeric input and only allow two characters (in other words will only allow numbers 0-99). I've looked at some tutorials and attempted to limit input to only numbers so far. The problem with my code so far though is that is accepts all key inputs. I tried reversing the greater than and less than symbols and it stopped accepting any input at all. I believe the problem lies in the key character codes, but some help would be nice as I can't find anything helpful (everywhere I look has different keymaps for Java). if(event.getSource() == txtMasterSound) { if(event.getKeyCode() &lt; 0 || event.getKeyCode() &gt; 9) { System.out.println("Your input was invalid"); event.consume(); } else { System.out.println("Your input was valid"); return; } } As for the limiting characters, I don't really know where to start, so some pointing in the right direction would also be nice.
type: Question
has title: How can I limit JTextField input to just numbers and only 2 chars?
possible better answer: http://stackoverflow.com/a/20979919
answer count: 2
has answer: http://stackoverflow.com/a/20979919
downvote count: 0
accepted answer: http://stackoverflow.com/a/20979288
linked to: http://stackoverflow.com/q/9345750
tagged with: keycode
favorite count: 0
has comment: http://stackoverflow.com/comment/31520599
has comment: http://stackoverflow.com/comment/31520641
upvote count: 1

http://stackoverflow.com/comment/129723126
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/46685022
has text: The Init-statement fixed the issue for me

http://stackoverflow.com/q/20953126
has answer: http://stackoverflow.com/a/20956008
type: Question
answer count: 1
tagged with: jar
has title: SQLite and sqlite-jdbc doesn't work when exported
score: 0
has comment: http://stackoverflow.com/comment/31471830
tagged with: sqlite
tagged with: jdbc
has comment: http://stackoverflow.com/comment/31471164
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31471348
has comment: http://stackoverflow.com/comment/31473453
has body: I have created JAVA application using SQLite database and sqlite-jdbc-3.7.2 driver. Everything works in Eclipse, but once I export my application as jar, and run it, it creates the database in current directory, but doesn't connect to it. How to fix this? Class.forName("org.sqlite.JDBC"); conn = DriverManager.getConnection("jdbc:sqlite:soccer.db"); stmt = conn.createStatement();
tagged with: java
has comment: http://stackoverflow.com/comment/31472047

http://stackoverflow.com/q/20858356
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/20859088
has comment: http://stackoverflow.com/comment/31291718
tagged with: paintcomponent
has body: I declared and built an array of two Balls instances ' m_ball[0]=new Ball(400,400,400,180);' &amp; ' m_ball[1]=new Ball(400,400,400,0);' with different parameter values (180 and 0) but for some reason it seems that this different values get reset to 0 when the Timer start running and than both balls place on the same XY location. Can someone see why? I'm new in programming, Many Thanks... . //This is main public class BBDemo extends JApplet{ ........... } }//endclass BBDemo public class BBPanel extends JPanel { BallInBox m_bb; // The moving ball panel ///in order to take the Timer-&gt;setAnimation from m_bb //========================================================== constructor /** Creates a panel with the controls and moving ball display. */ BBPanel() { //... Create components m_bb = new BallInBox(); // The moving ball panel ......... startButton.addActionListener(new StartAction()); ......... } }//endclass BBPanel public class BallInBox extends JPanel { private Ball m_ball[]= new Ball[2]; //... Instance variables for the animation private int m_interval = 40; // Milliseconds between updates. static Timer m_timer; // Timer fires to animate one step. static int j; private Color Pigment; //=================================================== constructor /** Set panel size and creates timer. */ public BallInBox() { ......... m_timer = new Timer(m_interval, new TimerAction()); addMouseListener(new PressBall()); m_ball[0]=new Ball(400,400,400,180); m_ball[1]=new Ball(400,400,400,0); } public void setAnimation(boolean turnOnOff) { if (turnOnOff) { m_timer.start(); j=1; // start animation by starting the timer. } else { m_timer.stop(); j=0; // stop timer } } //======================================================= paintComponent public void paintComponent(Graphics g) { super.paintComponent(g); // Paint background, border ........ g.setColor(Pigment); m_ball[0].draw(g); // Draw the ball. m_ball[1].draw(g); } class TimerAction implements ActionListener { public void action…
tagged with: java-2d
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20858567
upvote count: 1
tagged with: swing
type: Question
tagged with: graphics
score: 1
tagged with: java
has title: Why both ovals located at the same XY?

editor
tags question: http://stackoverflow.com/q/20885312
tags question: http://stackoverflow.com/q/20938846
tag name: editor
type: Tag

http://stackoverflow.com/comment/31295807
score: 0
comment on: http://stackoverflow.com/a/20860014
type: Comment
has text: I moved that tag. But the grid table is coming without any data. Number of rows are correct to the grid table. But all the rows are blank / empty.
type: AnswerComment

http://stackoverflow.com/comment/31528086
has text: I tired to catch my problem by taking screenshot and it seems that it's only a visual effect of that multiple sprites, moreover at Android the movement to left and right is correct. That code you wrote is to get bodys from world and then find out which one is a player(or platform) body, it's a way i learned with tutorials. There is also a Player class where all logic without rendering is handled.
type: AnswerComment
comment on: http://stackoverflow.com/a/20960857
score: 0
type: Comment

http://stackoverflow.com/a/20891779
answers question: http://stackoverflow.com/q/20891388
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20891388
has comment: http://stackoverflow.com/comment/31355477
has comment: http://stackoverflow.com/comment/31356243
type: Answer
has body: Remove android:configure from your app widget metadata, or have it point to an activity to be used for configuring the app widget. You can read more about configuration activities in the documentation.

http://stackoverflow.com/comment/31292849
type: QuestionComment
has text: Kind of hard, unless you want me to post about 35,000 lines of code! Trust me, the servlet creates a brand-new Action in doGet(), the Action reads a pile of XML from a database, and one of the XML nodes creates the process as above. If these snippets are correct, and I can't see anything wrong with them either, the only other explanation I can think of is a bug in Runtime.exec().
score: 0
comment on: http://stackoverflow.com/q/20858207
type: Comment

websphere-8
tags question: http://stackoverflow.com/q/21006073
type: Tag
tag name: websphere-8

http://stackoverflow.com/comment/31301001
type: QuestionComment
comment on: http://stackoverflow.com/q/20862199
type: Comment
score: 0
has text: I know the 1st and 3rd image are the same. I was just showing 2 separate snippets of code were both producing the incorrect layout. And also, 1st and 3rd images also have the 4th TextView so why aren't those parent layouts being expanded horizontally like the 2nd image?

http://stackoverflow.com/q/20895175
has answer: http://stackoverflow.com/a/20895223
has comment: http://stackoverflow.com/comment/31361966
has answer: http://stackoverflow.com/a/20895210
downvote count: 1
possible better answer: http://stackoverflow.com/a/20895484
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31361844
has body: I've got a method that creates a String and another method that changes Strings void create(){ String s; edit(s); System.out.println(s); } void edit(String str){ str = "hallo"; } My compiler says that it "may not have been initialized". Can someone explain this?
has answer: http://stackoverflow.com/a/20895484
upvote count: 3
tagged with: java
linked to: http://stackoverflow.com/q/40480
has comment: http://stackoverflow.com/comment/31362247
type: Question
has comment: http://stackoverflow.com/comment/31361893
has answer: http://stackoverflow.com/a/20895260
has comment: http://stackoverflow.com/comment/31362152
has title: "Variable may not have been initialized"
has comment: http://stackoverflow.com/comment/31361831
has comment: http://stackoverflow.com/comment/31362257
has comment: http://stackoverflow.com/comment/31361827
has comment: http://stackoverflow.com/comment/31361961
answer count: 4
tagged with: reference
favorite count: 0
accepted answer: http://stackoverflow.com/a/20895260
has comment: http://stackoverflow.com/comment/31361852

http://stackoverflow.com/a/20929733
has body: public class GUI_Tests extends JFrame { private JButton button; public GUI_Tests() { setTitle("Title"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // so that the application properly closes when you click close button = new JButton("pls work"); add(button); pack(); // resize the frame to its contents setLocationRelativeTo(null); // center the frame on the screen } public static void main(String args[]) { // properly start a swing application SwingUtilities.invokeLater(new Runnable() { @Override public void run() { GUI_Tests gui = new GUI_Tests(); gui.setVisible(true); // set the frame visible } }); } } hope this helps you understand it a bit more. i didn't use any layouts in this code as its just a simple example, however, i highly recommend you to read on built-in layouts in swing and how to use them. Here's one good start
upvote count: 1
has comment: http://stackoverflow.com/comment/31427371
answers question: http://stackoverflow.com/q/20929618
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31427441

http://stackoverflow.com/comment/31515765
score: 0
type: AnswerComment
type: Comment
has text: @RavitD: "If I have the jar and a res directory in it, do you happen to know how to load it as a bitmap?" -- I would assume that you [use `JarFile`](http://developer.android.com/reference/java/util/jar/JarFile.html) to get an `InputStream` on the image entry in the file, then use `BitmapFactory` to decode the image to a `Bitmap`.
comment on: http://stackoverflow.com/a/20976485

http://stackoverflow.com/q/20993262
has answer: http://stackoverflow.com/a/20993474
tagged with: criteria
tagged with: jpa
has title: Hibernate / JPA using criteria as annotations
upvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31545849
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate
tagged with: hibernate-criteria
type: Question
has body: Does anybody know if it's possible to impose criteria on an object property via annotations. This would be similar to the @Where clause, however the attribute that I need to filter by is not actually on the table the SELECT is performed on since it is mappedBy. Hopefully this example will illustrate: public class Container { @OneToMany(mappedBy = "container") private List&lt;Item&gt; items; //getter &amp; setter ... } public class Item { @ManyToOne private Container container; @OneToOne(mappedBy = "item") private User user; //getter &amp; setter ... } public class User { @OneToOne private Item item; //getter &amp; setter ... } I would like to fetch a Container where there is no User associated. If the user attribute was really on the Item table it should be possible to use @Where: public class Container { @OneToOne(mappedBy = "container") @Where(clause = "user is null") private List&lt;Item&gt; items; //getter &amp; setter ... } But since it is mappedBy is there a way of doing this? The join on these tables is obviously already performed in the SQL. Maybe there is a way of referencing the user attribute e.g. HQL? Any help much appreciated

http://stackoverflow.com/comment/31284714
comment on: http://stackoverflow.com/q/20854803
type: Comment
type: QuestionComment
score: 1
has text: You need to use adapter.getCount() instread of lstView.getChildCount()

http://stackoverflow.com/q/21001961
has body: The javax.xml.parsers.DocumentBuilder prints a message in std:err. Example below: import java.io.*; import javax.xml.parsers.*; import org.w3c.dom.*; public class FooMain { public static Document slurpXML(String s) throws Exception { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document rv = builder.parse(new ByteArrayInputStream(s.getBytes("UTF-8"))); return rv; } public static void main(String args[]) throws Exception { try { slurpXML("foo"); } catch (Exception e) {} // try to silence it - in vain } } Despite the try-catch block, running the program from the command line produces: $ java -classpath dist/foo.jar FooMain [Fatal Error] :1:1: Content is not allowed in prolog. I want to use DocumentBuilder in a console utility and I don't want the output to be cluttered. Is there a way to silence it?
has answer: http://stackoverflow.com/a/21002185
score: 5
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21002151
tagged with: java
tagged with: dom
type: Question
answer count: 2
upvote count: 5
downvote count: 0
accepted answer: http://stackoverflow.com/a/21002151
has title: javax.xml.parsers.DocumentBuilder parse quietly not possible?
possible better answer: http://stackoverflow.com/a/21002185
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has comment: http://stackoverflow.com/comment/31562469

http://stackoverflow.com/comment/31563405
type: Comment
comment on: http://stackoverflow.com/a/21002339
type: AnswerComment
score: 0
has text: You could change the Tomcat port in the plugin configuration: http://tomcat.apache.org/maven-plugin-2.2/run-mojo-features.html. Try to place it in 9090 port.

http://stackoverflow.com/q/20885825
answer count: 1
accepted answer: http://stackoverflow.com/a/20886020
favorite count: 0
has title: How to change the child element in SOAPBODY
has comment: http://stackoverflow.com/comment/31343955
tagged with: soap
type: AnsweredQuestion
upvote count: 1
tagged with: web-services
has body: I have a soapMessage which i am writing to a ByteArrayOutputStream to log the request But I have to change p803:Credential child element value before i log it, how can I do this? ByteArrayOutputStream out = new ByteArrayOutputStream(); soapMessageCtx.getMessage().writeTo(out); Here is the request xml &lt;soapenv:Body&gt; &lt;p803:multiple xmlns:p803="http://www.abc.com/model"&gt; &lt;p803:RequestContext&gt; &lt;p803:Credential&gt;2222222/iuuiiiuuuu&lt;/p803:Credential&gt;
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31343560
tagged with: xml-parsing
has comment: http://stackoverflow.com/comment/31343658
has comment: http://stackoverflow.com/comment/31343606
has answer: http://stackoverflow.com/a/20886020
downvote count: 0

http://stackoverflow.com/comment/49211385
type: AnswerComment
comment on: http://stackoverflow.com/a/20969007
type: Comment
has text: Im confused, shouldn't the BOM be FE FF? Why is it 76~ 77. in your printout?
score: 2

http://stackoverflow.com/comment/31381668
score: 0
has text: Thanks! I was looking and looking, and this wasn't clear from docs. But I'll go dig it up now.
type: Comment
comment on: http://stackoverflow.com/a/20906226
type: AnswerComment

http://stackoverflow.com/q/20949392
has answer: http://stackoverflow.com/a/20952832
has title: How to run a Google Glass GDK sample on the device?
answer count: 1
score: 4
favorite count: 0
tagged with: google-glass
tagged with: android
upvote count: 4
has body: I start developing Google Glass app with GDK . I use Eclipse with Android SDK Manager to install the GDK. After that, I import the Google Glass project following the steps mentioned here: Click File > New Project > Android Sample Project Select Glass Development Kit as the build target and click Next. Select the Timer sample and click Finish. In the Eclipse Package Explorer, right click the sample and select Run as > Android Application with Glass connected to your development system. The Google Glass (version XE12) is connected, but nothing shows up. Then, I follow another tutorial online to launch the App manually using an adb command: ./adb shell am start -n com.google.android.glass.sample.timer/.MenuActivity But the result is a Permission Denial: $ ./adb shell am start -n com.google.android.glass.sample.timer/.MenuActivity Starting: Intent { cmp=com.google.android.glass.sample.timer/.MenuActivity } java.lang.SecurityException: Permission Denial: starting Intent { flg=0x10000000 cmp=com.google.android.glass.sample.timer/.MenuActivity } from null (pid=2938, uid=2000) not exported from uid 10032 at android.os.Parcel.readException(Parcel.java:1327) at android.os.Parcel.readException(Parcel.java:1281) at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1631) at com.android.commands.am.Am.runStart(Am.java:441) at com.android.commands.am.Am.run(Am.java:108) at com.android.commands.am.Am.main(Am.java:81) at com.android.internal.os.RuntimeInit.finishInit(Native Method) at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:238) at dalvik.system.NativeStart.main(Native Method) How to solve the problem ? On the other hand, I made an App similar to the Android example using Eclipse. After I click Run as > Android Application in Eclipse menu bar, the console said: [2014-01-06 18:55:10 - Glass001] Android Launch! [2014-01-06 18:55:10 - Glass001] adb is running normally. [2014-01-06 18:55:10 - Glass001] No Launcher activity found! [2014-01-06 18:…
downvote count: 0
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20952832
tagged with: java
tagged with: eclipse
tagged with: google-gdk
linked to: http://stackoverflow.com/q/12384152

http://stackoverflow.com/comment/31588555
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21015304
has text: FunkTheMonk : I've done it, but still error. ThaiTran : there are many problem on problem view, but I didn't find the problem from that library. ᴍarounᴍaroun : thanks.. I still try all the answer. user1902288 : that why you dislike eclipse GrIsHu : it is a library.. Thanks very much for your answer :)

http://stackoverflow.com/a/20872920
score: 4
has body: As in EJP comment my previous suggestion that its caused by missing &amp;isCopy was wrong, Iam leaving only ReleaseStringUTFChars part. I can only suggest adding logging before and after suspiciously looking calls, also you should look into logcat, android sometimes outputs there hints when something wrong happens with jni in native code. Also you must call: ReleaseStringUTFChars after using str
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31420429
has comment: http://stackoverflow.com/comment/31357389
has comment: http://stackoverflow.com/comment/31323734
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/20872907
downvote count: 0
has comment: http://stackoverflow.com/comment/31356332
accepted answer of: http://stackoverflow.com/q/20872907
has comment: http://stackoverflow.com/comment/31354185
has comment: http://stackoverflow.com/comment/31332660

http://stackoverflow.com/comment/31329623
comment on: http://stackoverflow.com/q/20877952
has text: @SureshkumarPanneerselvan onClick is not the attribute to be used to invoke a method on the managed bean.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31409765
comment on: http://stackoverflow.com/q/20920498
type: Comment
type: QuestionComment
has text: Why do you think that MariuszS? I think assylias proved quite opposite down under
score: 0

ldap
tags question: http://stackoverflow.com/q/20983547
tags question: http://stackoverflow.com/q/20964150
tags question: http://stackoverflow.com/q/20912006
tags question: http://stackoverflow.com/q/20936138
tags question: http://stackoverflow.com/q/20934344
tags question: http://stackoverflow.com/q/20946063
tags question: http://stackoverflow.com/q/20975072
tag name: ldap
tags question: http://stackoverflow.com/q/20877645
tags question: http://stackoverflow.com/q/20925108
tags question: http://stackoverflow.com/q/20867103
type: Tag
tags question: http://stackoverflow.com/q/20963889

http://stackoverflow.com/comment/31280471
score: 0
type: Comment
has text: it still adds the whole numbers inputed
comment on: http://stackoverflow.com/a/20852069
type: AnswerComment

http://stackoverflow.com/comment/31415073
comment on: http://stackoverflow.com/q/20923561
has text: another question java noob lol. these layouts have like more ways to customize the positioning of components? and am assuming that they are used a lot in industry right?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31282627
has text: Is that better than using Canvas?
score: 0
comment on: http://stackoverflow.com/q/20853351
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20862453
has body: Try using the &amp;nbsp; or &amp;emsp;. The first one is non-breaking white space, and the second one is breaking whitespace. I don't think it'll matter in either case for your use case. How to insert a space between two variables in JSP? You can also try. &lt;div class=&lt;c:out value="${properties['class_1']} ${properties['class_2']}" /&gt;&gt; Not sure how the JSP will handle nested tags like that.
answers question: http://stackoverflow.com/q/20862386
score: 0
type: Answer

http://stackoverflow.com/comment/35291200
type: Comment
comment on: http://stackoverflow.com/a/23077767
has text: exactly.. in the end this question is about mocking "primitive wrapper classes" -> **just instanciate the damn thing**! Keep mocks for complex objects whose behavior cannot be easily fixed within unit tests.
score: 0
type: AnswerComment

http://stackoverflow.com/a/20919437
downvote count: 0
has body: First of all I'd advise you to not use the standad JSON library. It is extremely low-level and doesn't offer any kind of convenience. The LibGDX JSON utilities may be a bit hard to use at first, but once you know how they work (reading the code may help understanding its capabilities a lot), they are really powerful and you can convert most classes even without any custom Serializer, because it uses reflection internally. If you have problems with it, you could ask specific questions on how to do it. Otherwise you might also have a look at other JSON libraries like Jackson which is also available on mobile platforms. If you don't need all this power and convenience, then you can also use the standard JSON java classes. Just download the classes and copy them in your project. The license allows this: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software... You just have to distribute a copy of the license with your software.
has comment: http://stackoverflow.com/comment/31407957
type: Answer
upvote count: 3
score: 3
accepted answer of: http://stackoverflow.com/q/20919079
answers question: http://stackoverflow.com/q/20919079
type: AcceptedAnswer

http://stackoverflow.com/comment/31405427
comment on: http://stackoverflow.com/q/20918386
type: QuestionComment
has text: Looks like homework. Are you looking for loops? for, while? http://docs.oracle.com/javase/tutorial/java/nutsandbolts/for.html
type: Comment
score: 2

http://stackoverflow.com/q/20916938
tagged with: command-line
has answer: http://stackoverflow.com/a/20924188
has comment: http://stackoverflow.com/comment/31403151
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20917278
downvote count: 1
has title: Bash: change a line in a file iteratively and read pass file.txt to a program
tagged with: java
score: -1
type: Question
has comment: http://stackoverflow.com/comment/31403158
answer count: 2
tagged with: sed
has body: I try to make this very simple bash program that must make the following operations: 1) modify a file java n times: every time i must change a single word in a single line of the file (the line is 11) i know there is the following command that replace a single word in a particular line of a program wih another one: sed -i "11s/1/$n/" IC_masslessPlanetesimal.java if i do the above command i can modify only one time the file.java because in the second iteration of the for cycle i have not the same word as in the first iteration: i start with 1 in line 11, than in the fist iteration i change with $n (that is equal to 2), but now HOW i can modify the sed command to change again the word (that is now equal to 2) to have, for example, 3 in the 11th line? 2) compile the file java: it's ok; 3) modify a file.txt: again the same problem as in 1) i want to change a word in a line iteratively with a for cycle or something like that; 4) pass it to an executable file: this is the second problem. I have modify the param.txt file and now i want to read it into an executable file called exec. If i do this from the terminal i must launch the exec. program with the command ./exec and after that i must write from screen the file.txt name. Now is it possible to launch a program from bash and read with it the file.txt? I try with: sed -i "13s/Zero/$n/" param.txt ./exec &lt; param.txt that script must change the line 13 from Zero to $n in param.txt how i can launch the exec program with the command ./exec with the specific param.txt file. #!/bin/bash n=0 for n in "2" "3" do sed -i "11s/1/$n/" IC_masslessPlanetesimal.java javac IC_masslessPlanetesimal.java java IC_masslessPlanetesimal sed -i "13s/Zero/$n/" param.txt ./exec &lt; param.txt done thanks a lot !!!
upvote count: 0
has comment: http://stackoverflow.com/comment/31411563
favorite count: 0
tagged with: bash

http://stackoverflow.com/comment/31328125
has text: I guess you are bang on that * is interprestted by shell and thats why I am facing this problem. But to use grep `.` and recursivly is expensive and impacts on performance as it will include unwanted files to grep whic I would like to avoid. On other note, what would be the best way to tackle * in grep? any ideas?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20876475

http://stackoverflow.com/q/20968745
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31500976
has comment: http://stackoverflow.com/comment/31552929
tagged with: java
has body: The goal is to run simple script using GroovyShell in an Eclipse plugin. Purpose of the script is to get some info about the workspace. Groovy itself is embedded into Eclipse in form of an OSGi plugin built from groovy-all-xxx.jar. The plugin containing the script has dependencies (among others) to org.eclipse.core.runtime and org.eclipse.core.resources. Part of the code executing the script: Map&lt;String, Object&gt; varmap = new HashMap&lt;String, Object&gt;(); varmap.put("workspace", ResourcesPlugin.getWorkspace()); Binding binding = new Binding(varmap); GroovyShell shell = new GroovyShell(new GroovyClassLoader(getClass().getClassLoader()), binding); System.out.println(shell.evaluate("return workspace.getRoot().getProject(\"abc\").getName()")); This gets me: org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError: [Lorg/eclipse/core/runtime/IPluginPrerequisite ... Caused by: java.lang.ClassNotFoundException: org.eclipse.core.runtime.IPluginPrerequisite cannot be found by org.eclipse.equinox.registry_3.5.301.v20130717-1549 (full stack here) Note that everything works fine when those workspace operations are called from plain Java code. I guess that might be caused by E4's DI feature using it's own classloader. But what makes the difference causing the code not to be running inside the GroovyShell? Anyone?
tagged with: eclipse
type: Question
score: 0
tagged with: groovy
has comment: http://stackoverflow.com/comment/31500692
tagged with: osgi
has title: GroovyShell in OSGi environment
answer count: 0

http://stackoverflow.com/q/20963348
has body: I am working on a game that selects a random word and the user have to find it in less than 7 mistakes, if he makes 7 mistakes he loses, if he makes less than 7 mistakes another word is given and his mistakes are kept. in the end the score is given. I have a txt file dictionnary, and I wan't to know how to select a word from it and put it in a variable, then show this word hidden in stars * in a JLabel thank you
type: Question
tagged with: random
has comment: http://stackoverflow.com/comment/31491694
upvote count: 0
answer count: 1
tagged with: user-interface
has comment: http://stackoverflow.com/comment/31491262
favorite count: 0
has answer: http://stackoverflow.com/a/20964078
tagged with: jlabel
has comment: http://stackoverflow.com/comment/31491410
score: -3
has comment: http://stackoverflow.com/comment/31491533
has title: Random word from a dictionnary GUI
downvote count: 3
accepted answer: http://stackoverflow.com/a/20964078
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/31503230
type: Comment
type: AnswerComment
score: 0
has text: Another flaw I see is the killer thread should get scheduled only after the main computing thread starts its execution (in order not to kill it prematurely only because it didn't have a free thread to work in)
comment on: http://stackoverflow.com/a/20958663

http://stackoverflow.com/comment/31517923
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/20977922
has text: This is not a homework question and answer site.

http://stackoverflow.com/q/20896947
type: Question
score: 1
tagged with: java
has title: historisation concept / library / framework in java or php?
has comment: http://stackoverflow.com/comment/31364967
answer count: 1
downvote count: 0
tagged with: data-structures
favorite count: 0
type: UnansweredQuestion
tagged with: php
has body: I am looking for a historicizing concept for php or java. Imagine this usecase: you are on page 1 you delete a random entry on page 2 you create an entry with random content on page 3 you delete all together on page 4 you add a random entry now I want to 'undo' and go back to step 3. Is there something out there that would me having a nice history concept out of the box? E.g. I guess you would need something that keeps the model as a set of subsequent changes to a base. The view would have the calculated results of these changes. Going back would be very easy, just execute only a subset.
has answer: http://stackoverflow.com/a/20922906
has comment: http://stackoverflow.com/comment/31364902
upvote count: 1
tagged with: design-patterns

http://stackoverflow.com/comment/31425403
type: AnswerComment
type: Comment
has text: whats a map? Excuse my ignorance, Im new to java
comment on: http://stackoverflow.com/a/20928771
score: 0

http://stackoverflow.com/a/21014989
score: 7
type: AcceptedAnswer
has body: there are many tools to see the almost real time process state, like: top htop dstat Also, in linux, you can explore system state, including cpu information, process information, network and interface information and so fourth under /proc folder. This is where all the data that tools extract from.
has comment: http://stackoverflow.com/comment/31587119
answers question: http://stackoverflow.com/q/21014902
upvote count: 7
type: Answer
accepted answer of: http://stackoverflow.com/q/21014902
downvote count: 0
has comment: http://stackoverflow.com/comment/31587149

http://stackoverflow.com/comment/31576335
has text: For a math-heavy application where you have the choice of programming language, take a lool into [Julia](http://julialang.org). Having written quite a lot of mathematical code for web applications in the past, Java would not be my choice today.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21009207

http://stackoverflow.com/comment/31481157
comment on: http://stackoverflow.com/a/20956861
type: Comment
has text: Error free, _except for the StackOverflow exception_ due to the infinite recursion in the constructor.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31314295
comment on: http://stackoverflow.com/q/20866917
type: Comment
type: QuestionComment
has text: possible duplicate of [Collection Alternative - ConcurrentModificationException](http://stackoverflow.com/questions/911462/collection-alternative-concurrentmodificationexception)
score: 0

http://stackoverflow.com/comment/31339519
score: 0
type: Comment
has text: but if I put `all= {btn1, btn2, btn3, btn4};` It got error. I can`t put `ImageButton[] all;` only
comment on: http://stackoverflow.com/a/20883496
type: AnswerComment

http://stackoverflow.com/comment/31412826
comment on: http://stackoverflow.com/a/20921748
type: Comment
score: 1
has text: +1, but should it not wrap to `-2 ^ 31` instead of `-2 ^ 31 - 1`?
type: AnswerComment

http://stackoverflow.com/comment/31493004
type: Comment
has text: No, sadly I need the bounding box to rotate, since the sprite has to rotate and the bounding box has to contain all of the sprite and only the sprite. I wish I could make it an axis-aligned rectangle, it would make things much easier for me. When you look at my rotation code, do you see anything problematic?
comment on: http://stackoverflow.com/a/20961277
type: AnswerComment
score: 0

http://stackoverflow.com/a/20945870
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/20909703
answers question: http://stackoverflow.com/q/20909703
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: Thinking of JCR as a "file system on steroids" is often a good idea to help structure content. In Adobe CQ for example we use a tree that's fairly similar to a unix filesystem, with /libs, /apps, /etc, /var, /content etc. That helps make sense of the content, separate between system and user content and also helps setup the overall access control. In my opinion this makes a lot of sense for the macro structure of your content, i.e. the overall organization of things. Once you get down to micro structures that represent content pages or other data I usually forget about the filesystem and think in terms of abstract and extensible micro-trees. http://wiki.apache.org/jackrabbit/DavidsModel also has good pointers on how to structure content. My "JCR view of the world" talk, from Berlin Buzzwords 2012, gives a number of examples of how to structure JCR content, the video is at http://vimeo.com/44298693

http://stackoverflow.com/q/20889877
has comment: http://stackoverflow.com/comment/31351288
has comment: http://stackoverflow.com/comment/31351435
upvote count: 3
score: 0
downvote count: 3
answer count: 1
has body: Given 3 methods method1(), method2(), and method3() what would be the easiest way to run them all at the same time? (Example code would be much appreciated) private void method1(){ for(int x=0; x &lt;= 5; x++){ System.out.println("method 1: " + x); } } private void method2(){ for(int x=0; x &lt;= 5; x++){ System.out.println("method 2: " + x); } } private void method3(){ for(int x=0; x &lt;= 5; x++){ System.out.println("method 3: " + x); } } I would like to run them concurrently, but the output should be as follows: method 1: 1 method 2: 1 method 3: 1 method 1: 2 method 2: 2 method 3: 2 method 1: 3 method 2: 3 method 3: 3 method 1: 4 method 2: 4 method 3: 4 method 1: 5 method 2: 5 method 3: 5 I do understand the idea of multithreading however I am unsure of how to implement it in the above way.
favorite count: 0
has answer: http://stackoverflow.com/a/20889899
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31370770
tagged with: multithreading
has title: Run several methods concurrently but in order
type: Question
has comment: http://stackoverflow.com/comment/31351344
tagged with: java

http://stackoverflow.com/comment/31351477
comment on: http://stackoverflow.com/a/20889836
has text: The second command is not for compiling, it's for running the program.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/137880095
score: 0
type: Comment
has text: The above solution works like a charm. Just adding the closing slash for closing the input tag, and violla! Everything worked as expected
comment on: http://stackoverflow.com/a/20880641
type: AnswerComment

http://stackoverflow.com/comment/31558008
type: AnswerComment
comment on: http://stackoverflow.com/a/20999860
type: Comment
has text: No this is not the problen because i already tried Thread.sleep for 3000 miliseconds. But it won't worked.
score: 0

http://stackoverflow.com/a/20869574
answers question: http://stackoverflow.com/q/20869559
upvote count: 1
score: 1
downvote count: 0
has body: You are very close. Your for loop condition says to loop as long as i is less than or equal to alist.size(). If you do that, you'll always run one over. For example, if you only have one item in alist, your size will be 1, but you really only want to loop until 0. Change this: for(int i = 0; i &lt;= alist.size() ; i++) To this: for(int i = 0; i &lt; alist.size() ; i++)
type: Answer

http://stackoverflow.com/comment/31572507
has text: A URL path element is not a directory.
comment on: http://stackoverflow.com/q/21007287
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/32833826
type: QuestionComment
type: Comment
has text: I think you may be able to get java files from war or jar file by [decomiple it][1]. [1]: http://stackoverflow.com/questions/647116/how-to-decompile-a-whole-jar-file
comment on: http://stackoverflow.com/q/20867791
score: 0

http://stackoverflow.com/a/20905147
type: Answer
score: 1
answers question: http://stackoverflow.com/q/20905123
upvote count: 1
has body: -D is used to provide a system property to your java program. So you need to provide it while running your java program: java -Dmbrola.base=/home/jim/mbrola -jar bin/FreeTTSHelloWorld.jar mbrola_us1 yourJavaClass If you are using an IDE such as eclipse then you can do the same by going to: Run -> Run configurations, select project, second tab: “Arguments”. Top box is for your program, bottom box is for VM arguments, e.g. -Dmbrola.base=/home/jim/mbrola -jar bin/FreeTTSHelloWorld.jar mbrola_us1
downvote count: 0
has comment: http://stackoverflow.com/comment/31379759
has comment: http://stackoverflow.com/comment/31379654

http://stackoverflow.com/a/20945765
has comment: http://stackoverflow.com/comment/31457752
upvote count: 1
downvote count: 0
type: Answer
score: 1
has body: Your only problem here is that you don't understand how to do the time analysis. If you have one routine which takes O(n) and one which takes O(n*log(n)), running both takes a total of O(n*log(n)). Thus your code runs in O(n*log(n)) like you want. To do things formally, we would note that the definition of O() is as follows: f(x) ∈ O(g(x)) if and only if there exists values c > 0 and y such that f(x) &lt; cg(x) whenever x > y. Your merge sort is in O(n*log(n)) which tells us that its running time is bounded above by c1*n*log(n) when n > y1 for some c1,y1. Your duplication elimination is in O(n) which tells us that its running time is bounded above by c2*n when n > y2 for some c2 and y2. Using this, we can know that the total running time of the two is bounded above by c1*n*log(n)+c2*n when n > max(y1,y2). We know that c1*n*log(n)+c2*n &lt; c1*n*log(n)+c2*n*log(n) because log(n) > 1, and this, of course simplifies to (c1+c2)*n*log(n). Thus, we can know that the running time of the two together is bounded above by (c1+c2)*n*log(n) when n > max(y1,y2) and thus, using c1+c2 as our c and max(y1,y2) as our y, we know that the running time of the two together is in O(n*log(n)). Informally, you can just know that faster growing functions always dominate, so if one piece of code is O(n) and the second is O(n^2), the combination is O(n^2). If one is O(log(n)) and the second is O(n), the combination is O(n). If one is O(n^20) and the second is O(n^19.99), the combination is O(n^20). If one is O(n^2000) and the second is O(2^n), the combination is O(2^n).
has comment: http://stackoverflow.com/comment/31457593
answers question: http://stackoverflow.com/q/20937409

http://stackoverflow.com/comment/31502002
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20968700
has text: @Jerry, I'm updating it right now.
score: 1

http://stackoverflow.com/comment/31536169
has text: I do not want to reference the jar. Why it be referenced, and how?
comment on: http://stackoverflow.com/a/20987524
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31340512
has text: String sn = null; i get error that varialbe sn is defined as string[] and i get the error cannot find symbol method size()
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20881739

http://stackoverflow.com/q/21002996
downvote count: 3
type: Question
has answer: http://stackoverflow.com/a/21003332
has answer: http://stackoverflow.com/a/21003073
answer count: 8
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31563953
upvote count: 5
has answer: http://stackoverflow.com/a/21003022
linked to: http://stackoverflow.com/q/2941900
possible better answer: http://stackoverflow.com/a/21003019
has answer: http://stackoverflow.com/a/21003804
has answer: http://stackoverflow.com/a/21003070
has answer: http://stackoverflow.com/a/21003019
duplicate of: http://stackoverflow.com/q/2941900
has title: If something is deprecated, can I still use it?
favorite count: 0
has answer: http://stackoverflow.com/a/21003043
tagged with: android
has comment: http://stackoverflow.com/comment/31564049
has answer: http://stackoverflow.com/a/21003388
has body: In my Eclipse Android App I use type Date. I am warned that this is a deprecated type. Does this mean I cannot use it, or merely that it is bad practice to? Thanks for the help!!
accepted answer: http://stackoverflow.com/a/21003043
score: 2
tagged with: deprecated
tagged with: java

http://stackoverflow.com/q/20905496
has answer: http://stackoverflow.com/a/20905549
has answer: http://stackoverflow.com/a/20905525
favorite count: 0
tagged with: constructor
has body: Can we override a constructor of super class in sub class of the same class. If yes, how? If no, why? class Super{} class Sub extends Super { //write code, if yes }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20907873
has title: Constructor Overriding in Java
has answer: http://stackoverflow.com/a/20905792
upvote count: 3
tagged with: java
type: Question
tagged with: overriding
downvote count: 0
has answer: http://stackoverflow.com/a/20905644
answer count: 6
tagged with: inheritance
has answer: http://stackoverflow.com/a/20905522
score: 3

http://stackoverflow.com/comment/31524295
type: Comment
has text: Print out all values with a `System.out.println(someVariable);`and see if they match up.
comment on: http://stackoverflow.com/q/20981057
score: 0
type: QuestionComment

http://stackoverflow.com/q/20903900
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31381702
has comment: http://stackoverflow.com/comment/31377291
tagged with: java
has comment: http://stackoverflow.com/comment/31377642
has answer: http://stackoverflow.com/a/20906380
has title: JPA OneToMany insert not setting the id's correctly
type: Question
has comment: http://stackoverflow.com/comment/31388733
accepted answer: http://stackoverflow.com/a/20906380
tagged with: jpa
answer count: 1
has body: I have two entities, let's say Person.java: @Entity public class Person implements Serializable { @Id @GeneratedValue(strategy = AUTO) private long id; @OneToMany(mappedBy = "personData", cascade = CascadeType.PERSIST) private List&lt;SkillsData&gt; skillsData; // ... } SkillsData.java @Entity @Table(name = "SkillsData") public class SkillsData implements Serializable { @Id @GeneratedValue(strategy = AUTO) private long id; @JoinColumn(name = "PERSONID") @ManyToOne(cascade = REMOVE) private Person personData; // ... } When I create a person, add a list of type SkillsData to it's skillsData field and persist it everything works with no exceptions thrown, but when I browse the database directly in the SkillsData table the field PERSONID is not populated and because of that the skills added can't be referenced to the right person. I'm trying to fix this problem for quite some time and I'll be thankful for any help.
score: 0
tagged with: one-to-many
tagged with: many-to-one
has comment: http://stackoverflow.com/comment/31378125

http://stackoverflow.com/comment/31391750
score: 0
comment on: http://stackoverflow.com/q/20911127
has text: For Java, I usually use [jdee](http://jdee.sourceforge.net/) when I'm in emacs.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21017453
type: Answer
has comment: http://stackoverflow.com/comment/40836083
has comment: http://stackoverflow.com/comment/84265463
downvote count: 0
has comment: http://stackoverflow.com/comment/75119172
accepted answer of: http://stackoverflow.com/q/21017404
answers question: http://stackoverflow.com/q/21017404
has comment: http://stackoverflow.com/comment/31590574
has comment: http://stackoverflow.com/comment/31590849
score: 187
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/84262204
has body: Use writeSerializable where Date is Serializable. (But not a good idea. See below for another better way) @Override public void writeToParcel(Parcel out, int flags) { // Write object out.writeSerializable(date_object); } private void readFromParcel(Parcel in) { // Read object date_object = (java.util.Date) in.readSerializable(); } But Serializing operations consume much performance. How can overcome this? So better use is to convert date into Long while writing, and read Long and pass to Date constructor to get Date. See below code @Override public void writeToParcel(Parcel out, int flags) { // Write long value of Date out.writeLong(date_object.getTime()); } private void readFromParcel(Parcel in) { // Read Long value and convert to date date_object = new Date(in.readLong()); }
upvote count: 187
has comment: http://stackoverflow.com/comment/114037994
has comment: http://stackoverflow.com/comment/31590974

http://stackoverflow.com/comment/68134379
type: AnswerComment
has text: Note that in more recent versions of libgdx, `filledRect()` is now just `rect()`.
type: Comment
comment on: http://stackoverflow.com/a/20889462
score: 3

http://stackoverflow.com/a/20859209
upvote count: 2
has body: You need to make sure that you have configured your keystore with your certificates in the server.xml config file for Tomcat (located at /conf/server.xml). The line should look something like this: &lt;Connector protocol="HTTP/1.1" port="8443" maxThreads="200" scheme="https" secure="true" SSLEnabled="true" keystoreFile="/path/to/keystore.keystore" keystorePass="&lt;keystorepassword&gt;" clientAuth="false" sslProtocol="TLS"/&gt; If you have already done this, it is possible the certificate you generated does not use ciphers that Tomcat considers secure. You may need to regenerate your certificates with more secure ciphers, or configure Tomcat to allow more cipher types. More information on setting up Tomcat with SSL is available in the Tomcat documentation here: http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Quick_Start
has comment: http://stackoverflow.com/comment/31319004
has comment: http://stackoverflow.com/comment/31303976
downvote count: 0
answers question: http://stackoverflow.com/q/20858964
has comment: http://stackoverflow.com/comment/31342620
type: Answer
score: 2

http://stackoverflow.com/q/20858021
linked to: http://stackoverflow.com/q/7373567
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/20859143
has title: Create Mat object in a Java client, sent from a C++ server using opencv
tagged with: c++
tagged with: opencv
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
type: Question
upvote count: 2
has body: My C++ server sends a video stream from a computer's usb to a Java client. In order to send an image(Mat object) from C++ I'm using FileStorage class to store the image in a string: cv::FileStorage fs(".xml", cv::FileStorage::WRITE + cv::FileStorage::MEMORY); fs &lt;&lt; "mymatrix" &lt;&lt; frame; string buff = fs.releaseAndGetString(); //buff has all the Mat object info. The client receives buff ,creates XML file and reads it using : Java: How to read and write xml files? The image datatype is "3u" (=CV_8UC3), so I created a byte array to store the matrix data: //data is a string that contains the matrix data byte[] Bdata = data.getBytes(); and used this code to create the Mat object ( taken from https://groups.google.com/forum/#!topic/android-opencv/QEwhgO88ZwM ): //Irows = number of rows //Icols = number of columns Mat mat = new Mat(Irows,Icols,CvType.CV_8UC3); mat.put(0,0,Bdata); but "mat.put.." is generating this error: Exception in thread "main" java.lang.UnsupportedOperationException: Provided data element number (3742097) should be multiple of the Mat channels count (3) I don't understand what is the problem with the byte array? Any idea would be appreciated. Edit : Though I'm not near my computer, so I can't confirm this, it appears that the large number in the error is the length of the array and it doesn't divide by 3 - the number of channels. I've no idea why.
accepted answer: http://stackoverflow.com/a/20859143

http://stackoverflow.com/comment/31523707
has text: Thanks for the comments and answers. And sorry for spelling issues, used my phone
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20980154
score: 0

http://stackoverflow.com/comment/31350488
comment on: http://stackoverflow.com/a/20889240
has text: @Johnny: Yup, that way you do not have to rely on the execution commands. :)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31504605
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20970913
has text: Well.. [it is](https://www.nytexaminer.com/wp-content/uploads/2011/12/Flat-World.jpg).
type: Comment

http://stackoverflow.com/a/20924048
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/31416348
score: 1
downvote count: 0
has body: I would recommend openCSV: http://opencsv.sourceforge.net/ I have used it for numerous Java projects requiring CSV support, both reading and writing. A simple example of how it writes a CSV from the docs: CSVWriter writer = new CSVWriter(new FileWriter("yourfile.csv"), ','); // feed in your array (or convert your data to an array) String[] entries = "first,second,third".split(","); writer.writeNext(entries); writer.close(); Assuming you can make a String[] out of your data it's that simple. To deal with comma's in your entries you'd need to quote the entire entry: `Make,Take,Break", "Top,Right,Left,Bottom", With OpenCSV you can provide a quote character,you just pass it in the constructor: CSVWriter writer = new CSVWriter(new FileWriter("yourfile.csv"), ',', '"'); That should take care of the needs you listed.
has comment: http://stackoverflow.com/comment/31416492
answers question: http://stackoverflow.com/q/20923583

http://stackoverflow.com/comment/31584922
has text: So you consider both v and parent to be a ViewGroup then ? I'll update code some more so we check that first
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21014032
type: Comment

http://stackoverflow.com/comment/79156750
score: 0
type: AnswerComment
has text: `borderPane.setRight(null)` doesn't actually remove the child node from the `BorderPane`; you will still see this child in `borderPane.getChildren()`.Probably this is okay in most cases, but if you later wanted to `borderPane.setRight()` again to the previous child, you'd encounter an exception.
type: Comment
comment on: http://stackoverflow.com/a/20885039

yahoo
type: Tag
tag name: yahoo
tags question: http://stackoverflow.com/q/20875252

http://stackoverflow.com/comment/31429830
score: 1
has text: Welcome :). The problem is that when you called the script, the `countryName` span didn't exist in the html yet. Just in case I'm editing the answer (adding `window.onload`)so order doesn't matter and you can put your script anywhere.
type: AnswerComment
comment on: http://stackoverflow.com/a/20930587
type: Comment

http://stackoverflow.com/q/20869819
has comment: http://stackoverflow.com/comment/31314072
has answer: http://stackoverflow.com/a/20871901
tagged with: http
accepted answer: http://stackoverflow.com/a/20871901
type: Question
has body: I'm using this simple code below to send an http request: import java.net.*; import java.io.*; public class URLConnectionReader { public static void main(String[] args) throws Exception { URL yahoo = new URL("http://www.yahoo.com/"); URLConnection yc = yahoo.openConnection(); BufferedReader in = new BufferedReader( new InputStreamReader( yc.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null) System.out.println(inputLine); in.close(); } } But it doesn't work. I've got always the same error: Exception in thread "main" java.net.ConnectException: Connection timed out: 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 java.net.Socket.connect(Unknown Source) at sun.net.NetworkClient.doConnect(Unknown Source) at sun.net.www.http.HttpClient.openServer(Unknown Source) at sun.net.www.http.HttpClient.openServer(Unknown Source) at sun.net.www.http.HttpClient.&lt;init&gt;(Unknown Source) at sun.net.www.http.HttpClient.New(Unknown Source) at sun.net.www.http.HttpClient.New(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) My OS: Windows 7. I can't find where is the problem. I've no internet connection problem. I've already tried by getting off my firewall but It does not solve the problem. I think it's not a network problem because I've a similar c# code that works.
has comment: http://stackoverflow.com/comment/31313885
has title: Connection Timeout When Sending HTTP Request in Java
has comment: http://stackoverflow.com/comment/34496376
answer count: 2
has comment: http://stackoverflow.com/comment/31313830
upvote count: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/22694627
has comment: http://stackoverflow.com/comment/31314447
has answer: http://stackoverflow.com/a/22694627
tagged with: request
has comment: http://stackoverflow.com/comment/31313870
has comment: http://stackoverflow.com/comment/31313783
has comment: http://stackoverflow.com/comment/31314217
type: AnsweredQuestion
downvote count: 0
linked to: http://stackoverflow.com/q/22623188
score: 1
tagged with: java

http://stackoverflow.com/comment/31369972
score: 0
has text: @Raghunandan.....in the manifest i have mentioned as Henry posted ... ........ i just want to correct my self where i am going wrong here
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/20899305

http://stackoverflow.com/comment/31515112
has text: Where you want your image? You need to understand that you are using a RelativeLayout you need to set a position to your imageview
score: 0
comment on: http://stackoverflow.com/q/20976337
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31353206
type: QuestionComment
comment on: http://stackoverflow.com/q/20890762
has text: Look at this post: http://stackoverflow.com/questions/9927281/how-to-use-flush-for-printwriter
score: 0
type: Comment

http://stackoverflow.com/q/20938086
answer count: 1
has body: I am programming an app with the use of OpenGL and SurfaceView. I need to detect when an activity finishes and I return to my activity. I need it because I don't want to respond to touch and key events until my activity is shown. Now I detect it with onResume, but onResume is called before the finishing activity disappears. I need to enable these events when my activity is being shown (mostly because of onBackPressed). Anyone with a solution? EDIT: find some information about it, so when the activity is doing something in its onStop/onDestroy method, then it is after onResume of my activity was called -> my problem http://developer.android.com/guide/components/activities.html#CoordinatingActivities EDIT2: onStop and onDestroy are called when activity is not showing EDIT3: found that it is caused because of new thread doing work in onPause, still no solution
has comment: http://stackoverflow.com/comment/31444003
has comment: http://stackoverflow.com/comment/31444419
score: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/20938141
has comment: http://stackoverflow.com/comment/31444111
has comment: http://stackoverflow.com/comment/31443782
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31443868
tagged with: java
has answer: http://stackoverflow.com/a/20938141
type: Question
has title: Activity receive onResume event before another disappear

encode
tags question: http://stackoverflow.com/q/20879639
type: Tag
tag name: encode

http://stackoverflow.com/a/20954939
score: 1
answers question: http://stackoverflow.com/q/20949311
has body: A solution I found to this was to write a second recovery serialized file that just holds the file length after each item is added to it. Then if there is a problem deserialising data the program knows where it can find the "next good" value. However there is a catch, once you have read a byte you can't reread it without starting all over again (.reset() throws an UnsupportedOperationException) and sometimes Kryo starts reading into the next good object before it realises it's choking on a bad object. My solution to this was to use the data in the seperate file to detect how many bytes to read for each object, read them as bytes and then pass that to Kryo to deserialize. All this has some overhead but the whole thing is still wildly faster than standard Java deserialization for my tests and it could be used only in "recovery mode". This is demonstrated by the following program which leaves bad values as nulls (but could do anything it wanted). public class AppleHolder implements Serializable,KryoSerializable{ int numberOfApples=10; Apple[] apples=new Apple[numberOfApples]; double otherData=15; public AppleHolder(){ BadApple sharedBad=new BadApple(0); for(int i=0;i&lt;numberOfApples;i++){ if (i&gt;3 &amp;&amp; i&lt;=6){ apples[i]=new Apple(i); }else{ apples[i]=new BadApple(); } } } public void write (Kryo kryo, Output output) { int[] recoveryTrack=new int[apples.length+1]; //last one for after the last entry for(int i=0;i&lt;apples.length;i++){ recoveryTrack[i]=output.total(); kryo.writeClassAndObject(output, apples[i]); } recoveryTrack[recoveryTrack.length-1]=output.total(); kryo.writeObject(output,otherData); Output outputRecovery; try { outputRecovery = new Output(new FileOutputStream("testfile.recovery")); kryo.writeObject(outputRecovery, recoveryTrack); outputRecovery.close(); } catch (FileNotFoundException ex) { //I guess hopefully we won't need the recovery track Logger.getLogger(AppleHolder.class.getName()).log(Level.SEVERE, null, ex); } } public void read (K…
upvote count: 1
downvote count: 0
type: Answer

http://stackoverflow.com/q/20871030
has answer: http://stackoverflow.com/a/20871280
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/20871284
type: UnansweredQuestion
tagged with: encryption
tagged with: android
has answer: http://stackoverflow.com/a/21268925
has body: I have an app that encrypts the pixels of an image and then decrypts them. The encryption code is: File file = new File(fullPath, "uoc" +format +".png"); BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file)); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteBuffer bb = ByteBuffer.allocate(image.getByteCount()); image.copyPixelsToBuffer(bb); byte[] b = bb.array(); image.copyPixelsFromBuffer(ByteBuffer.wrap(encrypt_image(b, password))); image.compress(Bitmap.CompressFormat.PNG, 100, baos); byte[] b2 = baos.toByteArray(); bos.write(b2); bos.flush(); bos.close(); So right now I can open the file and I see noise, that's just what I want. Once it works I need to decrypt the content of the image with no success :( My code is similar than the one to encrypt: ByteBuffer bb = ByteBuffer.allocate(image_file.getByteCount()); image_file.copyPixelsToBuffer(bb); byte[] b = bb.array(); // Decrypt decryptedData = Security.decrypt(key,b); image_file.copyPixelsFromBuffer(ByteBuffer.wrap(decryptedData)); The problems is in Security.decrypt(key,b) because it throws pad bloc corrupted exception. My encryption algorythm is: public static byte[] encrypt(byte[] raw, byte[] clear) throws Exception { SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.ENCRYPT_MODE, skeySpec); byte[] encrypted = cipher.doFinal(clear); return encrypted; } and decryption: public static byte[] decrypt(byte[] raw, byte[] encrypted) throws Exception { SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.DECRYPT_MODE, skeySpec); byte[] decrypted = cipher.doFinal(encrypted); return decrypted; } And I have checked that the key is the same in both cases. Anyone has an idea about how to solve that issue? EDIT: I have tried the next code but it throws exception as well: ByteBuffer bb = ByteBuffer.allocate(image.getByteCount()); image.copyPixelsToBuffer(b…
tagged with: java
tagged with: image-processing
tagged with: bitmap
type: Question
has title: Decrypt pixels of bitmap

http://stackoverflow.com/comment/31583104
score: 0
has text: no dear there is not any demo for this you have to do it by yourself.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20992221

http://stackoverflow.com/comment/31455184
score: 1
comment on: http://stackoverflow.com/a/20944292
type: AnswerComment
has text: Quite possibly not, but it adds complication for no obvious benefit, when you're *just* trying to copy data from one stream to another.
type: Comment

http://stackoverflow.com/a/20972021
type: Answer
accepted answer of: http://stackoverflow.com/q/20969465
upvote count: 1
answers question: http://stackoverflow.com/q/20969465
score: 1
type: AcceptedAnswer
has body: Change your adapter to following and just call getSelected on adapter. public class MyAdapter extends BaseAdapter { Context ctx; ArrayList&lt;Person&gt; plist; LayoutInflater linf; public PersonHolder ph=null; private ArrayList&lt;Integer&gt; selected=new ArrayList&lt;Integer&gt;(); public MyAdapter(Context ctx, ArrayList&lt;Person&gt; plist) { super(); this.ctx = ctx; this.plist = plist; } public class PersonHolder { public TextView age; public TextView name; public CheckBox check; } @Override public int getCount() { // TODO Auto-generated method stub return plist.size(); } @Override public Object getItem(int position) { // TODO Auto-generated method stub return plist.get(position); } @Override public long getItemId(int position) { // TODO Auto-generated method stub return 0; } @Override public View getView(final int position, View convertView, ViewGroup arg2) { // TODO Auto-generated method stub linf=(LayoutInflater) ctx.getSystemService(ctx.LAYOUT_INFLATER_SERVICE); if(convertView==null) { convertView=linf.inflate(R.layout.row_item, null); ph=new PersonHolder(); ph.age=(TextView) convertView.findViewById(R.id.text1); ph.name=(TextView) convertView.findViewById(R.id.text2); ph.check=(CheckBox) convertView.findViewById(R.id.checkBox1); convertView.setTag(ph); } else { ph=(PersonHolder) convertView.getTag(); } Person p=(Person) getItem(position); ph.age.setText(p.getAge()); ph.name.setText(p.getName()); ph.check.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton arg0, boolean arg1) { // TODO Auto-generated method stub // if(ph.check.isChecked()) // { ph.check.setSelected(arg1); if(arg1){ selected.add(position); }else{ selected.remove(position); } // } // else // { // ph.check.setSelected(false); // } } }); return convertView; } public ArrayList&lt;Integer&gt; getSelected(){ return selected; } }
downvote count: 0

http://stackoverflow.com/comment/31565252
score: 0
comment on: http://stackoverflow.com/q/21003479
type: Comment
type: QuestionComment
has text: The fest-assert library best practices have provided a example that is similar to my problem which includes a fail() method, but I haven't found this included in play. https://github.com/alexruiz/fest-assert-2.x/wiki/Tips-and-tricks#exception-assertions-best-practices (play uses some of the fest-assert)

http://stackoverflow.com/q/20858153
tagged with: jbutton
tagged with: netbeans
has title: Linking 2 jForms with a button - java
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/20865622
type: Question
tagged with: actionlistener
has answer: http://stackoverflow.com/a/20858223
has answer: http://stackoverflow.com/a/20945176
has body: I have 2 JForms in my project and I'm attempting to link one to the other with a button so once the button is click it display the JForm, my forms are called; home and store This is my code so far; private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { storeform = new store(); form.setVisible(true); }
answer count: 3
type: UnansweredQuestion
tagged with: swing

http://stackoverflow.com/comment/31382379
type: AnswerComment
has text: I marked it but i can't upvote it cause I haven't the min reputation :p
type: Comment
comment on: http://stackoverflow.com/a/20905535
score: 0

http://stackoverflow.com/q/20863082
type: Question
linked to: http://stackoverflow.com/q/20256183
has body: I got the following code: import java.awt.*; import javax.swing.*; public class GraphicPanel extends JPanel { public void paintComponent(Graphics g){ super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; g2d.setFont(new Font("Arial",Font.BOLD,24)); g2d.drawString("A",300,250); g2d.rotate(45 * Math.PI/180); g2d.drawString("B",300,250); } } It should rotate B and put it in the same place A is, but for some reason, B apears at a totally different location. Pretty sure I understand why that is. It's because the entire coordination system is manipulated when scaling, rotating etc (am I correct?) Anyway, I'd like to know how to rotate or scale an object, and still have it appear where it was before. For example in a game that keeps updating and displaying itself every 10 milliseconds, where a sprite is being rotated, but still stays where it was 10 millisceonds before. EDIT: Tried to search Google beforehand, guess the wording for this question is kind of tricky because I found nothing helpful. Thanks a lot :)
tagged with: java
has comment: http://stackoverflow.com/comment/31302018
accepted answer: http://stackoverflow.com/a/20863172
has title: How do I rotate a graphics object, without changing it's location?
answer count: 2
tagged with: rotation
downvote count: 0
has comment: http://stackoverflow.com/comment/31301610
linked to: http://stackoverflow.com/q/11911316
favorite count: 0
tagged with: graphics2d
possible better answer: http://stackoverflow.com/a/20863184
tagged with: paintcomponent
upvote count: 6
has answer: http://stackoverflow.com/a/20863184
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31301750
has answer: http://stackoverflow.com/a/20863172
score: 6
tagged with: swing
has comment: http://stackoverflow.com/comment/31301689

http://stackoverflow.com/comment/31418473
comment on: http://stackoverflow.com/q/20925219
has text: Are you sure you are using a recent version of `mysql-connector`? In very old version the driver class name was something else (unfortunately don't remember it). Is `com.mysql.jdbc.Driver` available in your jar file?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20857383
has comment: http://stackoverflow.com/comment/31290178
linked to: http://stackoverflow.com/q/17443201
answer count: 4
has answer: http://stackoverflow.com/a/20858410
has answer: http://stackoverflow.com/a/20858075
has body: My goal is to retrieve value from database and show in JSP. Radio button If the database data is Owner, the Owner radio button will be check. If the database data is Cashier, the Cashier will then be check. Dropdown list If the database data is Orange, then the Orange option will be selected. Below are my codes. Help will be appreciate. Thanks! :) Radio button <input type="radio" name="role" id="Owner" value="Owner" <c:if out='${staff.staffRole} == "Owner"'>checked</c:if>/> <input type="radio" name="role" id="Cashier" value="Cashier" <c:if out='${staff.staffRole} == "Cashier"'>checked</c:if>/> Dropdown list Apple Orange Durian
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/20858075
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20858314
has answer: http://stackoverflow.com/a/20858423
tagged with: database
possible better answer: http://stackoverflow.com/a/20858314
tagged with: radio-button
has comment: http://stackoverflow.com/comment/31289673
downvote count: 0
tagged with: jsp
score: 1
favorite count: 0
has title: Check Radio Button & Select Dropdown List According To Value Retrieved From Database in JSP
tagged with: html-select

http://stackoverflow.com/a/20919405
type: Answer
answers question: http://stackoverflow.com/q/20918902
has body: Add this: startActivity(task_intent);
score: 0

http://stackoverflow.com/comment/31373028
comment on: http://stackoverflow.com/q/20901205
type: Comment
score: 0
has text: Yes. Its working in command prompt. Sorry that was the mistake. But, why its still not running in Eclipse?
type: QuestionComment

http://stackoverflow.com/a/20938621
has comment: http://stackoverflow.com/comment/31461889
type: Answer
has comment: http://stackoverflow.com/comment/31461858
has comment: http://stackoverflow.com/comment/31461958
has body: You can get the desired results using the correct combinations of LayoutManagers. Don't limit yourself to one. Take advantage of the power than comes with combining/nesting layouts. Here's the technique I used A BoxLayout for the center buttons A GridLayout(1, 5) for a panel the consists of everything but the buttom-left button which is in its own FlowLayout with a LEADING alignment All wrapped in the JFrame default BorderLayout See the program below import java.awt.*; import javax.swing.*; public class BoxLayoutDemo { JButton button1 = new JButton("Button1"); public BoxLayoutDemo() { JPanel pane = new JPanel(new GridLayout(1, 5)); Box box = Box.createVerticalBox(); box.add(new JButton("Button 1")); box.add(Box.createVerticalStrut(20)); box.add(new JButton("Button 2")); box.add(Box.createVerticalStrut(20)); box.add(new JButton("Button 3")); box.add(Box.createVerticalStrut(20)); box.add(new JButton("Button 4")); box.add(Box.createVerticalStrut(20)); box.add(new JButton("Button 5")); box.add(Box.createVerticalStrut(20)); pane.add(new JPanel()); pane.add(new JPanel()); pane.add(box); pane.add(new JPanel()); pane.add(new JPanel()); JPanel pane2 = new JPanel(new FlowLayout(FlowLayout.LEADING)); pane2.add(new JButton("ButtonButton")); JFrame frame = new JFrame("GridBag Box"); frame.add(pane, BorderLayout.CENTER); frame.add(pane2, BorderLayout.SOUTH); frame.pack(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); frame.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable(){ public void run(){ new BoxLayoutDemo(); } }); } } Disclaimer : excuse the title of the frame. I was first thinking of combining GridBagLayout with the Box, but the way I did it was so much easier. Too lazy to change the title now that I've noticed it. For those who say what I did above is somewhat hackish (by adding empty panels), which maybe it is, you could also add the top panel and bottom panel to a containing pa…
has comment: http://stackoverflow.com/comment/31462205
answers question: http://stackoverflow.com/q/20934382
has comment: http://stackoverflow.com/comment/31462180
accepted answer of: http://stackoverflow.com/q/20934382
upvote count: 5
has comment: http://stackoverflow.com/comment/31461604
score: 5
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31461441

http://stackoverflow.com/a/20989992
has comment: http://stackoverflow.com/comment/31540282
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/20989860
answers question: http://stackoverflow.com/q/20989860
score: 1
upvote count: 1
has body: "Also, what is the best way to insert a timer and updating my view with this program?" Use a javax.swing.Timer. The basic structure is simple. It's just like using a button with an ActionListener, but instead the Timer fires the ActionEvent every so many millisecond, based on the duration you pass it. The constructor looks like this Timer(int duration, ActionListener) So a sample usage would be something like this, where 50 is the duration for every event to be fired public RoadNetwork() { Timer timer = new Timer(50, new ActionListener(){ public void actionPerformed(ActionEvent e) { // do something with image positions like loop through an array to move coordinates repaint(); } }); timer.start(); } Also, there's no need to call repaint() inside the paintComponent() method
has comment: http://stackoverflow.com/comment/31540313
type: AcceptedAnswer

http://stackoverflow.com/comment/31295689
comment on: http://stackoverflow.com/q/20860380
type: Comment
type: QuestionComment
score: 2
has text: It looks like you take one line of input and add it to the list 10 times. Is that what the program is supposed to do? What does the `saying` method do?

http://stackoverflow.com/comment/31326198
type: QuestionComment
has text: His question seems perfectly clear to me.
comment on: http://stackoverflow.com/q/20875189
score: 0
type: Comment

http://stackoverflow.com/comment/31493112
type: Comment
type: QuestionComment
has text: Can you please post an [SSCCE](http://sscce.org)
score: 1
comment on: http://stackoverflow.com/q/20964469

http://stackoverflow.com/q/20859137
has comment: http://stackoverflow.com/comment/31293391
has answer: http://stackoverflow.com/a/20859201
has comment: http://stackoverflow.com/comment/31293333
has answer: http://stackoverflow.com/a/20859346
has comment: http://stackoverflow.com/comment/31294071
has answer: http://stackoverflow.com/a/20859203
downvote count: 0
possible better answer: http://stackoverflow.com/a/20859346
has body: I have a class with all static methods which basically makes calls like ClassName#MethodName(). I want this class to be non-instantiable at all times and so I have set the constructor visibility to be private. This certainly avoids any instance of it being created from outside the class. I want to know if there is any technical term coined or any design pattern specifically designed for doing exactly this which I do not know of. Also this does not stop me or any other developer from instantiating it from within the same class. I want to know if it is possible to prevent doing that but keeping the same class behavior. Also, what are the other options, if any?
favorite count: 0
has comment: http://stackoverflow.com/comment/31293455
has answer: http://stackoverflow.com/a/20859228
answer count: 4
has comment: http://stackoverflow.com/comment/33155357
upvote count: 3
tagged with: java
has title: If I do not want to instantiate a class, what are my options?
type: Question
tagged with: instantiation
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/31293681
accepted answer: http://stackoverflow.com/a/20859228

http://stackoverflow.com/comment/38428823
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20912060
has text: Does JPA create efficient queries using db specific dialect (rownum for Oracle, TOP/LIMIT for other supported DBs) ?

class
tags question: http://stackoverflow.com/q/20869223
tags question: http://stackoverflow.com/q/20986935
tags question: http://stackoverflow.com/q/21006061
tags question: http://stackoverflow.com/q/20881957
tags question: http://stackoverflow.com/q/20911130
tags question: http://stackoverflow.com/q/20984472
tags question: http://stackoverflow.com/q/20925024
tags question: http://stackoverflow.com/q/21006099
tags question: http://stackoverflow.com/q/21017031
tags question: http://stackoverflow.com/q/20862919
tags question: http://stackoverflow.com/q/20931271
tags question: http://stackoverflow.com/q/20878039
tags question: http://stackoverflow.com/q/20970565
tags question: http://stackoverflow.com/q/20927735
tags question: http://stackoverflow.com/q/20939634
tags question: http://stackoverflow.com/q/20983834
tags question: http://stackoverflow.com/q/20884251
tags question: http://stackoverflow.com/q/20982639
tags question: http://stackoverflow.com/q/20970788
tags question: http://stackoverflow.com/q/20895806
tags question: http://stackoverflow.com/q/20863935
tags question: http://stackoverflow.com/q/20908708
tags question: http://stackoverflow.com/q/20941717
type: Tag
tags question: http://stackoverflow.com/q/20940120
tags question: http://stackoverflow.com/q/20864541
tags question: http://stackoverflow.com/q/20858378
tags question: http://stackoverflow.com/q/20962339
tags question: http://stackoverflow.com/q/20931176
tag name: class
tags question: http://stackoverflow.com/q/20899199
tags question: http://stackoverflow.com/q/20907608
tags question: http://stackoverflow.com/q/20867439
tags question: http://stackoverflow.com/q/20942130
tags question: http://stackoverflow.com/q/20992493
tags question: http://stackoverflow.com/q/20899467
tags question: http://stackoverflow.com/q/20929402
tags question: http://stackoverflow.com/q/20961892
tags question: http://stackoverflow.com/q/20891721
tags question: http://stackoverflow.com/q/20956462

http://stackoverflow.com/comment/31364761
has text: Yes, but I removed it and it still doesn't work.
comment on: http://stackoverflow.com/q/20896848
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21002236
score: 2
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31563371
accepted answer: http://stackoverflow.com/a/21002777
type: Question
has comment: http://stackoverflow.com/comment/31562533
downvote count: 0
has comment: http://stackoverflow.com/comment/31562586
has comment: http://stackoverflow.com/comment/31563094
answer count: 1
has comment: http://stackoverflow.com/comment/31562632
has answer: http://stackoverflow.com/a/21002777
favorite count: 0
has comment: http://stackoverflow.com/comment/31563234
has comment: http://stackoverflow.com/comment/31562686
has body: I'm working on upgrading Quartz from 1.8.6 to 2.2.x and they've changed quite a few APIs that have broken a fair amount of code. Previously, a trigger was created like so: LocalTime timeOfDay = schedule.getTimeOfDay(); Trigger trigger = TriggerUtils.makeDailyTrigger(timeOfDay.getHourOfDay(), timeOfDay.getMinuteOfHour()); return trigger; Now, using the migration guide, it looks like it's switching to a builder-based system. So I tried doing this: LocalTime timeOfDay = schedule.getTimeOfDay(); Trigger trigger = newTrigger() .withSchedule(cronScheduleDaily(timeOfDay.getHourOfDay(), timeOfDay.getMinuteOfHour())) .build(); return trigger; This is essentially coming out of their example from the migration guide that I linked to above. I'm getting a syntax error on "cronsScheduleDaily" (The method cronScheduleDaily(int, int) is undefined for the type QuartzUtils), which I have no idea where that comes from and I can't find anything online. Any help would be appreciated.
has title: Quartz trigger creation migration to 2.2.x
upvote count: 2
has comment: http://stackoverflow.com/comment/31562542
tagged with: quartz-scheduler
has comment: http://stackoverflow.com/comment/31562496

http://stackoverflow.com/comment/31447384
has text: In your layout xml file. If you are not added fragment via xml, then you have to get your fragment by tag for example. Here is a example: YourFragmentClass fragment = (YourFragmentClass)fm.findFragmentByTag("yourTag");
comment on: http://stackoverflow.com/a/20940068
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/a/20890258
answers question: http://stackoverflow.com/q/20889670
has comment: http://stackoverflow.com/comment/31352399
type: Answer
has body: Use long /** * @author Rakesh KR * */ public class New { public static void main(String[] args) { int n=10, r=1; long ncr,npr; ncr = find_ncr(n,r); npr = find_npr(n,r); System.out.println(ncr+"---"+npr); } static long find_ncr(int n,int r){ return factorial(n)/(factorial(r)*factorial(n-r)); } static long find_npr(int n,int r){ return factorial(n)/factorial(n-r); } static long factorial(int n){ return n==0?1:n*factorial(n-1); } }
score: 0

http://stackoverflow.com/comment/31287485
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20856260
has text: @MarounMaroun I don't think so - it's a _negated_ character class.
type: AnswerComment

http://stackoverflow.com/a/20996605
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/20996544
has body: Use a DefaultTableModel &lt;- see docs more contructors DefaultTableModel model = new DefualtTableModel(String colNames, int rows); JTable table = new JTable(model); Then you can use one of the following methods DefaultTableModel#insertRow(int row, Object[] rowData) - Inserts a row at row in the model. The new row will contain null values unless rowData is specified. Notification of the row being added will be generated. Or DefaultTableModel#insertRow(int row, Vector rowData) - Inserts a row at row in the model. The new row will contain null values unless rowData is specified. Notification of the row being added will be generated.
upvote count: 5
score: 5
answers question: http://stackoverflow.com/q/20996544
type: AcceptedAnswer

http://stackoverflow.com/q/20936277
has title: Return index of a clicked JButton in Java swing
type: Question
has body: I have the following Java code: I have a for loop and I'm creating JButtons. I would like to return the index of the clicked button. So i use: JButton jbtn = (JButton) e.getSource(); Is there any method that returns the JButton's index? My code is as follows: for (int button = 0 ; button &lt;= ListofJButtons.size() - 1; button++) { ListofJButtons.get(button).addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("I clicked on button !"); JButton buttonSource = (JButton) e.getSource(); System.out.println( " sourceButton " + buttonSource.getIndex()); //is there any method like that in Java? } } ); }//for loop Is it possible to get the Index of the clicked JButton? thanks
accepted answer: http://stackoverflow.com/a/20936301
answer count: 3
has comment: http://stackoverflow.com/comment/31439487
score: 0
tagged with: swing
has answer: http://stackoverflow.com/a/20936301
tagged with: jbutton
tagged with: indexing
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20936303
has answer: http://stackoverflow.com/a/20936337
tagged with: java
has answer: http://stackoverflow.com/a/20936303

http://stackoverflow.com/comment/31367801
comment on: http://stackoverflow.com/q/20898572
type: Comment
type: QuestionComment
has text: Some cell renders may be transparent, meaning that changing here background color won't actually have any effect...just saying ;)
score: 0

http://stackoverflow.com/comment/31444332
score: 1
type: AnswerComment
type: Comment
has text: That did it!! wow, those two brackets, I am not sure why I had them in it. Thanks Maroun!!
comment on: http://stackoverflow.com/a/20938595

http://stackoverflow.com/a/21111932
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20897662
has body: You are using JSON data as string data. you need to pick only the "response" part value of the JSON something like this JSONObject jO= new JSONObject(value); String response = jO.getString("Response");

http://stackoverflow.com/comment/31563824
type: AnswerComment
comment on: http://stackoverflow.com/a/21002592
type: Comment
score: 1
has text: @AaronBrewer "No question is a stupid question" not sure I agree with that. The security reports you see are security of Java **IN THE BROWSER**, specifically Applets and Java Webstart. Both of these are highly problematic and should be disabled for users. I've not seen a "poor performance report" for Java in the last ~ 10 years.

http://stackoverflow.com/comment/31326987
type: Comment
has text: only if you don't to it in a transaction, or at least do a commit before you insert into the `auth` table. The `name` record must exist
comment on: http://stackoverflow.com/a/20876390
score: 0
type: AnswerComment

http://stackoverflow.com/q/20876897
tagged with: date
type: Question
answer count: 2
tagged with: jsp
tagged with: javascript
has title: Combining date and time in jsp
score: 0
possible better answer: http://stackoverflow.com/a/20876944
has answer: http://stackoverflow.com/a/20876944
has answer: http://stackoverflow.com/a/20876943
tagged with: datetime
has body: var dateString=$('#strtime').val();//starttime retrieved from db,(type is Time in the database) var dateString2=$('#endtime').val();//endtime retrieved from db,(type is Time in the database) var dateString1=$('#date').val();//date retrieved from db,(type is date in the database) var d1 = new Date(dateString1+" "+dateString);//combine date and starttime retireved from the database. var d5= new Date(dateString1+" "+dateString2);//combine date and endtime retireved from the database. I would like to know the Java equivalent of the above javascript I Tried this Date d1 = new Date(dateString1.getTime()+dateString.getTime()); System.out.println("d1="+d1); //OUTPUT d1=2013-12-27 This outputs only the date,not the time Actual output should have been d1=2013-12-27 14:30:00
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20876943
tagged with: java

http://stackoverflow.com/q/20992745
tagged with: java
type: Question
tagged with: jboss
has title: Min/Max value contraints over JBoss using annotations
has body: I'm developing an IceFaces application, targeting multiple application server platforms. One of the targeted servers is JBoss AS 7.2, but validating my entites over it results in strange behaviour. In an entity, I set up the following contraints for an Integer field, which bound to an input field: @Min(value=1) @Max(value=99) @Column(name = "ORDER") private Integer order; By specification null values are considered valid. This is exactly what happens over Weblogic 12c. But with JBoss, when I submit a null value, a javax.validation.ConstraintViolationException thrown. Moreover the default converter (if I let it) converts the null value to zero. Over Weblogic it does the expected thing again: ignore null, thus leave the input field empty. Any ideas what makes the difference, and how to overcome it?
score: 0
tagged with: validation
answer count: 1
has answer: http://stackoverflow.com/a/21017409
accepted answer: http://stackoverflow.com/a/21017409
tagged with: icefaces
type: AnsweredQuestion
tagged with: jsf

http://stackoverflow.com/q/20881144
has answer: http://stackoverflow.com/a/20881553
favorite count: 0
type: UnansweredQuestion
tagged with: spring-mvc
score: 2
downvote count: 0
tagged with: java
type: Question
has title: HttpServletResponse prompt for file name on save
tagged with: servlets
upvote count: 2
has body: I used code similar to something below to return a zip file as an attachment to a SpringMVC request. The whole thing works great, I am able to download a file called hello.zip when I make a request to localhost/app/getZip. My question here is, how can I prompt the user to enter a file name. Currently on FireFox25.0 it automatically assumes the name to be "hello.zip" without the provision to change the file name on Open or Save options. @RequestMapping("getZip") public void getZip(HttpServletResponse response) { OutputStream ouputStream; try { String content = "hello World"; String archive_name = "hello.zip"; ouputStream = response.getOutputStream(); ZipOutputStream out = new ZipOutputStream(ouputStream); out.putNextEntry(new ZipEntry(“filename”)); out.write(content); response.setContentType("application/zip"); response.addHeader("Content-Disposition", "attachment; filename="+ archive_name); out.finish(); out.close(); } catch (IOException e) { e.printStackTrace(); } } TL;DR: Using HttpServletResponse I want user to provide a file name instead of passing one in the Header.
answer count: 1

http://stackoverflow.com/comment/31416825
type: Comment
type: QuestionComment
has text: yeah I want the app to be able to set a selected sound as a ringtone.
comment on: http://stackoverflow.com/q/20924447
score: 0

http://stackoverflow.com/a/20859366
has body: First error: dAngle = 360/iShotNumber; You want a double as a result of the division, then you cannot simply do an integer division. You should do: dAngle = 360.0/(double)iShotNumber; I'm checking to find other errors.
downvote count: 0
answers question: http://stackoverflow.com/q/20857735
score: 1
upvote count: 1
type: Answer

http://stackoverflow.com/comment/31512281
has text: i want to know is it possible to display only the nodes inside a JScrollPane?? --> use JTable instead of JTree
type: Comment
score: 0
comment on: http://stackoverflow.com/q/20974671
type: QuestionComment

http://stackoverflow.com/q/20888069
downvote count: 0
favorite count: 0
tagged with: android-asynctask
has title: Updating GridView with asynctask
tagged with: android
type: AnsweredQuestion
tagged with: gridview
score: 1
possible better answer: http://stackoverflow.com/a/20888157
tagged with: java
has answer: http://stackoverflow.com/a/20888157
upvote count: 1
has answer: http://stackoverflow.com/a/20888276
type: Question
has body: I have read in many places that you can't access a gridview from outside the ui thread, but I believe that's what is causing the problem of my gridview taking long to load. I have it with 75 images and it makes the ui hang so it looks like my app is frozen. Is there a way to use async task to load the images into the grid view off the ui thread? or is there a different way to accomplish this?
answer count: 2
accepted answer: http://stackoverflow.com/a/20888276

http://stackoverflow.com/comment/31564335
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21002387
has text: @PeterLawrey the only thing i write from the server class are UTF Strings
score: 0

http://stackoverflow.com/comment/31497503
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20965910
has text: @JavaLearner ArrayList.add(index, element) will shift the existing element the "index" position to right.. Refer http://docs.oracle.com/javase/6/docs/api/java/util/ArrayList.html#add%28int,%20E%29 he wants to replace the existing element
type: AnswerComment

http://stackoverflow.com/comment/31363829
type: Comment
comment on: http://stackoverflow.com/a/20896267
has text: @smriti3 no you can't
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31459966
type: Comment
comment on: http://stackoverflow.com/a/20946886
score: 0
type: AnswerComment
has text: in place of your focus change listener use the code i mentioned right now, check the edit

http://stackoverflow.com/comment/31546102
score: 0
has text: Do you have any file default.* or index.* in your Example03 folder?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20992659

http://stackoverflow.com/comment/61493462
has text: That's how javadoc does it.
type: Comment
comment on: http://stackoverflow.com/a/20946188
score: 0
type: AnswerComment

http://stackoverflow.com/a/27456243
downvote count: 0
has comment: http://stackoverflow.com/comment/48300924
score: 30
upvote count: 30
has body: The first major version of Jackson is no longer supported in Spring 4. The class you want to use is now org.springframework.http.converter.json.MappingJackson2HttpMessageConverter. Make sure that you have com.fasterxml.jackson.core/jackson-core/2.x.x on your classpath.
type: Answer
answers question: http://stackoverflow.com/q/20969722

export
tags question: http://stackoverflow.com/q/20896694
type: Tag
tag name: export
tags question: http://stackoverflow.com/q/20971785
tags question: http://stackoverflow.com/q/20955488
tags question: http://stackoverflow.com/q/20875834
tags question: http://stackoverflow.com/q/21008982

http://stackoverflow.com/q/20869384
tagged with: java
tagged with: date
has comment: http://stackoverflow.com/comment/31318273
type: Question
has title: get a value from JDateChooser and show it back on same JDateChooser
score: 0
tagged with: jdatechooser
has comment: http://stackoverflow.com/comment/31318305
tagged with: netbeans
answer count: 0
has body: I want to show a value from from database and put it back on the same JDateChooser as input before, I already changed the JDateChooser event property changed: private void txtBirthPropertyChange(java.beans.PropertyChangeEvent evt) { if(txtBirth.getDate()!=null){ SimpleDateFormat Format = new SimpleDateFormat("dd/mm/yyyy"); date1=String.valueOf(Format.format(txtBirth.getDate())); } } Do the save button in this way: employee emp = new employee(); emp.setNoid(txtNoid.getText()); emp.setName(txtNama.getText()); emp.setPlace(txtPlace.getText()); emp.setBirth(date1); And when I'm going to show it in the table it works somehow, but when I click on the data it should be fill the same field before, I do this: employee emp=record.get(row); txtNoid.setText(pgw.getNoid()); txtName.setText(pgw.getName()); txtPlace.setText(pgw.getPlace()); txtBirth.setDate(pgw.getBirth()); It didn't work and JDateChooser didn't show any value from table, except other field, I know that I must converting String into Date before, but I didn't know how to, or anybody has another way?
type: UnansweredQuestion

http://stackoverflow.com/comment/31557478
comment on: http://stackoverflow.com/a/20998599
type: Comment
score: 1
has text: Thank you very much. It worked after i could convince ant to work with me. I originally downloaded the eclipselink installer. To find the above mentioned jars, i needed to download the OSGi bundle (maybe another one would have worked as well.
type: AnswerComment

http://stackoverflow.com/comment/31585528
comment on: http://stackoverflow.com/a/21014093
score: 0
type: AnswerComment
type: Comment
has text: I could have misread. Always a possibility, especially at 3am ;)

http://stackoverflow.com/q/20903257
upvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/20903498
type: Question
has answer: http://stackoverflow.com/a/20903483
score: -2
tagged with: servlets
has body: In my spring mvc application,I am facing a problem of page reloading on every request.Is there any way to restrict that.To be more specific,When I return the name of index.jsp page from controller it will obviously reload the page.How Can I restrict that thing in the index.jsp page.Suppose some part of the page is required to interact with Database and it should be shown on the same index.jsp page as well.How I can achieve this requirement without reloading the index.jsp page completely.Could you please provide me some example for that.
answer count: 2
downvote count: 2
tagged with: jsp
favorite count: 0
has title: JSP page Reload
linked to: http://stackoverflow.com/q/2957165
type: UnansweredQuestion

http://stackoverflow.com/a/20913998
accepted answer of: http://stackoverflow.com/q/20913780
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20913780
type: AcceptedAnswer
downvote count: 0
has body: Can be done using jquery check this How do I grab and send a dropdown&#39;s display text instead of value using jquery

java.util.scanner
tags question: http://stackoverflow.com/q/20887961
tag name: java.util.scanner
tags question: http://stackoverflow.com/q/20918967
tags question: http://stackoverflow.com/q/20970627
tags question: http://stackoverflow.com/q/20963091
tags question: http://stackoverflow.com/q/20947152
type: Tag
tags question: http://stackoverflow.com/q/20964693
tags question: http://stackoverflow.com/q/20926989
tags question: http://stackoverflow.com/q/20988613

http://stackoverflow.com/a/21002713
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/20991577
has comment: http://stackoverflow.com/comment/31594983
upvote count: 2
has body: No, you can't use getOption with multiple files. But you can get rid of that strange java firmware and use asterisk AGI. ExecCommand("Read(result,press-1&amp;or&amp;press-2,1,,3)"); choice=getVariable("result"); For more info see http://www.asterisk-java.org/development/apidocs/index.html http://www.voip-info.org/wiki/view/Asterisk+cmd+Read
type: Answer

http://stackoverflow.com/q/20906713
has answer: http://stackoverflow.com/a/20907225
answer count: 2
downvote count: 4
has comment: http://stackoverflow.com/comment/31383280
upvote count: 0
has title: Java , The equals() Method
favorite count: 0
has comment: http://stackoverflow.com/comment/31383230
has body: i have this code in my main, why this code returns true? equals() method was automatically written by NetBeans 7.3.1. Movimento md = new Movimento(3, 1, 2014, 100, "Debito", 'D'); Movimento mc = new Movimento(3 , 1 , 2014, 100 , "Credito", 'C'); System.out.println(mc.equals(md)); this is the equals code ... public boolean equals(Movimento obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } if (this.dia != obj.dia) { return false; } if (this.mes != obj.mes) { return false; } if (this.ano != obj.ano) { return false; } if (Double.doubleToLongBits(this.valor) != Double.doubleToLongBits(obj.valor)) { return false; } if (!Objects.equals(this.descricao, obj.descricao)) { return false; } if (this.tipo != obj.tipo) { return false; } return true; }
has comment: http://stackoverflow.com/comment/31382609
possible better answer: http://stackoverflow.com/a/20906749
tagged with: equals
has answer: http://stackoverflow.com/a/20906749
has comment: http://stackoverflow.com/comment/31382603
has comment: http://stackoverflow.com/comment/31383339
accepted answer: http://stackoverflow.com/a/20907225
has comment: http://stackoverflow.com/comment/31382734
type: AnsweredQuestion
tagged with: java
score: -4
type: Question
has comment: http://stackoverflow.com/comment/31382604

http://stackoverflow.com/a/20939008
has body: You're wrapping your stream inside a BufferedWriter which is usually a good thing for a number of reasons. The weird thing with your code is that you're using that writer for the Integer, and the unwrapped OutputStream for the File. I suspect that the two write operations cannot be used without reinstantiating the writer. I suggest you to refactor your code using only one writer. I would choose the more general ObjectOutputStream which allows you to send objects implementing the Serializable interface (your scenario already satisfy this constraint). You can receive directly the objects via ObjectInputStream.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/20937040

sudoku
tags question: http://stackoverflow.com/q/20875383
type: Tag
tags question: http://stackoverflow.com/q/20937103
tag name: sudoku

http://stackoverflow.com/comment/31588371
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21000698
has text: See [here](https://developers.google.com/eclipse/docs/running_and_debugging_2_0), [there](https://developers.google.com/eclipse/docs/gwt_compile) and in _Google → Web Toolkit Settings_ from the project context-menu (or _Google → Web Toolkit_ in the project properties)

http://stackoverflow.com/comment/31349164
type: AnswerComment
type: Comment
has text: Netbeans is pure Java and is reporting Java threads. Linux implements threads with processes.
comment on: http://stackoverflow.com/a/20863194
score: 0

http://stackoverflow.com/comment/31499520
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/20967539
has text: Thanks, that was an easier problem to solve. All fixed.

http://stackoverflow.com/comment/31437146
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20935106
has text: Ooops my mistake. Thanks a lot, I need new glasses. I'll accept your answer in 5 min, I can't for now.
score: 0

http://stackoverflow.com/comment/31490837
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20961806
has text: Yes, I think you are over thinking it, path is wherever you want it to be, for example, you could put it in the root, eg, C:\play-2.2.1, or you could put it in program files (not recommended, spaces in the path can cause issues), but that would be C:\Program Files\play-2.2.1, etc.
type: AnswerComment

http://stackoverflow.com/q/20933000
has title: FOR statement note working
accepted answer: http://stackoverflow.com/a/20933017
tagged with: for-loop
has comment: http://stackoverflow.com/comment/31433086
tagged with: arrays
downvote count: 4
answer count: 1
has body: Baffled by why this doesn't work. It has worked in the past, I don't know what I changed. I'm not getting any errors, the for loop just isn't running. Stuff before and after the loop is running. for(int i=2; i==length; i++){ note = note.concat(args[i]); sender.sendMessage("Args[i]: " + args[i]); sender.sendMessage("Note: " + note); } Length is an integer holding the length of an 1d array. This error occurs when length is 3 and greater (don't worry about when length &lt; 3 its not meant to do anything).
has comment: http://stackoverflow.com/comment/31433132
favorite count: 0
has answer: http://stackoverflow.com/a/20933017
score: -3
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31433085
tagged with: java
upvote count: 1
tagged with: loops
type: Question

opengl-es-2.0
tags question: http://stackoverflow.com/q/20889316
tag name: opengl-es-2.0
type: Tag

http://stackoverflow.com/comment/31731825
score: 0
has text: I saw jStyleParser was added in version 2. https://web.archive.org/web/20090309190904/http://cssbox.sourceforge.net/download.php. I found the latest release before that, 1.1. https://sourceforge.net/projects/cssbox/files/cssbox/1.1/.
type: Comment
comment on: http://stackoverflow.com/a/21040767
type: AnswerComment

http://stackoverflow.com/a/21011454
accepted answer of: http://stackoverflow.com/q/21011444
upvote count: 4
downvote count: 0
score: 4
has body: From 11.4.3. The BLOB and TEXT Types: BLOB and TEXT columns cannot have DEFAULT values. Thus, if the column is NULLABLE then NULL is the default; otherwise there is no default value. (Although, at the application level, a blob of length=0 might be a sensible "default".)
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/21011444

http://stackoverflow.com/a/20952439
has comment: http://stackoverflow.com/comment/31481378
upvote count: 25
downvote count: 1
has comment: http://stackoverflow.com/comment/31497232
has comment: http://stackoverflow.com/comment/31469832
has comment: http://stackoverflow.com/comment/31469878
type: Answer
has body: Use a regular expression If (a.matches("[xyz]")){ // matches either "x", "y", or "z" or, for longer strings, If (a.matches("one|two|three")){ // matches either "one", "two" or "three" But this is computationally expensive, but probably not much worse than instantiating a set etc. But it's the clearest way I can think of. But in the end, the nicest way is probably to leave things as they are, with an adjustment to the formatting: if (a.equals("x") || a.equals("y") || a.equals("z") ){ There is then absolutely no ambiguity in what the code is doing and so your code will be easier to maintain. If performance matters, you can even put the most likely occurrences towards the top of the list.
has comment: http://stackoverflow.com/comment/31493299
score: 24
has comment: http://stackoverflow.com/comment/31469865
answers question: http://stackoverflow.com/q/20952325
has comment: http://stackoverflow.com/comment/31528851

http://stackoverflow.com/q/20883880
tagged with: swing
tagged with: checkbox
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/20883969
accepted answer: http://stackoverflow.com/a/20883969
tagged with: java
has title: How to insert a new line char in a CheckBox Description in Java?
type: Question
tagged with: jcheckbox
has body: In my code I am using checkboxes so that you can select multiple options, however these selections are around 100 characters in length and I am wanting to use a smaller, narrow, window. Is there a way to make the checkbox description go across multiple lines? I have tried inserting System.lineSeparator() into the string but this just seems to be skipped over. I would rather not use JLabels/JTextArea.
tagged with: newline
upvote count: 2
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/31325482
has text: @user3003233 Then that is another problem not related with this thread.. i can't help without any code to see. Consider accepting this answer for this question, and feel free to create a new post with the new question if you can't figure out by yourself the solution.
comment on: http://stackoverflow.com/a/20874943
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31550931
comment on: http://stackoverflow.com/a/20995655
score: 0
type: AnswerComment
has text: @Yves030 So all in all, the conclusion is that you had done this yourself already. And that's normal behavior you're seeing.
type: Comment

http://stackoverflow.com/comment/31566592
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21004375
has text: Show us how you are trying to output that String.
score: 0

http://stackoverflow.com/a/20953974
downvote count: 0
has body: You can add the following to your Transformer t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); see here for details
upvote count: 28
has comment: http://stackoverflow.com/comment/68469794
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20953830
score: 28
type: Answer
accepted answer of: http://stackoverflow.com/q/20953830

http://stackoverflow.com/comment/31430136
has text: The above code doesn't do in C++ what you think it does: the code use a `std::set<Obj*>` ordered by the pointer values. If you wanted to have the objects sorted by their `id` you'd need to use a custom comparison object. Also, you can't compare iterators to `0` you need to compare the iterator against the `end()` of the set.
type: Comment
comment on: http://stackoverflow.com/q/20931255
score: 6
type: QuestionComment

http://stackoverflow.com/q/20925278
tagged with: java
score: 0
tagged with: jersey
answer count: 1
tagged with: rest
has answer: http://stackoverflow.com/a/20925485
type: UnansweredQuestion
has body: Hi i'm learning Rest from many tutorials e.g ( http://www.vogella.com/tutorials/REST/article.html ). My question is: How to update existing resource ? for example i have created resource ( id =1 ) contains: id, age and then i changed age. I created my Rest service using above tutorial but PUT method doesn't work as well as i expected. Todo todo = new Todo("1", "23"); // id and age ClientResponse response = service.path("rest").path("todos") .path(todo.getId()).accept(MediaType.APPLICATION_XML) .put(ClientResponse.class, todo); String newAge = "24"; How can I update this existing resource ? (23 replace to newAge) Ok, but i am a little bit confused... I thought that i have modify this function ? @PUT @Consumes(MediaType.APPLICATION_XML) public Response putTodo(JAXBElement&lt;Todo&gt; todo) { Todo c = todo.getValue(); return putAndGetResponse(c); private Response putAndGetResponse(Todo todo) { Response res; if(TodoDao.instance.getModel().containsKey(todo.getId())) { res = Response.noContent().build(); } else { res = Response.created(uriInfo.getAbsolutePath()).build(); } TodoDao.instance.getModel().put(todo.getId(), todo); return res; } I have similar Rest service so I based on example in tutorial.
type: Question
has title: Update an existing resource

http://stackoverflow.com/a/20874943
has comment: http://stackoverflow.com/comment/31325444
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31324325
type: Answer
has body: Your error is pretty clear, in a static context you can't refer something non-static . Cause static belongs to class level you cannot use instance level stuff without any instance of it. For that you have to instantiate an object to use it. Example: public class Test{ private JTextArea textArea; public static void someMethod(){ //textArea = new JTextArea(); you can't do this //you need an instance Test test = new Test(); test.textArea = new JTextArea(10,10); test.textArea.setText("Hello world"); } }
score: 2
accepted answer of: http://stackoverflow.com/q/20874834
upvote count: 2
has comment: http://stackoverflow.com/comment/31325482
answers question: http://stackoverflow.com/q/20874834
has comment: http://stackoverflow.com/comment/31325030

http://stackoverflow.com/comment/71279092
type: AnswerComment
type: Comment
has text: Just asking for curiosity, how do the sites like hackerrank, topcoder prevent security risks? In order to compete, you have to submit some java or c++ code of desired algorithm and I am assuming they run those codes on the server side. Scanning through all file system and deleting files is possible with java or c. Would it make sense to keep some "blacklist" keywords in order to prevent that?(like if you see BufferedReader then don't run the code.)
comment on: http://stackoverflow.com/a/20991932
score: 0

http://stackoverflow.com/a/20876944
upvote count: 1
answers question: http://stackoverflow.com/q/20876897
has comment: http://stackoverflow.com/comment/31327994
downvote count: 0
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/31328042
has comment: http://stackoverflow.com/comment/31327925
has comment: http://stackoverflow.com/comment/31327874
has body: Java equivalent would be import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import java.util.TimeZone; If you want specific timezone you can set the timezone SimpleDateFormat ft = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); ft.setTimeZone(TimeZone.getTimeZone("Asia/Calcutta")); System.out.println("Date: " + ft.format(d1)); For current date Date dNow = new Date( ); SimpleDateFormat ft = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); System.out.println("Current Date: " + ft.format(dNow)); /// prints Current Date: 2014-01-02 13:38:02 System.out.println("Date: " + ft.format(date));
has comment: http://stackoverflow.com/comment/31327805

http://stackoverflow.com/comment/31494181
comment on: http://stackoverflow.com/a/20933190
score: 0
type: AnswerComment
has text: What do you mean? Also did you acutally `ADD the Library`. You still need to add it. The library exists in Netbeans, but you still need to add it to your project
type: Comment

http://stackoverflow.com/q/20853198
has answer: http://stackoverflow.com/a/20853223
has answer: http://stackoverflow.com/a/20853241
tagged with: string
favorite count: 0
duplicate of: http://stackoverflow.com/q/513832
has answer: http://stackoverflow.com/a/20853272
has comment: http://stackoverflow.com/comment/31282286
has answer: http://stackoverflow.com/a/20853217
has title: Java string comparsion
has answer: http://stackoverflow.com/a/20853328
has comment: http://stackoverflow.com/comment/31282112
type: AnsweredQuestion
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/20853241
has comment: http://stackoverflow.com/comment/31282173
upvote count: 1
downvote count: 1
type: Question
has body: I'm trying to implement a simple cesar cipher. I'm having trouble with the function that codes a string based on a new key[]. Here I shown, how I setup my key. private String[] alphabet = {"a", "b", "c","d", "e", "f","g", "h", "i","j", "k", "l","m", "n", "o", "p", "q", "r","s", "t", "u","v", "w", "x","u", "z"}; public String[] CoderNewKey(int shift) { _NewKey = null; _NewKey = new String[25]; for (int i = 0; i &lt; 25; i++) { _NewKey[i] = alphabet[(i + shift) % 25]; } return _NewKey; } The problem I have is with Coder, none of the if statements are ever true, and rtnstring is always just "". public String Coder(String[] key, String msg){ String rtnstring = ""; for ( int i = 0; i &lt; msg.length();i++){ for (int x = 0; x&lt;26 ; x++){ if ( msg.substring(i, i+1) == alphabet[x]){ rtnstring.concat(key[x]); }if (msg.substring(i, i+1) == " "){ rtnstring.concat(" "); } } } return rtnstring; } Here is my logic for the coder method. It goes through the String msg 1 letter at a time. It matches the letter with its index in the alphabet, then it creates a new string based on the index's in the given key.
tagged with: arrays
answer count: 6
has answer: http://stackoverflow.com/a/20853236
possible better answer: http://stackoverflow.com/a/20853223
has comment: http://stackoverflow.com/comment/31282106

http://stackoverflow.com/comment/31314599
has text: Also your assumption that it is OK to dump 500 lines of code of no relevance to your problem is an insult to the volunteers on this site.
type: QuestionComment
comment on: http://stackoverflow.com/q/20870191
type: Comment
score: 3

http://stackoverflow.com/comment/31495236
type: QuestionComment
has text: I would vote for the first approach.. Generally, you catch many exceptions, generalize them into one and throw it.. So that all similar exceptions can be handled in the same way..
comment on: http://stackoverflow.com/q/20965712
score: 0
type: Comment

http://stackoverflow.com/comment/31606292
has text: I have tried CascadeType.MERGE and CascadeType.PERSIST but in vain, but there is CascadeType.REFRESH, could you please explain what does the last one mean? It seems to be the solution
comment on: http://stackoverflow.com/q/21016531
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20919273
score: 0
tagged with: java
has title: IllegalArgumentException while performing query with cursors
has body: My Query is regarding cursors.When I execute the following code the program throws NUllPointerException. public class MySQLiteHelper extends SQLiteOpenHelper { public MySQLiteHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); // TODO Auto-generated constructor stub } public static final String DATABASE_NAME = "Exp.db"; public static final int DATABASE_VERSION = 1; private static final String KEY_ID = "ROW_ID"; private static final String KEY_DESCRIP = "ITEM_DESCRIPTION"; private static final String KEY_AMOUNT = "ITEM_AMOUNT"; private static final String KEY_TABLE_NAME = "ITEMS"; @Override public void onCreate(SQLiteDatabase db) { // TODO Auto-generated method stub db.execSQL("create table ITEMS(ROW_ID integer primary key autoincrement,ITEM_DESCRIPTION text,ITEM_AMOUNT text);"); } @Override public void onUpgrade(SQLiteDatabase db, int arg1, int arg2) { // TODO Auto-generated method stub db.execSQL("DROP TABLE IF EXISTS ITEMS"); this.onCreate(db); } public void createEntry(ExpenseObject exp) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues cv = new ContentValues(); cv.put(KEY_AMOUNT, exp.Amt); cv.put(KEY_DESCRIP, exp.Desc); db.insert(KEY_TABLE_NAME, null, cv); db.close(); } public String getAllEntry() { SQLiteDatabase db = this.getReadableDatabase(); String[] columns=new String[]{KEY_ID,KEY_DESCRIP,KEY_AMOUNT}; Cursor cx=db.query(KEY_TABLE_NAME, columns, null, null, null, null, null); String result=" "; int rowid=cx.getColumnIndex(KEY_ID); int amt=cx.getColumnIndex(KEY_AMOUNT); int desc=cx.getColumnIndex(KEY_DESCRIP); for(cx.moveToFirst();!cx.isAfterLast();cx.moveToNext()) { result= result + " " + cx.getString(rowid) + " " +cx.getString(desc) + " " + cx.getString(amt) + " \n " ; } cx.close(); return result; } The logcat file is as: D/dalvikvm(4318): GC_FOR_ALLOC freed 77K, 6% free 2943K/3120K, paused 57ms, total 67ms D/AndroidRuntime(4318): Shutting down VM W/dalvikvm(4318): threadid=1: thread exiting with uncaught exceptio…
has answer: http://stackoverflow.com/a/20919323
type: Question
tagged with: android
tagged with: sqlite
answer count: 1
accepted answer: http://stackoverflow.com/a/20919323
has comment: http://stackoverflow.com/comment/31406996
type: AnsweredQuestion

http://stackoverflow.com/q/20933260
has answer: http://stackoverflow.com/a/20933350
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31433665
has comment: http://stackoverflow.com/comment/31433650
has title: Some trouble in loop
has comment: http://stackoverflow.com/comment/31442799
has answer: http://stackoverflow.com/a/20933357
type: UnansweredQuestion
tagged with: loops
upvote count: 1
has body: Hi there, I'm a newbie in java and I have a problem with this code. I'm thinking if it is a problem in loop or something.. public static void main(String[] args) { try { Scanner scn = new Scanner(System.in); int z = 0; String input; int[] ABArray = new int[2]; while (z == 0) { System.out.println("Input X to terminate."); System.out.print("Input: "); input = scn.nextLine().toLowerCase(); for (int i = 0; i &lt; input.length(); i++) { char AB = input.charAt(i); ABArray[AB - 'a']++; } if (ABArray[0] == 0 || ABArray[1] == 0) { System.out.println("Not Equal"); System.out.println(""); } else if (ABArray[0] == ABArray[1]) { System.out.println("Equal"); System.out.println(""); } else if (ABArray[0] != ABArray[1]) { System.out.println("Not Equal"); if (ABArray[0] &gt; ABArray[1]) { System.out.println("The number of A is greater than B."); } else if (ABArray[0] &lt; ABArray[1]) { System.out.println("The number of B is greater than A."); } System.out.println(""); } } } catch (ArrayIndexOutOfBoundsException X) { } //Terminates the program } The problem is this I/O Input: ABABAB Output: Equal Input: AABBB Output: Not Equal The number of B is greater than A. Input: AABB //It is equal. Output: Not Equal //It says not. The number of B is greater than A. As you see, the problem is when I input equal A and B at the first, it says equal, when I input not equal A and B but at the third when I input equal A and B it says not equal. Problem solved. Thanks for the help.
has answer: http://stackoverflow.com/a/20933388
type: Question
tagged with: if-statement
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31433681
answer count: 3

http://stackoverflow.com/q/20918359
tagged with: java
possible better answer: http://stackoverflow.com/a/20918379
has comment: http://stackoverflow.com/comment/31405347
tagged with: eclipse
has answer: http://stackoverflow.com/a/20918379
type: Question
accepted answer: http://stackoverflow.com/a/20918402
score: 0
answer count: 2
has title: Uploading a small sized image to server using php and android
tagged with: android
tagged with: php
has answer: http://stackoverflow.com/a/20918402
has body: On PHP Side I am using following Code $val = (isset($_GET['file']) ? $_GET['file'] : null); $isUploaded = false; return $val; if($val != null) { if (move_uploaded_file(@$_FILES['file']['tmp_name'], $mainPath)) { $isUploaded = true; } } Android side I am using List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;(); params.add(new BasicNameValuePair("file", Base64Coder.encodeLines(imageArray))); HttpResponse response = null; HttpClient httpclient = new DefaultHttpClient(); httpclient.getParams().setParameter("http.connection-manager.timeout", 15000); try { HttpPost httppost = new HttpPost(url); httppost.setEntity(entity); response = httpclient.execute(httppost); However $val = (isset($_GET['file']) ? $_GET['file'] : null); returns null How can I upload image properly
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31405381

http://stackoverflow.com/a/20986197
has comment: http://stackoverflow.com/comment/31534423
has comment: http://stackoverflow.com/comment/31534186
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31534380
has comment: http://stackoverflow.com/comment/31534488
has comment: http://stackoverflow.com/comment/31534586
upvote count: 1
answers question: http://stackoverflow.com/q/20986124
accepted answer of: http://stackoverflow.com/q/20986124
downvote count: 0
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/31534539
has body: public class Vehicle { // A unique ID private String id; // The destination private String destination; // The location of this taxi. private String location; /** *Constructor for vehicle */ public Vehicle(String id) { this(id, null); } /** *Constructor for vehicle */ public Vehicle(String id, String location) { this.id = id; this.location = location; } /** * Returns ID. * */ public String getID() { return id; } public String getDesitnation() { return destination; } public void setDestination(String destination) { this.destination = destination; } public String getLocation() { this.location = location; } public void setLocation(String location) { this.location = location; } } public class Taxi extends Vehicle // Whether it is free or not. private boolean free; /** * Constructor for objects of class Taxi. * @param base The name of the company's base. * @param id This taxi's unique id. */ public Taxi(String base, String id) { super(id, base); free = true; } } public class Shuttle extends Vehicle { // The circular route of this shuttle. private ArrayList&lt;String&gt; route; // The destination number in route that the shuttle is // currently headed for. private int destinationNumber; /** * Constructor for objects of class Shuttle * @param id This shuttle's unique id. * @param route The route taken by this shuttle. * The first entry is the starting location. */ public Shuttle(String id, ArrayList&lt;String&gt; route) { super(id); this.route = route; } }
has comment: http://stackoverflow.com/comment/31534881

http://stackoverflow.com/a/21005018
upvote count: 1
answers question: http://stackoverflow.com/q/21004983
type: Answer
has body: No there isn't. This is a weakness of Java, that cannot be simply solved. You should use only one of the libraries. Having both on the classpath will make java always select the first one. This problem is named as Jar hell.
downvote count: 0
score: 1

http://stackoverflow.com/a/20874822
has body: It's a basic for loop that starts with the first position being the end of the string, and then decreases by 1 at every iteration (and stops when the i is &lt; 0). It could also be written as String x = "hello world"; for (int i = 0; i &lt; x.length(); i++) { System.out.print(x.charAt(x.length() - (i+1))); } Which will also print dlrow olleh
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/20874792
downvote count: 0

http://stackoverflow.com/comment/31517386
has text: @Lalonde, tenub's regex matches any combination of at least one number or space. It should work for the given string. Are you trying to match something more specific?
comment on: http://stackoverflow.com/q/20977361
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/52222301
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/20884399
score: 1
has body: There is also an easy, alternative way of setting up specific user role for a single request. It might be handy if you want to perform only a single operation as an authorized user (like set up the test fixture), and then check if user with different role can perform certain operation: ResultActions registerNewUserAsAdmin(String username, String password) throws Exception { final SignUpRequest signUpPayload = new SignUpRequest(username, password); final MockHttpServletRequestBuilder registerUserRequest = post(SIGN_UP_URL) .with(user("admin").roles("ADMIN")) .contentType(MediaType.APPLICATION_JSON_UTF8) .content(jsonMapper.writeValueAsString(signUpPayload)); return mockMvc.perform(registerUserRequest); } See SecurityMockMvcRequestPostProcessors for more details.
upvote count: 1

http://stackoverflow.com/a/20937980
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/31443629
has comment: http://stackoverflow.com/comment/31443144
has body: It doesn't work that way. HttpServletRequest objects are read-only, apart from the attributes. What you can do though is replace the request object with a wrapped one that returns the Path info you want. Usually you would do that in a Filter and wrap the request in a HttpServletRequestWrapper.
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/20937893

http://stackoverflow.com/q/21003944
has title: Why is toString() throwing NullPointerException in Android SDK (Eclipse)?
has comment: http://stackoverflow.com/comment/31565884
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/21003985
has comment: http://stackoverflow.com/comment/31565962
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31570422
has comment: http://stackoverflow.com/comment/31566246
has comment: http://stackoverflow.com/comment/31565798
has comment: http://stackoverflow.com/comment/31566115
tagged with: java
tagged with: eclipse
type: Question
linked to: http://stackoverflow.com/q/3422673
has body: I am building a simple calculator in android, i already made it work with simple x operator x form but i am trying to make it work with more than 2 tokens, and while using parenthesis. I am using an add-on Library to do the interpretation. EDIT: doccumentation for Interpreter Class: http://www.beanshell.org/javadoc/bsh/Interpreter.html I tried using this code in java standalone and it worked: public double evaluate(String express) { double value = 0; String answer = null; String base = "result = "; Interpreter interpreter = new Interpreter(); try { interpreter.eval(base + express); answer = interpreter.get("result").toString();//this line value = Double.parseDouble(answer); } catch (EvalError e) { // TODO Auto-generated catch block e.printStackTrace(); } But when i used it in android, the toString() method is throwing a nullpointerexception, why is that? why in android specifically?
has comment: http://stackoverflow.com/comment/31565731
answer count: 1

http://stackoverflow.com/comment/31410214
has text: i have removed the npe by some changes,but now the app records only one call.on second call it generate a file unrecognised by player.Mainly it just record one call.What is the problem with code.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20871528
type: AnswerComment

http://stackoverflow.com/q/20948398
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
has body: I have a document org.w3c.dom.Document parsed from a stream. The XML has a DTD entity declaration, so document creation fails when the stream is invalid according to the dtd. Now I need to make changes to the document and want it to be still DTD valid when it is serialized and saved. Of course this can be done by serializing and parsing it again, but that seems quite a bit of overhead that is not even needed. What is the proper way (ideally by only using the org.w3c.dom api) to implement this ?
score: 1
tagged with: java
upvote count: 1
tagged with: dom
type: Question
tagged with: dtd
downvote count: 0
favorite count: 0
has title: Ensure parsed org.w3c.dom.Document is DTD valid after changes

http://stackoverflow.com/q/21000128
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31558729
has answer: http://stackoverflow.com/a/21000412
tagged with: java
has comment: http://stackoverflow.com/comment/31558897
type: Question
has comment: http://stackoverflow.com/comment/31558531
has comment: http://stackoverflow.com/comment/31558957
has comment: http://stackoverflow.com/comment/31558673
has body: In my Java class DBManager I have a method alterRights(int, HashMap&lt;Integer,Right&gt;) In my JSP file I do HashMap&lt;Integer,Right&gt; radios = new HashMap&lt;Integer,Right&gt;(); Then I add a few items and then I do dbm.alterRights(alterKlausurID, radios); (dbm is an instance of DBManager) And here the exception is thrown. It says: "The method alterRights(int, HashMap) in the type DBManager is not applicable for the arguments (int, HashMap)". In a former version, the method actually was alterRights(int, HashMap&lt;Integer,String&gt;), but I changed it and it even worked until I changed something else. I didn't even touch this method or anything that is connected to it. For me it seems that the JSP file loads an older version of dbm but I don't know how this is even possible.
has title: the method in the type is not applicable for the arguments - but it should be (jsp)
score: 0
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/31558572

http://stackoverflow.com/a/20891369
answers question: http://stackoverflow.com/q/20884823
upvote count: 2
type: Answer
score: 2
has body: You could for example use setData(rowID) when you create the buttons. The onClick you retrieve the associated data of the button and have the correct row id.
accepted answer of: http://stackoverflow.com/q/20884823
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/20940652
linked to: http://stackoverflow.com/q/3246137
tagged with: java
has answer: http://stackoverflow.com/a/20940702
has comment: http://stackoverflow.com/comment/31450268
has comment: http://stackoverflow.com/comment/31449364
has comment: http://stackoverflow.com/comment/31448548
has comment: http://stackoverflow.com/comment/31448380
type: Question
linked to: http://stackoverflow.com/q/17384015
tagged with: casting
score: 2
has comment: http://stackoverflow.com/comment/31449289
has answer: http://stackoverflow.com/a/20940709
downvote count: 0
tagged with: covariance
has comment: http://stackoverflow.com/comment/31448394
favorite count: 0
tagged with: arraylist
linked to: http://stackoverflow.com/q/933447
tagged with: generics
possible better answer: http://stackoverflow.com/a/20940683
accepted answer: http://stackoverflow.com/a/20940709
has answer: http://stackoverflow.com/a/20940686
linked to: http://stackoverflow.com/q/2745265
upvote count: 2
answer count: 5
has answer: http://stackoverflow.com/a/20940807
has answer: http://stackoverflow.com/a/20940683
linked to: http://stackoverflow.com/q/12604477
has comment: http://stackoverflow.com/comment/31448450
linked to: http://stackoverflow.com/q/20037561
duplicate of: http://stackoverflow.com/q/2745265
has body: I`m wondering why this conversion is not working: ArrayList&lt;Song&gt; arrayList =new ArrayList&lt;MediaItem&gt;(); I may have to add that Song extends MediaItem. I think this conversion should work because Song has the ability to store all the information form MediaItem. So no information is lost. Does anyone have an explanation for me?
type: AnsweredQuestion
has title: Why does a type conversion not work in Java

syntax
tags question: http://stackoverflow.com/q/20927840
type: Tag
tags question: http://stackoverflow.com/q/20933302
tags question: http://stackoverflow.com/q/20914293
tags question: http://stackoverflow.com/q/20861790
tags question: http://stackoverflow.com/q/20907696
tag name: syntax
tags question: http://stackoverflow.com/q/20981224

http://stackoverflow.com/q/20888208
answer count: 7
has body: Can you write a method inside the main method? For example I found this code: public class TestMax { public static void main(String[] args) { int i = 5; int j = 2; int k = max(i, j); System.out.println("The maximum between is " + k); } public static int max(int num1, int num2) { int result; if (num1 &gt; num2) result = num1; else result = num2; return result; } } Can the method max be coded inside the main method?
has answer: http://stackoverflow.com/a/20888221
score: 14
type: AnsweredQuestion
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/42622516
possible better answer: http://stackoverflow.com/a/20888221
favorite count: 0
tagged with: methods
has answer: http://stackoverflow.com/a/20888289
has answer: http://stackoverflow.com/a/20888280
type: Question
tagged with: function
has answer: http://stackoverflow.com/a/56793981
tagged with: program-entry-point
upvote count: 14
has answer: http://stackoverflow.com/a/20888241
has title: Writing a function inside the main method - Java
has comment: http://stackoverflow.com/comment/31348106
has answer: http://stackoverflow.com/a/20888667
accepted answer: http://stackoverflow.com/a/20888667

http://stackoverflow.com/q/20858406
tagged with: java
has comment: http://stackoverflow.com/comment/31291746
type: Question
accepted answer: http://stackoverflow.com/a/20858484
answer count: 1
tagged with: string
has title: Caesar cipher in Java
favorite count: 0
has body: I'm trying to implement the Caesar cipher. But while doing so I am getting an unexpected output which I am unable to rectify. Will someone help me please? My code is as follows: import java.io.*; public class encryptology { public static void main(String args[])throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t, move = Integer.parseInt(br.readLine()); String s = "", st = br.readLine(); int l = st.length(); for(int x = 0; x &lt; l; x++){ char c = st.charAt(x); t = (int)c; if(move != 0){ t = t + move; if(t &gt; 90){ t = t - 26; } if(t &lt; 65){ t += 26; } c = (char)t; s = st + c; } } System.out.println(s); } } I entered move = 2 and st = charles The output was: charles[
score: 0
has answer: http://stackoverflow.com/a/20858484
tagged with: cryptography
has comment: http://stackoverflow.com/comment/31291766
upvote count: 2
downvote count: 2
type: AnsweredQuestion

http://stackoverflow.com/a/20985091
has body: The title is an object with a field called label, so you'll have to unpack that as well. Something like this might work: for(int i = 0 ; i &lt; arrayJsonObject.length() ; i++){ list.add(arrayJsonObject.getJSONObject(i).getJSONObject("title").getString("label"); } Partial raw JSON: "title": { "label": "Happy (from \"Despicable Me 2\") - Pharrell Williams" },
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31532398
type: AcceptedAnswer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/20984965
type: Answer
answers question: http://stackoverflow.com/q/20984965

http://stackoverflow.com/a/20963899
has body: Field initialization code is copied into each constructor... if you had multiple constructors and wanted the field initialized with the same value in each (or even just most) then it would be better to initialize at declaration and override the value in the constructor.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20963835
score: 1
has comment: http://stackoverflow.com/comment/31492101
upvote count: 1

http://stackoverflow.com/a/20871785
downvote count: 1
has comment: http://stackoverflow.com/comment/31317821
score: 33
has comment: http://stackoverflow.com/comment/52061982
answers question: http://stackoverflow.com/q/20871763
has comment: http://stackoverflow.com/comment/31317807
has comment: http://stackoverflow.com/comment/64937601
type: Answer
upvote count: 34
has body: If for some reason I can reasonably expect an unchecked exception to occur in a method, should I add it to the throws specification? Since unchecked exceptions indicate programming errors, declaring them in the throws clause should be avoided. Generally, catching these exceptions should not be attempted, except for the highest level of your program. There are a few exceptions (pun intended) to this rule - for example, in production code you should be catching NumberFormatException. Note: Sometimes, authors of frameworks make their base exception inherit RuntimeException (e.g. HibernateException). Exceptions like that should be caught as well.
has comment: http://stackoverflow.com/comment/92540032

http://stackoverflow.com/a/20912512
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20912282
has comment: http://stackoverflow.com/comment/31394908
type: Answer
downvote count: 0
score: 1
has body: to get the server certificate you can use open SSL to do so: openssl s_client -showcerts -connect host.host:9999 &lt;/dev/null The server certificate is the first certificate returned, and will be PEM formatted. The CA certificate is the final certificate returned, and is also PEM formatted. then you can import them PEMs to a JKS and configure httpclient to use that JKS. for more info about PEM to JKS http://www.agentbob.info/agentbob/79-AB.html
has comment: http://stackoverflow.com/comment/31394959
answers question: http://stackoverflow.com/q/20912282

http://stackoverflow.com/a/20935638
has comment: http://stackoverflow.com/comment/31440098
has comment: http://stackoverflow.com/comment/31441584
has comment: http://stackoverflow.com/comment/31441158
has comment: http://stackoverflow.com/comment/31441019
has comment: http://stackoverflow.com/comment/31439074
has comment: http://stackoverflow.com/comment/31441346
has comment: http://stackoverflow.com/comment/31440712
has comment: http://stackoverflow.com/comment/31438657
has comment: http://stackoverflow.com/comment/31441005
score: 0
has body: Have you tried something like: public static void main(String[] args) { System.setProperty("mbrola.base", "your/mbrola/base/directory"); VoiceManager voiceManager = VoiceManager.getInstance(); String voice = "mbrola_us1"; Voice helloVoice = voiceManager.getVoice(voice); if (helloVoice == null) { Voice[] availableVoices = voiceManager.getVoices(); List&lt;String&gt; voiceList = new ArrayList&lt;&gt;(); for (Voice v : availableVoices) voiceList.add(v.getName()); System.out.println("Not a valid voice: " + voice + "\nValid voices: " + voiceList); return; } helloVoice.allocate(); /* Synthesize speech. */ helloVoice.speak("Thank you for giving me a voice. " + "I'm so glad to say hello to this world."); /* Clean up and leave. */ helloVoice.deallocate(); }
has comment: http://stackoverflow.com/comment/31438793
has comment: http://stackoverflow.com/comment/31441509
has comment: http://stackoverflow.com/comment/31440865
has comment: http://stackoverflow.com/comment/31441041
type: Answer
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/31440821
has comment: http://stackoverflow.com/comment/31440634
has comment: http://stackoverflow.com/comment/31441091
answers question: http://stackoverflow.com/q/20905123

http://stackoverflow.com/a/20963634
upvote count: 5
has body: I believe this blog clearly describes the internal: If a method has defined a try-catch or a try-finally exception handler then an Exception Table will be created. This contains information for each exception handler or finally block including the range over which the handler applies, what type of exception is being handled and where the handler code is. When an exception is thrown the JVM looks for a matching handler in the current method, if none is found the method ends abruptly popping the current stack frame and the exception is re-thrown in the calling method (the new current frame). If no exception handler is found before all frames have been popped then the thread is terminated. This can also cause the JVM itself to terminate if the exception is thrown in the last non-daemon thread, for example if the thread is the main thread. Finally exception handlers match all types of exceptions and so always execute whenever an exception is thrown. In the case when no exception is thrown a finally block is still executed at the end of a method, this is achieved by jumping to the finally handler code immediately before the return statement is executed.
downvote count: 0
score: 5
type: Answer
answers question: http://stackoverflow.com/q/20963575
has comment: http://stackoverflow.com/comment/31491679

http://stackoverflow.com/comment/31570457
comment on: http://stackoverflow.com/q/21006147
score: 0
has text: @TheConstructor I split on any String not within `[a-zA-Z0-9']` (e.g. `?`, `:)`)
type: QuestionComment
type: Comment

http://stackoverflow.com/a/21060866
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21009487
type: Answer
answers question: http://stackoverflow.com/q/21009487
score: 2
upvote count: 2
has body: The drawImage function can take a destination size, and it will scale your image for you: drawImage(Image img, int x, int y, int width, int height, ImageObserver observer) Reference: http://docs.oracle.com/javase/7/docs/api/java/awt/Graphics.html
type: AcceptedAnswer

http://stackoverflow.com/comment/31380413
type: AnswerComment
has text: @ggianino Why are you using `ScannerUtility.readInt` then? That reads in an int...
type: Comment
comment on: http://stackoverflow.com/a/20890090
score: 0

http://stackoverflow.com/q/20875078
type: Question
has body: System.out.println("R.A.F. stands for R.A.F. blablabla".replaceAll( "\\bR\\.A\\.F\\.\\b", "royal airforce army")); I want to replace the second R.A.F in the string with "royal airforce army", why isn't it working?
tagged with: java
has title: Java regex replaceAll with boundaries not working
has comment: http://stackoverflow.com/comment/31324392
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/20875112
has answer: http://stackoverflow.com/a/20875104
possible better answer: http://stackoverflow.com/a/20875112
tagged with: regex
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20875104

http://stackoverflow.com/q/20925202
tagged with: increment
answer count: 4
has title: How to gradually increase the rate of something?
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31418203
has answer: http://stackoverflow.com/a/20925479
tagged with: sprite
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/20925460
has answer: http://stackoverflow.com/a/20925276
has body: I'm creating a 2d zombie shooter game and I'm trying to think of a good way to gradually increase the rate of which zombies are created. I create a zombie with the following code. public void createZombies(){ int direction = new Random().nextInt(4); if (direction == 0) { // spawn from top zombies.add(new Zombie(new Random().nextInt(1120), new Random() .nextInt(1))); } if (direction == 1) { // spawn from left zombies.add(new Zombie(new Random().nextInt(1), new Random() .nextInt(640))); } if (direction == 2) { // spawn from bottom zombies.add(new Zombie(new Random().nextInt(1120), 640)); } if (direction == 3) { // spawn from right zombies.add(new Zombie(1120, new Random().nextInt(640))); } } I basically want to call that method from my main method (which runs continuously). I thought of maybe using modular and do something like: int x = 1; if(x % 1000 == 0){ createZombies(); } x++; but that seems messy - and it doesnt change how frequently they are created. I'm just a bit stumped at finding a good way to do this - and surprisingly I couldn't find anything useful on here either. So if anybody can point out a good idea to do this it would be greatly appreciated!!
tagged with: java
tagged with: loops
type: Question
has answer: http://stackoverflow.com/a/20925266
has comment: http://stackoverflow.com/comment/31418179
upvote count: 2

http://stackoverflow.com/comment/49937283
comment on: http://stackoverflow.com/q/20853094
has text: While solving such error always take care of what told in http://stackoverflow.com/a/30935051/4773561 !!!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31555260
type: Comment
type: QuestionComment
score: 1
has text: No I get an string indexOutOFBounds message. If I remove ZTest#thisTest then W,X,Y run. If I remove W,X,Y then thisTest runs from Z. This is the error I get: `java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.String.substring(String.java:1904) at org.apache.maven.surefire.junit4.JUnit4Provider.getMethod(JUnit4Provider.java:287) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:147) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)`
comment on: http://stackoverflow.com/q/20991069

http://stackoverflow.com/a/23466734
has body: Had the same problem, it was indeed caused by weblogic stupidly using its own opensaml implementation. To solve it, you have to tell it to load classes from WEB-INF/lib for this package in weblogic.xml: <prefer-application-packages> org.opensaml.* </prefer-application-packages> maybe <prefer-web-inf-classes>true</prefer-web-inf-classes> would work too.
downvote count: 0
answers question: http://stackoverflow.com/q/20909446
type: Answer
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/73815322

http://stackoverflow.com/a/21008746
has comment: http://stackoverflow.com/comment/31575561
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31694124
type: Answer
has comment: http://stackoverflow.com/comment/31718643
accepted answer of: http://stackoverflow.com/q/21008638
answers question: http://stackoverflow.com/q/21008638
has body: Image image = (Image) picture.get(); // from Field to the object which is stored in the field Method method = image.getClass().getDeclaredMethod("Resize", (Class&lt;?&gt;[]) null); method.invoke(image, (Object[]) null); This applies to calling methods without parameters. If your method "Resize" requires paramters, you got to supply the types of them to the call for retrieving the method as well as passing the arguments on invoke. Method is the reflection object used for investigating methods of classes, calling "invoke" on a Method - object requires the targeted object to be passed as argument to invoke. The Class[] argument passed to getDeclaredMethod represent the signature of the method you are trying to invoke as there maybe more then one method with the same name but different parameters and parameter types (overloading) , say void Resize(), void Resize(int x, int y). The call to invoke is similar to directly calling the method on the object, so you got to provide the parameters you would in your normal call. Because the reflection api must provide a generic way of calling your method, this arguments must be cast to Oject[], imagine that otherwise an overload of Method.invoke would have to be available for any methods signature, and because this includes your own defined class types, this wouldn't be possible. (Well, it would, if the class would be generated at runtime and after investigating the code in some cases, but then dynamic class loading would have to retrigger the generation, loading and compiling as well as linking of the Method - class, which would be some kind of overkill). But indeed in this situation, where you both know the exact type of your object and the method you want to invoke (which is not changing), I would rather recommend you to cast the value of the field to Image and then invoke Resize on that object, like so: Image image = (Image) picture.get(); image.Resize();
score: 0

http://stackoverflow.com/a/20956891
has body: Add the message as an EXTRA to the alarm pendingIntent: Intent intent = new Intent(this, AlarmBoadcastReceiver.class); intent.putExtra("message", yourMessageString); Get the string in AlarmBoadcastReceiver onReceive method yourMessageString = intent.getExtras().getString("message","No message"); In showNotification add that string as an EXTRA to pendingintent: intent = new Intent(context, ShowDialog.class); intent.putExtra("message", yourMessageString); PendingIntent contentintent = PendingIntent.getActivity(context, 0, intent, 0); On ShowDialog onCreate method get the intent extra: userMessage = getIntent().getExtras().getString("message","No message"); Then set that message to AlertDialog alertDialogBuilder.setMessage(userMessage)
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20956023
has comment: http://stackoverflow.com/comment/31555341

http://stackoverflow.com/a/20980263
type: Answer
answers question: http://stackoverflow.com/q/20980154
has body: Return statement might not even be atomic based on the return type. Basically if you return more than 4 bytes, then it's not atomic anymore. See this question
has comment: http://stackoverflow.com/comment/31522799
score: 0

http://stackoverflow.com/comment/31500413
type: Comment
type: AnswerComment
score: 1
has text: yeah work bro i try your code and i add result.append(st3+'\n'); and the result like this Examples of paradoxes can be humorous and confusing thanks bro, and next process i want to remove punctuation and get that text to lowercase. can you help me again?
comment on: http://stackoverflow.com/a/20967944

http://stackoverflow.com/comment/31468287
comment on: http://stackoverflow.com/q/20951597
has text: @MartinDinov Error is in title :) Seems he provided a custom constructor and not providing any args.
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/a/20994666
has body: You have to use the following request.getParameterValues and get the result as an array String emails[] = request.getParameterValues("txt_email");
answers question: http://stackoverflow.com/q/20994466
has comment: http://stackoverflow.com/comment/31550428
has comment: http://stackoverflow.com/comment/31551273
type: Answer
has comment: http://stackoverflow.com/comment/31548656
downvote count: 0
score: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31548500
has comment: http://stackoverflow.com/comment/31548769
accepted answer of: http://stackoverflow.com/q/20994466
has comment: http://stackoverflow.com/comment/31550942
upvote count: 1

http://stackoverflow.com/q/20923436
tagged with: java
upvote count: 1
type: Question
has body: Helo, I have a problem with the subtraction of two dates because the result is not correct: public static void main(String[] args) throws ParseException, InterruptedException{ DateFormat format = new SimpleDateFormat("HH:mm:ss"); long start = System.currentTimeMillis(); Thread.sleep(3000); long goal = System.currentTimeMillis(); long wyn = goal - start; Date result = new Date(wyn); System.out.println("Test1: " + format.format(result)); } RESULT: Test1: 01:00:03 There should be only three seconds between start and stop - why is there one hour? (depend on summer/winter time?) I need count time between start and end my program and I just want to get hours, minutes and seconds. Can anyone help?
tagged with: date
has answer: http://stackoverflow.com/a/20923573
has answer: http://stackoverflow.com/a/20929690
downvote count: 0
has answer: http://stackoverflow.com/a/20923507
has title: JAVA- Date Interval time, wrong results
favorite count: 0
tagged with: time
possible better answer: http://stackoverflow.com/a/20923509
answer count: 4
linked to: http://stackoverflow.com/q/6841333
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20923509
score: 1
accepted answer: http://stackoverflow.com/a/20923507

http://stackoverflow.com/a/20916265
answers question: http://stackoverflow.com/q/20916172
type: Answer
score: 0
has body: You are allowed to have expressions inside a if statement as long as the expression resolves to a boolean. For example, int i = 0 if (i = i + 1) is not a valid expression inside an if statement because the expressions resolves to 1, which is an integer. However, int i = 0 if (2 == i = 2) is a valid expression because 2 is first assigned to the variable i and then is compared to 2, and thus the expression resolves to “true”. In your example if statement, you have a post-incremented variable x that is compared against 2 with the greater than operator, resulting in a boolean value, and thus it is a valid expression. Hotlinks has described what a post-incremented variable is in the comments.

http://stackoverflow.com/a/20950970
accepted answer of: http://stackoverflow.com/q/20949899
score: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31467417
type: Answer
upvote count: 3
has body: Your problem is, that you use your Application class as controller. That means the FXMLLoader tries to create another instance of Main. You have to create a different class for the controller. Your modified Main class: import java.io.IOException; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; public class Main extends Application { private Stage myStage; public static void main(String[] args) { Application.launch(Main.class, args); } @Override public void start(Stage stage) throws Exception { FXMLLoader loader = new FXMLLoader(); // this creates a instance of Controller now // and not a instance of Main Parent root = (Parent) loader.load(getClass().getResourceAsStream("load.fxml")); // get the controller corresponding to root Controller controller = loader.getController(); // tell the controller that this is it's Main class controller.setMain(this); stage.setTitle("FXML Welcome"); stage.setScene(new Scene(root, 300, 275)); stage.show(); myStage = stage; } public void handleLoadButton() throws IOException { Parent root = FXMLLoader.load(getClass().getResource("main.fxml")); myStage.setTitle("FXML Main"); myStage.setScene(new Scene(root, 300, 275)); myStage.show(); } } The controller class: import java.io.IOException; import javafx.fxml.FXML; public class Controller { @FXML private void handleLoadButton() throws IOException { myMain.handleLoadButton(); } private Main myMain; public void setMain(Main myMain) { this.myMain = myMain; } } Of course you have to replace the controller class in load.fxml: The fx:controller attribute in the Root node of the file should be: fx:controller="Controller" you may have to add the package name, if you're not using the default package.
answers question: http://stackoverflow.com/q/20949899

rsa
tags question: http://stackoverflow.com/q/21018355
tags question: http://stackoverflow.com/q/20961481
tag name: rsa
type: Tag

http://stackoverflow.com/a/20871748
answers question: http://stackoverflow.com/q/20871703
downvote count: 0
has body: public ArrayList&lt;Word&gt; readFromText(ArrayList&lt;Word&gt; Words) throws FileNotFoundException Is known as 'declaring' the exception. The method declares that this exception may be thrown. It would be better in this situation to declare it, than do a try/catch. This is because your class is at a lower level and higher level classes, such as a class that would use this one, would be more suited for the try/catch. More generally, see: How to Throw Exceptions Catching and Handling Exceptions
has comment: http://stackoverflow.com/comment/31318016
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/21017053
favorite count: 0
has answer: http://stackoverflow.com/a/24629172
answer count: 3
has answer: http://stackoverflow.com/a/21017370
has body: I have a very simple layout issue using MigLayout. Here is a short SSCCE import java.awt.Color; import java.util.Random; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import net.miginfocom.swing.MigLayout; public class LayoutDemo { public static void main(final String[] args) { JFrame frame = new JFrame(); JPanel panel = new JPanel(new MigLayout("insets 0, hidemode 2, debug", "", "")); final JLabel[] labels = {new JLabel("Area 1"), new JLabel("Area 2"), new JLabel("Area 3")}; for (final JLabel l : labels) { l.setHorizontalAlignment(JLabel.CENTER); l.setBackground(new Color(new Random().nextInt(Integer.MAX_VALUE))); l.setOpaque(true); } panel.add(labels[0], "w 200!"); panel.add(labels[1], "spany 2, push, grow, wrap"); panel.add(labels[2], "w 200!, grow, pushy"); frame.setContentPane(panel); frame.setSize(600, 400); frame.setVisible(true); } } which produces the following output: The cell of Area 1 uses up the same vertical space as Area 3. But I want Area 3 to push Area 1 away as much as possible. How can I do this? The only fixed length is the width of the left two labels.
possible better answer: http://stackoverflow.com/a/21017370
has title: MigLayout: push does not do what I expect
upvote count: 1
accepted answer: http://stackoverflow.com/a/24629172
tagged with: miglayout
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21017556
score: 1
tagged with: java
type: Question
tagged with: layout
tagged with: push
downvote count: 0

http://stackoverflow.com/q/20993972
has comment: http://stackoverflow.com/comment/31551169
has title: In struts2 framework, DTO consists of list<String>. Its not getting populated from S:select tag
tagged with: struts2
has comment: http://stackoverflow.com/comment/31550739
downvote count: 0
answer count: 1
tagged with: jsp
has answer: http://stackoverflow.com/a/21550503
favorite count: 0
has comment: http://stackoverflow.com/comment/31550153
type: UnansweredQuestion
upvote count: 3
has comment: http://stackoverflow.com/comment/31547532
has comment: http://stackoverflow.com/comment/31547886
tagged with: java
has comment: http://stackoverflow.com/comment/31547937
has body: I am new to struts2 and looking at the existing code and elsewhere in the net, I thought my below code should work. I am trying to select some user ids in s:select box in JSP and I want to use these ids in my action class. I am using modelDriven for it and users are in a list JSP code snippet &lt;s:select id="selectedAgents" name="selectedUserList" multiple="true" list="selectedUserList" /&gt; the selected user ids in the page comes to this box. and when the form is submitted, I expect to see the selectUserList in action. In the action I have public class WorkLoadReportAction extends GenericAction implements ModelDriven&lt;WorkloadReportDTO&gt; ... private WorkloadReportDTO userReportInputData = new WorkloadReportDTO(); ... @Override public WorkloadReportDTO getModel() { return userReportInputData; } the WorkloadReportDTO has List&lt;String&gt; selectedUserList and its getter and setter. Now in the method of the action(called from submit), I dont see the selectedUserList populated. What am I missing?
type: Question
score: 3
has comment: http://stackoverflow.com/comment/31552698
has comment: http://stackoverflow.com/comment/31550893

http://stackoverflow.com/comment/31434308
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20933658
type: Comment
has text: simpler: public class Parent<T extends Parent> { }, class Child extends Parent { } and main : Parent<Child> instance = new Parent<>();

http://stackoverflow.com/comment/31513287
type: QuestionComment
has text: @Pureferret: yes; as in the JoinedCompressionStrategy shown in the response.
comment on: http://stackoverflow.com/q/20972801
score: 1
type: Comment

http://stackoverflow.com/a/21068778
upvote count: 2
has body: I won't claim to know all the rest frameworks out there (or even half) but I'm going to go with the answer Probably Not As noted by others this is not the way REST normally thinks of it's interactions. REST is a great Hammer but if you need streaming, you are (IMHO) in screwdriver territory, and the hammer might still be made to work, but it is likely to make a mess. One can argue that it is or is not consistent with REST all day long, but in the end I'd be very surprised to find a framework that implemented this feature. I'd be even more surprised if the feature is mature (even if the framework is) because with respect to REST your use case is an uncommon corner case at best. If someone does come up with one I'll be happy to stand corrected and learn something new though :) Perhaps it would be best to be thinking in terms of comet or websockets for this particular operation. This question may be helpful since you already have spring. (websockets are not really viable if you need to support IE &lt; 10, which most commercial apps still require... sadly, I've got one client with a key customer still on IE 7 in my personal work)
downvote count: 0
answers question: http://stackoverflow.com/q/20902790
type: Answer
score: 2

http://stackoverflow.com/comment/31676972
comment on: http://stackoverflow.com/a/21010098
type: AnswerComment
score: 0
type: Comment
has text: is it neccesary to stop and start the delay, and what is the diffrence between setDelay and setInitialDelay

http://stackoverflow.com/comment/31462422
type: AnswerComment
has text: So what is the question, why the signed and unsigned binary representations of 1 2 3 4 5 are the same? That's how the two's complement system works, I positive integers have the same representation as when unsigned, and negative ones have the same representation as large positive unsigned integers. I'm afraid this has already been discussed to death.
type: Comment
comment on: http://stackoverflow.com/a/20946360
score: 0

http://stackoverflow.com/q/20853348
has title: How to pass one JSP to another JSP?
has comment: http://stackoverflow.com/comment/31282411
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20853400
has body: I am creating small web apps and I am facing the following problem. I have 2 JSPs and when I click the submit button, it repeats the value every time. What I want is that when I click on the submit button it should give only the corresponding value. index.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@page import="java.io.*,java.util.*" %> Class Video <% File f=new File("C:/Users/SHAKTI/Desktop/video"); File[] list=f.listFiles(); if(list.length!=0){ String s[]=new String[list.length]; for(int i=0;i<list.length;i++){ s[i]=list[i].toString(); String fi=list[i].getName(); %> <%=fi %> <input type="text" name="file" value="<%=s[i] %>"> <%}} else{ %> There is no any files in the database... <% } %> second.jsp <% response.setHeader("Cache-Control","no-cache"); response.setHeader("Pragma","no-cache"); response.setDateHeader ("Expires", 0); String id=request.getParameter("file"); out.println("id = "+id); %>
has comment: http://stackoverflow.com/comment/31282372
tagged with: java
has answer: http://stackoverflow.com/a/30114194
type: Question
has comment: http://stackoverflow.com/comment/31282594
has answer: http://stackoverflow.com/a/20853372
has answer: http://stackoverflow.com/a/20853684
has answer: http://stackoverflow.com/a/20854543
tagged with: jsp
answer count: 6
score: 0
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/20853367

http://stackoverflow.com/a/58445086
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20981387
has body: I know it's too late but in case if anyone finds this helpful i am posting my solution. I was able to resolve the same issue by downgrading my springframework aop version in pom.xml file.

struts2-interceptors
tags question: http://stackoverflow.com/q/20853135
type: Tag
tags question: http://stackoverflow.com/q/20999003
tags question: http://stackoverflow.com/q/20944860
tag name: struts2-interceptors
tags question: http://stackoverflow.com/q/21018018

http://stackoverflow.com/comment/31530756
comment on: http://stackoverflow.com/q/20984429
type: Comment
type: QuestionComment
has text: My initial guess would be that you are trying to create an instance of an abstract class or an interface. If that is the case please refer to following docs http://docs.oracle.com/javase/tutorial/java/IandI/abstract.html
score: 0

http://stackoverflow.com/q/20992111
has comment: http://stackoverflow.com/comment/31544136
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31543705
tagged with: java
accepted answer: http://stackoverflow.com/a/20993218
has comment: http://stackoverflow.com/comment/31543773
downvote count: 1
type: Question
tagged with: infinite-loop
tagged with: frameworks
has title: Preventing infinite loop in java
has comment: http://stackoverflow.com/comment/31543700
score: 0
has body: I wanted to make a little game like robot wars in Java. the idea is to extend my class Robot, with the custom rules, you add to it. however, i have so things I want to prevent coders to do, like infinite loops. I know some compilers will complain if there is an endless loop, in a Methode the requires a returning value. but I don't think all compilers will return an error on this, so I was thinking if there was a way to check this another way too? or maybe a way to make some sort of timeout on a method? Update: Looking back to this question I posted almost 3 and a half year ago, I am no longer doing programming in Java, however still an active Programmer, and with the years, I learned how hard it is to police 3rd party code if there is no review cycle implemented. There is no simple way to check if Code is malicious (that is why we have anti-virus programs). To do a thing that I wanted to do, I first of need to control the entire platform I am developing too, to check for reasons the code is behaving as it is, a task that would be nearly imposable or too time-consuming. that is why to do this more securely, the solution I reached is to use a Scripting Language that limits the user to the idea you had in mind. Hosting a Program on servers, that everybody has access to add code to is simply not a good idea. not even with Manage Program Languages as Java and CIL, as the platforms are not checking for those specifics, it would simply take too much effort to do this. Even though there is a way to "Sandbox" programs in Java, by using Policies and C# have something similar, it would never prevent a skilled programmer to exploit or do something that was never intended. I hope this update gives other a warning to what they are doing since I noticed this topic recently go searched a lot.
has comment: http://stackoverflow.com/comment/31545221
answer count: 1
has answer: http://stackoverflow.com/a/20993218
favorite count: 0

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

http://stackoverflow.com/q/20878854
tagged with: postgresql
type: AnsweredQuestion
tagged with: java
has body: I know it is a duplicate question . But I couldn't find solution for the same. I have hosted my application in the Amazon EC2 cloud. And I am using postgresql . I am getting an exception org.postgresql.util.PSQLException: An I/O error occured while sending to the backend. while running my application in Amazon cloud. The detailed stack-trace is : org.postgresql.util.PSQLException: An I/O error occured while sending to the backend. at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:281) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:555) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:403) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:331) at com.spy2k3.core.business.processor.ProcessorImpl.executeUpdate(ProcessorImpl.java:237) at com.spy2k3.core.business.object.BusinessObject.executeUpdate(BusinessObject.java:54) at com.spy2k3.core.business.object.LoginObject.deleteSession(LoginObject.java:127) at com.spy2k3.core.business.processor.LoginProcessor.userValidation(LoginProcessor.java:79) at com.spy2k3.core.business.processor.LoginProcessor.execute(LoginProcessor.java:30) at com.spy2k3.core.business.processor.ProcessorImpl.process(ProcessorImpl.java:73) at com.spy2k3.core.handler.request.RequestHandler.doService(RequestHandler.java:90) at com.spy2k3.core.handler.AbstractHandler.doPost(AbstractHandler.java:25) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.cor…
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/20900786
has comment: http://stackoverflow.com/comment/31365017
has comment: http://stackoverflow.com/comment/31367758
score: 4
tagged with: amazon-web-services
has comment: http://stackoverflow.com/comment/31347859
accepted answer: http://stackoverflow.com/a/20900786
has title: PostgreSQL Exception : org.postgresql.util.PSQLException: An I/O error occured while sending to the backend
has comment: http://stackoverflow.com/comment/31356711
tagged with: sql
downvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/31601501
has text: Don't forget to enter your namespace in the base-package parameter. I did that when I went for a try. :)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21022201

http://stackoverflow.com/comment/31477676
comment on: http://stackoverflow.com/q/20956561
has text: Also you do not have a Rectangle constructor with no arguments...you have one that accepts 4 integers...you can only call the one that accepts the 4 integers.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/49785915
has comment: http://stackoverflow.com/comment/123529998
downvote count: 0
score: 9
has comment: http://stackoverflow.com/comment/123576124
has comment: http://stackoverflow.com/comment/114236045
answers question: http://stackoverflow.com/q/20884353
upvote count: 9
has comment: http://stackoverflow.com/comment/122310148
has body: Using Oracle Java SE 1.8.0_121. It's possible to set jmxremote.port and jmxremote.rmi.port to the same value, it's one less port opened. It's also possible to set jmxremote.host=127.0.0.1, to have that port (or those two ports, if you set them differently) bind to the loopback interface only. Another port is still dynamically assigned though, and will bind to 0.0.0.0. I was not able to prevent this port with -XX+DisableAttachMechanism, and was also unable to make it bind to anything else than 0.0.0.0.
type: Answer

http://stackoverflow.com/a/20996756
upvote count: 3
type: Answer
score: 3
has body: The correct way is the static way: SoapClient.url = "" But here you probably need a regular field: public class SoapClient { private final String url; public SoapClient(final String url) { this.url = url; } }
answers question: http://stackoverflow.com/q/20996710
downvote count: 0

resize
tags question: http://stackoverflow.com/q/20925193
tags question: http://stackoverflow.com/q/20969851
tags question: http://stackoverflow.com/q/20979024
tags question: http://stackoverflow.com/q/20930511
type: Tag
tag name: resize
tags question: http://stackoverflow.com/q/20964894

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/21018196
tags question: http://stackoverflow.com/q/20901506
tags question: http://stackoverflow.com/q/20866608
tags question: http://stackoverflow.com/q/20863143
tags question: http://stackoverflow.com/q/20976337
tags question: http://stackoverflow.com/q/20927725
tags question: http://stackoverflow.com/q/20875380
tags question: http://stackoverflow.com/q/20930938
tags question: http://stackoverflow.com/q/20925004
tags question: http://stackoverflow.com/q/21015897
tags question: http://stackoverflow.com/q/21016211
tags question: http://stackoverflow.com/q/21010003
tags question: http://stackoverflow.com/q/20921646
tags question: http://stackoverflow.com/q/20863805
tags question: http://stackoverflow.com/q/20936772
tags question: http://stackoverflow.com/q/20867021
tags question: http://stackoverflow.com/q/21000550
tags question: http://stackoverflow.com/q/20969794
tags question: http://stackoverflow.com/q/20881215
type: Tag
tags question: http://stackoverflow.com/q/20852207
tags question: http://stackoverflow.com/q/20964161
tags question: http://stackoverflow.com/q/21001961
tags question: http://stackoverflow.com/q/20980427
tags question: http://stackoverflow.com/q/20907623
tags question: http://stackoverflow.com/q/20996428
tags question: http://stackoverflow.com/q/21010133
tags question: http://stackoverflow.com/q/20942664
tags question: http://stackoverflow.com/q/20935408
tags question: http://stackoverflow.com/q/20997421
tags question: http://stackoverflow.com/q/21016543
tags question: http://stackoverflow.com/q/20877251
tags question: http://stackoverflow.com/q/20989460
tags question: http://stackoverflow.com/q/20983550
tags question: http://stackoverflow.com/q/20892002
tags question: http://stackoverflow.com/q/21005841
tags question: http://stackoverflow.com/q/20960947
tags question: http://stackoverflow.com/q/20920862
tags question: http://stackoverflow.com/q/20988635
tags question: http://stackoverflow.com/q/20949618
tags question: http://stackoverflow.com/q/21014893
tags question: http://stackoverflow.com/q/20894034
tags question: http://stackoverflow.com/q/20991660
tags question: http://stackoverflow.com/q/20984323
tags question: http://stackoverflow.com/q/20896645
tags question: http://stackoverflow.com/q/21017292
tags question: http://stackoverflow.com/q/20865570
tags question: http://stackoverflow.com/q/20850837
tags question: http://stackoverflow.com/q/20929925
tags question: http://stackoverflow.com/q/20937270
tags question: http://stackoverflow.com/q/20984795
tags question: http://stackoverflow.com/q/20873523
tags question: http://stackoverflow.com/q/20965567
tags question: http://stackoverflow.com/q/20881001
tags question: http://stackoverflow.com/q/20991410
tags question: http://stackoverflow.com/q/20941650
tags question: http://stackoverflow.com/q/20994438
tags question: http://stackoverflow.com/q/21006120
tags question: http://stackoverflow.com/q/21007411
tags question: http://stackoverflow.com/q/20855502
tags question: http://stackoverflow.com/q/20903401
tags question: http://stackoverflow.com/q/20979585
tags question: http://stackoverflow.com/q/20861321
tags question: http://stackoverflow.com/q/20868472
tags question: http://stackoverflow.com/q/20894381
tags question: http://stackoverflow.com/q/20885549
tags question: http://stackoverflow.com/q/20910475
tags question: http://stackoverflow.com/q/20931195
tags question: http://stackoverflow.com/q/20992340
tag name: xml
tags question: http://stackoverflow.com/q/21001721
tags question: http://stackoverflow.com/q/20938314
tags question: http://stackoverflow.com/q/20875252
tags question: http://stackoverflow.com/q/20974294
tags question: http://stackoverflow.com/q/20983212
tags question: http://stackoverflow.com/q/20890731
tags question: http://stackoverflow.com/q/20931157
tags question: http://stackoverflow.com/q/21009608
tags question: http://stackoverflow.com/q/20859695
tags question: http://stackoverflow.com/q/20897343

http://stackoverflow.com/a/20863184
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/20863082
has body: The rotation is done around the origin, e.g. 0,0 of the coordinate system. If you want to rotate around a different point you need to translate the origin, rotate, and translate back, e.g.: g2d.translate(300, 250); g2d.rotate(45 * Math.PI/180); g2d.translate(-300, -250); g2d.drawString("B",300,250); Of course you have to take the size of the object you want to rotate in account. This rotates around the point where drawString would paint, which is the left baseline of the string. Probably you would want to rotate around the center; then you have to measure the object before and add those values to the translation.
downvote count: 0

http://stackoverflow.com/comment/31422886
comment on: http://stackoverflow.com/a/20927429
type: AnswerComment
score: 0
type: Comment
has text: But in a program I made I used the FileInputStream to do that. So im trying to find out what the advantages might be.

http://stackoverflow.com/comment/31478864
comment on: http://stackoverflow.com/q/20956923
has text: I can't open thousands of connections to the database. Is pooling all in one object that writes to the database the best solution? How would you design it?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31524868
score: 2
has text: Do not worry that much about texture switching, even if you use 10 different textures to draw the screen and you have 20 texture switches every draw, it wont affect the performance noticeably. Remember do not optimize prematurely.
comment on: http://stackoverflow.com/q/20971539
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20936017
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20935926
type: Answer
accepted answer of: http://stackoverflow.com/q/20935926
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/31439144
has body: Have you had a look at the AlertDialog.Builder? You could use this to build your dialog and then set your click handlers on setPositiveButton and setNegativeButton methods if you only want two options. It was added at API level 1.

http://stackoverflow.com/q/20965658
has comment: http://stackoverflow.com/comment/31495895
score: 0
has answer: http://stackoverflow.com/a/20972280
tagged with: deserialization
has answer: http://stackoverflow.com/a/20965704
has comment: http://stackoverflow.com/comment/31495246
has body: List ll=new LinkedList(); Student temp; int size = obj.readInt(); System.out.println(size); for (int i = 0; i &lt;size; ++i) { ll.add((Student) obj.readObject()); } obj.close(); System.out.println(ll); } it causes the run time exception as "Exception in thread "main" java.io.EOFException at java.io.DataInputStream.readInt(Unknown Source) at java.io.ObjectInputStream$BlockDataInputStream.readInt(Unknown Source) at java.io.ObjectInputStream.readInt(Unknown Source) at p1.DeSerializeDemo1.main(DeSerializeDemo1.java:18)" Please give me solution for this.
has answer: http://stackoverflow.com/a/20975008
answer count: 4
type: UnansweredQuestion
tagged with: file
has title: reading the serializable objects from file
type: Question
has comment: http://stackoverflow.com/comment/31495190
has comment: http://stackoverflow.com/comment/31495295
has comment: http://stackoverflow.com/comment/31495355
has answer: http://stackoverflow.com/a/20965824
tagged with: java

http://stackoverflow.com/q/20986885
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/20987757
upvote count: 3
has body: I am writing a game in Java that does some machine learning in the background for procedural generation, and I want it to escape briefly from the backgrounded training routine after n milliseconds to render the frame and update the NPCs and so on. The key thing being that n CANNOT be overestimated, as the game needs to be frame-locked to 16ms on all capable hardware and rendering stuff in lgwjl is a balancing act itself. The problem is that System.nanoTime() doesn't seem to work in my environment (it results in timeouts several orders of magnitude smaller than intended; HPC timers are incredibly flaky in my experience). And System.getCurrentTimeMillis doesn't seem to have well-specified rounding behavior, which means it could overestimate by nearly a millisecond, which is unacceptable. Does anybody know if there is a good way to do this?
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31535461
tagged with: asynchronous
type: AnsweredQuestion
has title: precise event timing in linux/java
downvote count: 0
accepted answer: http://stackoverflow.com/a/20987757
has comment: http://stackoverflow.com/comment/31535607
type: Question

http://stackoverflow.com/comment/31738750
type: QuestionComment
comment on: http://stackoverflow.com/q/20920702
score: 0
has text: Changing the `LayoutParams` dimensions won't affect anything until the next layout. You can read about how to implement `View` animation in the [API guides](http://developer.android.com/guide/topics/graphics/view-animation.html).
type: Comment

http://stackoverflow.com/tag/html
tags question: http://stackoverflow.com/q/20998271
tags question: http://stackoverflow.com/q/20946618
tags question: http://stackoverflow.com/q/20896285
tags question: http://stackoverflow.com/q/20894106
tags question: http://stackoverflow.com/q/20991373
tags question: http://stackoverflow.com/q/20922550
tags question: http://stackoverflow.com/q/20853348
tags question: http://stackoverflow.com/q/20976194
tags question: http://stackoverflow.com/q/20862891
tags question: http://stackoverflow.com/q/20873034
tags question: http://stackoverflow.com/q/21004375
tags question: http://stackoverflow.com/q/20986116
tags question: http://stackoverflow.com/q/20875252
tags question: http://stackoverflow.com/q/20991500
tags question: http://stackoverflow.com/q/20897938
tags question: http://stackoverflow.com/q/21007742
tags question: http://stackoverflow.com/q/20897196
type: Tag
tags question: http://stackoverflow.com/q/20983866
tags question: http://stackoverflow.com/q/20906460
tags question: http://stackoverflow.com/q/20963220
tags question: http://stackoverflow.com/q/20896399
tags question: http://stackoverflow.com/q/20880348
tags question: http://stackoverflow.com/q/20933275
tags question: http://stackoverflow.com/q/20943833
tags question: http://stackoverflow.com/q/20956406
tags question: http://stackoverflow.com/q/20945080
tags question: http://stackoverflow.com/q/20872648
tags question: http://stackoverflow.com/q/21015812
tags question: http://stackoverflow.com/q/20955512
tags question: http://stackoverflow.com/q/20896171
tags question: http://stackoverflow.com/q/20931157
tags question: http://stackoverflow.com/q/20997439
tags question: http://stackoverflow.com/q/20940132
tags question: http://stackoverflow.com/q/20892389
tags question: http://stackoverflow.com/q/20945838
tags question: http://stackoverflow.com/q/21000157
tags question: http://stackoverflow.com/q/20959453
tags question: http://stackoverflow.com/q/20960069
tags question: http://stackoverflow.com/q/20876046
tags question: http://stackoverflow.com/q/20930468
tags question: http://stackoverflow.com/q/20859990
tags question: http://stackoverflow.com/q/20934315
tags question: http://stackoverflow.com/q/20918112
tags question: http://stackoverflow.com/q/20913395
tags question: http://stackoverflow.com/q/20915170
tags question: http://stackoverflow.com/q/20913780
tags question: http://stackoverflow.com/q/20933773
tags question: http://stackoverflow.com/q/20997350
tags question: http://stackoverflow.com/q/20920125
tags question: http://stackoverflow.com/q/20957608
tags question: http://stackoverflow.com/q/20993160
tags question: http://stackoverflow.com/q/20898257
tags question: http://stackoverflow.com/q/20969794
tags question: http://stackoverflow.com/q/20964755
tags question: http://stackoverflow.com/q/20880307
tags question: http://stackoverflow.com/q/20878967
tags question: http://stackoverflow.com/q/20992567
tags question: http://stackoverflow.com/q/21013550
tags question: http://stackoverflow.com/q/20862067
tags question: http://stackoverflow.com/q/20923306
tags question: http://stackoverflow.com/q/20965988
tag name: html
tags question: http://stackoverflow.com/q/20870872
tags question: http://stackoverflow.com/q/20951951
tags question: http://stackoverflow.com/q/20953293
tags question: http://stackoverflow.com/q/20898105
tags question: http://stackoverflow.com/q/20964068
tags question: http://stackoverflow.com/q/20870082
tags question: http://stackoverflow.com/q/20850531
tags question: http://stackoverflow.com/q/21003353

http://stackoverflow.com/comment/31368280
comment on: http://stackoverflow.com/q/20898904
type: Comment
type: QuestionComment
has text: Why are you converting from a string to bytes and then back to a string? If the encoding is the same, the string will be the same and if not it will be garbage.
score: 1

http://stackoverflow.com/comment/31402422
comment on: http://stackoverflow.com/q/20916479
score: 0
has text: What is `CDate` function? What is your table declaration? Let us see some sample data.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20937177
answer count: 3
upvote count: 1
downvote count: 1
has title: Result: NaN will not work?
tagged with: android-activity
tagged with: nan
favorite count: 0
type: UnansweredQuestion
tagged with: android
has body: Within the app I have different activity pages that call for the user to enter numerical data. I think of storing the data as below so I can use it on the final activity: public void onClick(View v) { String variable1 = input.getText().toString(); Double.parseDouble(variable1); //stores information put into variable { Intent myintent = (new Intent(step1.this,step2.class)); myintent.putExtra("variable1",variable1); startActivity(myintent); I do this same process for all the other activities up to the final one where I have: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);{ setContentView(R.layout.activity_iie); Bundle extras = getIntent().getExtras(); //retrieves variables stored for formula if(extras !=null){ double variable1 = extras.getDouble("VARIABLE1"); double vari2 = extras.getDouble("VARI2"); double vari3 = extras.getDouble("VARI3"); double finalvari = extras.getDouble("finalvari"); double solution= ((((vari2 - vari1) / (vari3) + finalvari))); String lastString = "Result:" + solution; //prints out TextView lastText = (TextView) findViewById(R.id.solution1); lastText.setText(lastString); } I don't have any errors, but when I get to this final activity it prints out "Result:NaN". I'm trying to figure out why it is printing NaN; everything is set as a double. What could cause this? Update @Melquiades Yes I replaced the strings with the doubles as shown below: 'c.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { double variable1 = Double.parseDouble(input.getText().toString()); //stores information put into variable { Intent myintent = (new Intent(step1.this,step2.class)); myintent.putExtra("variabele1",variabele1); startActivity(myintent); ' Then in my final activity that is suppose to print the answer: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);{ setContentView(R.layout.activity_iie); Bundle extras = getIntent().getExtras(); //retrieves vari…
has answer: http://stackoverflow.com/a/20937291
has answer: http://stackoverflow.com/a/20937601
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20937350
score: 0

http://stackoverflow.com/a/20854130
upvote count: 5
has body: If both classes have a common interface that can be used inside your method, you can use it and catch both types. Otherwise, you can use overloading or generic method.
downvote count: 0
answers question: http://stackoverflow.com/q/20854108
score: 5
type: Answer

http://stackoverflow.com/comment/31370379
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20899087
has text: Related to this, if the OP was using [JodaTime](http://www.joda.org/joda-time/) (the precursor to JSR310, essentially), there's a similar set of functions allowing you to change the clock.

http://stackoverflow.com/comment/31413780
type: QuestionComment
has text: @dhamibirendra it is obviously.
score: 0
comment on: http://stackoverflow.com/q/20922777
type: Comment

http://stackoverflow.com/a/20853656
answers question: http://stackoverflow.com/q/20853583
score: 1
downvote count: 0
has body: If you only stream the data from resultset to file without using big buffers this should be possible, but maybe you are first collecting the data in a growing list before sending to file? So you should investigate this issue. Please specify your question more otherwise we have to speculate.
type: Answer
upvote count: 1

http://stackoverflow.com/q/20880587
has comment: http://stackoverflow.com/comment/31334973
linked to: http://stackoverflow.com/q/17966773
tagged with: java
tagged with: background
downvote count: 1
duplicate of: http://stackoverflow.com/q/17966773
type: Question
has comment: http://stackoverflow.com/comment/31334016
linked to: http://stackoverflow.com/q/5621338
has title: unable to set JPanel background image
upvote count: 0
has answer: http://stackoverflow.com/a/20881596
score: -1
tagged with: image
has comment: http://stackoverflow.com/comment/31334040
answer count: 1
has comment: http://stackoverflow.com/comment/31334563
favorite count: 0
has comment: http://stackoverflow.com/comment/31335623
accepted answer: http://stackoverflow.com/a/20881596
has comment: http://stackoverflow.com/comment/31335260
has comment: http://stackoverflow.com/comment/31335222
has body: I need this for implementing the secret maze mini-game and I am unable to set a background image for a JPanel. It has to be, strictly, JPanel. In addition it would be good to be solved via an URL. If you can give me some, not just ideas I would appreciate it, cause I have read some ideas, but they weren't working or at least I didn't succeed in implementing them. I have the following code: import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; public class PanelLooks extends JFrame { JPanel content = new JPanel(); private JButton NewGameBtn = new JButton("New Game"); private JButton TopTimesBtn = new JButton("Top Times"); private JButton QuitGameBtn = new JButton("Quit Game"); public PanelLooks() { setPreferredSize(new Dimension(600, 600)); content.setLayout(new FlowLayout()); content.add(NewGameBtn); content.add(TopTimesBtn); content.add(QuitGameBtn); NewGameBtn.setBounds(250, 160, 100, 30); TopTimesBtn.setBounds(250, 260, 100, 30); QuitGameBtn.setBounds(250, 360, 100, 30); this.setContentPane(content); this.pack(); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.setTitle("Secret Maze"); } The latest version after editing contains an attempt that fails because of a NullPointerException: private BufferedImage myPicture; private JLabel picLabel = new JLabel(new ImageIcon(myPicture)); public void backgroundImage() { try { BufferedImage myPicture = ImageIO.read(new File("D:/Dokumentumok/Egyetem/Object oriented programming/Java project/Project/Background.jpg")); } catch(IOException ex) { System.err.println("File not found!"); } } and this picLabel is called in the constructor as the others were by: content.add(picLabel);
tagged with: embedded-resource
tagged with: swing
has comment: http://stackoverflow.com/comment/31335281
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17874717

http://stackoverflow.com/a/20959199
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/31483207
has body: Liferay is also "Servlet"-Application - but a very-very big one. And Liferay need some servlet container like tomcat, jetty, jboss etc. However, you can simple create servlet project and deploy it direct to servlet container where liferay is running. edit: and put to web.xml by servlet-mapping a direct access like "/*".
answers question: http://stackoverflow.com/q/20950689
score: 5
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20950689
upvote count: 6

http://stackoverflow.com/q/21003484
tagged with: java
type: Question
has body: I have this implementation of ListAdapter: public class TaskAdapter implements ListAdapter, View.OnClickListener { Context context; List&lt;Task&gt; tasks; // View adapterView; public TaskAdapter(Context context, List&lt;Task&gt; tasks) { super(); this.context = context; this.tasks = tasks; } ... @Override public View getView(int position, View convertView, ViewGroup parent) { Task data = tasks.get(position); Button task_menu_bt = (Button)root.findViewById(R.id.taskMenuButton); task_menu_bt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { **// How to access current Task data?? i can not do tasks.get(position)** } }); } My question is how can i access Task data from inside the onClick event on a button located in the item row (not the view click but a button on the list view)? My task class contains for exmaple getName() methods and others...
answer count: 2
has answer: http://stackoverflow.com/a/21003717
possible better answer: http://stackoverflow.com/a/21003712
has answer: http://stackoverflow.com/a/21003712
tagged with: listadapter
score: 0
has comment: http://stackoverflow.com/comment/31564968
has comment: http://stackoverflow.com/comment/31564837
tagged with: android
accepted answer: http://stackoverflow.com/a/21003717
has comment: http://stackoverflow.com/comment/31565042
has comment: http://stackoverflow.com/comment/31565089
has title: Accessing objects inside a custom ListAdpater events clicks
type: AnsweredQuestion

http://stackoverflow.com/q/20903469
has title: How to continuously run shadow effect through texts in android text view?
tagged with: java
has answer: http://stackoverflow.com/a/20903839
answer count: 3
downvote count: 0
tagged with: textview
favorite count: 0
has body: How to run shadow effect through the texts in android text view. Pls refer the above image. white color shadow runs from the starting letter 'S' to end letter 's' of text "Slide for options". Current white shadow position 'opt' in "options". Thanks!
type: UnansweredQuestion
tagged with: android
score: 6
has answer: http://stackoverflow.com/a/20903644
has answer: http://stackoverflow.com/a/20904030
upvote count: 6
type: Question

http://stackoverflow.com/q/20924352
has comment: http://stackoverflow.com/comment/31416577
tagged with: java
has body: The following code runs, but prints null. The end goal is to have the song play, and be able to stop it by pressing the cancel button. Any ideas? Thanks.. Here is my code: if (song.equals("Dan + Shay - 19 You + Me")){//if this song is selected... try{ stopPlay(); AudioInputStream audio = AudioSystem.getAudioInputStream(getClass().getResourceAsStream("C:\\Stuff\\Grade Twelve\\Computer Programming\\Unit 4\\Step 3\\GuitarForBeginners\\src\\guitarforbeginners\\resources\\You+Me.wav")); clip = AudioSystem.getClip(); clip.open(audio); clip.start(); } catch(Exception e){ stopPlay(); System.err.println(e.getMessage()); }
has title: Audio in Java: Why am I getting `null`?
has answer: http://stackoverflow.com/a/20929315
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/20929315
score: 0
tagged with: javasound
has comment: http://stackoverflow.com/comment/31416999
type: AnsweredQuestion
tagged with: audio

http://stackoverflow.com/comment/31341238
has text: Yeah, the app crashes when executing whatever is on AddPeople.java line 63, which tiggers a java.lang.IllegalStateException
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20884592

http://stackoverflow.com/q/21009377
has body: I am using JavaFX and my application has a table and I can add elements to the table but I want to create a context menu that displays on a row when I right click on that row. What I have... In Scene Builder I have a method that runs on when the Context Menu is activated but that isn't exactly what I want. This would be fine really because I am programmatically grab the selected item from the table whenever I want. The issue, if I keep what I currently have, is getting the context menu to popup at the selected element. contextMenu is the context menu with menu items. connectedUsers is the TableView The following is the closest I can get, but this shows the context menu at the bottom of the TableView contextMenu.show(connectedUsers, Side.BOTTOM, 0, 0);
possible better answer: http://stackoverflow.com/a/31337761
linked to: http://stackoverflow.com/q/21344244
has answer: http://stackoverflow.com/a/31337761
accepted answer: http://stackoverflow.com/a/21012166
score: 14
type: AnsweredQuestion
has title: Context Menu on a row of TableView?
tagged with: contextmenu
downvote count: 0
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/90547774
has answer: http://stackoverflow.com/a/21012166
type: Question
has answer: http://stackoverflow.com/a/41534419
upvote count: 14
answer count: 3
favorite count: 0

http://stackoverflow.com/comment/31554798
type: Comment
type: QuestionComment
has text: I am not providing any width to the label2 as you can see above.<h:outputLabel id="label2" value="#{XXBean.details.projectName}"/>
comment on: http://stackoverflow.com/q/20996490
score: 0

http://stackoverflow.com/q/20912006
has answer: http://stackoverflow.com/a/21660200
has body: I'm writing an LDAP query to return every account with a UID on an eDirectory server. These accounts will then be cached into a hashmap for use later. The filter I'm using is (&amp;(UID=*)) but I'm getting the following exception: Caught: LDAPSearchException(resultCode=53 (unwilling to perform), numEntries=0, numReferences=0, errorMessage='unwilling to perform', responseControls={SimplePagedResultsControl(pageSize=0, isCritical=false)}) LDAPSearchException(resultCode=53 (unwilling to perform), numEntries=0, numReferences=0, errorMessage='unwilling to perform', responseControls={SimplePagedResultsControl(pageSize=0, isCritical=false)}) at com.unboundid.ldap.sdk.LDAPConnection.search(LDAPConnection.java:3059) at com.unboundid.ldap.sdk.LDAPInterface$search.call(Unknown Source) This query code works fine if I change the filter to be something more specific like (&amp;(UID=a*)) but it seems to fail anytime it's a query that will return a lot of rows. I double check every query in Apache Directory Studio and they all work there with no problems. Is there some kind of limit for eDirectory queries? If so, what can I do to get around this limit and cache attributes from every account into a hashmap? I have code working that runs multiple queries for all UIDs starting with a, b, c, etc for the entire alphabet but I'm afraid I may not be getting every account this way.
score: 1
has title: eDirectory query returns unwilling to perform LDAPSearchException
upvote count: 1
type: Question
tagged with: ldap-query
has comment: http://stackoverflow.com/comment/31394511
tagged with: java
has comment: http://stackoverflow.com/comment/31408121
tagged with: groovy
answer count: 1
downvote count: 0
favorite count: 0
tagged with: ldap
tagged with: edirectory
has comment: http://stackoverflow.com/comment/31393784
type: UnansweredQuestion

http://stackoverflow.com/q/20917555
answer count: 5
tagged with: android
has answer: http://stackoverflow.com/a/20917733
possible better answer: http://stackoverflow.com/a/20917577
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20917577
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20917579
has answer: http://stackoverflow.com/a/20917670
has answer: http://stackoverflow.com/a/20917657
score: 0
has title: How to set api key for Google maps v2
accepted answer: http://stackoverflow.com/a/20917579
has body: I am trying to create a map application. I am setting up the AndroidManifest.xml file for the permissions and API Key. This is my manifest file: <?xml version="1.0" encoding="utf-8"?> <permission android:name="com.dibya.map.permission.MAPS_RECEIVE" android:protectionLevel="signature" /> <uses-feature android:glEsVersion="0x00020000" android:required="true" /> <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="18" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="KEY" /> I am getting an error message: Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4030500 but found 0. You must have the following declaration within the element: <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> I have entered the correct API key. Please tell me where am I making mistake.

http://stackoverflow.com/comment/31586124
type: QuestionComment
has text: i have added delay after delete file if delay is 15000 then file creation time is changed and if delay is 14000 then file creation time is not changed. why system behave like this.
score: 0
comment on: http://stackoverflow.com/q/20884521
type: Comment

http://stackoverflow.com/a/20877228
score: 3
answers question: http://stackoverflow.com/q/20877199
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20877199
type: Answer
has body: For this sort of problem really you need to look at what language tools are provided to you and how to make use of them to do the hard work for you. To remove duplicates just place them into a Set. To have them sorted use a TreeSet. So you get: Set&lt;Integer&gt; values = new TreeSet&lt;Integer&gt;(); That will sort them from smallest to largest, to reverse the order specify your own comparator for the TreeSet that just reverses the natural ordering. Then iterate over the Set and the nth value returned from the iterator is your value. Your current code looks mostly valid, it doesn't actually remove duplicates though - you need to actually remove things from the Array for that, which Arrays do not support without recreating them as they cannot be resized. Additionally it will get confused if you include 0s or negative numbers. For example the biggest number in (-3, -5, -6, -6) will come back as 0.
upvote count: 3

http://stackoverflow.com/q/20949043
type: UnansweredQuestion
upvote count: 1
type: Question
score: 1
tagged with: java
tagged with: jedis
downvote count: 0
answer count: 1
has title: RedisUtil shared connection pool false
tagged with: tomcat
favorite count: 0
tagged with: redis
has body: I am using Atmosphere framework for my server side script on tomcat server. I am also using redis server and using jedis library for java. I am getting following log in tomcat console after which all the atmosphere connections gets close to server and server unable to communicate with client side: 10:59:51.443 [http-bio-8080-exec-6] INFO o.a.samples.pubsub.EventsLogger - onDisconnect(): 120.138.212.106:55163 11:01:52.502 [http-bio-8080-exec-3] INFO o.a.plugin.redis.RedisBroadcaster - org.atmosphere.plugin.redis.RedisUtil shared connection pool false 11:01:52.504 [http-bio-8080-exec-3] DEBUG o.a.util.AbstractBroadcasterProxy - Reconfiguring Broadcaster media1 11:01:52.505 [http-bio-8080-exec-3] INFO o.a.samples.pubsub.EventsLogger - onSuspend(): 120.138.212.106:55166 11:01:52.510 [http-bio-8080-exec-3] INFO o.a.samples.pubsub.EventsLogger - onConnect(): WebSocketEvent{message='', type=CONNECT, webSocket=org.apache.catalina.websocket.WsOutbound@133e9fa} Can anyone help me to solve this? I am using following code for redis connection pool: public class ServerStart implements ServletContextListener { private static JedisPool pool; @Override public void contextInitialized(ServletContextEvent sce) { pool = new JedisPool(new JedisPoolConfig(), "localhost", 6379); } public static Jedis getResourceFromPool() { Jedis jedis = pool.getResource(); return jedis; } @Override public void contextDestroyed(ServletContextEvent sce) { } } I am using getResourceFromPool() method for getting redis connection.
has answer: http://stackoverflow.com/a/21023816
has comment: http://stackoverflow.com/comment/86531992
tagged with: atmosphere

http://stackoverflow.com/comment/31479822
score: 0
type: AnswerComment
has text: than okey, Thanks for all you done, I'll try to solve it
type: Comment
comment on: http://stackoverflow.com/a/20956822

http://stackoverflow.com/comment/65592076
has text: Your free theorems are not the result of type erasure. Name one bad thing type erasure prevents you from doing.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21843984
score: 1

http://stackoverflow.com/a/20860287
accepted answer of: http://stackoverflow.com/q/20859381
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/20859381
has body: If I understand corectly you can put some flag which will hold value for current visible tab and use if statment to remove row from correct Model. On the other hand better solution would be creating some kind of controller. The controller would store active tab, and would have removeRow method. Switching tab would trigger event so controller would know from which tab delete row.

http://stackoverflow.com/comment/31577178
score: 0
type: Comment
type: QuestionComment
has text: Can you provide an example of just how you're using anonymous classes, and what performance issues it is that worry you?
comment on: http://stackoverflow.com/q/21009712

http://stackoverflow.com/q/20889256
tagged with: search-engine
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/11586715
has title: solr.Caused by: java.lang.RuntimeException: [solrconfig.xml] requestHandler: missing mandatory attribute 'class'
tagged with: java
tagged with: solr
tagged with: mysql
type: Question
accepted answer: http://stackoverflow.com/a/20889611
tagged with: lucene
score: 0
has body: I try to introduce with apache Solr. At this resource I find out popular question: Apache Solr java tutorials I tryed to start from 1 link: simple example When I reached the point Stop and restart solr instance. Check if there are any jdbc errors, this could happen if the jdbc drivers are not properly installed. I see next trace(last version): 2875 [coreLoadExecutor-3-thread-1] ERROR org.apache.solr.core.CoreContainer Ц F ailed to load file D:\solr2\example\solr\collection1\solrconfig.xml 2875 [coreLoadExecutor-3-thread-1] ERROR org.apache.solr.core.CoreContainer Ц U nable to create core: collection1 org.apache.solr.common.SolrException: Could not load config file D:\solr2\exampl e\solr\collection1\solrconfig.xml at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java :525) at org.apache.solr.core.CoreContainer.create(CoreContainer.java:592) at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:271) at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:263) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.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) Caused by: java.lang.RuntimeException: [solrconfig.xml] requestHandler: missing mandatory attribute 'class' at org.apache.solr.util.DOMUtil.getAttr(DOMUtil.java:80) at org.apache.solr.util.DOMUtil.getAttr(DOMUtil.java:87) at org.apache.solr.core.PluginInfo.&lt;init&gt;(PluginInfo.java:51) at org.apache.solr.core.SolrConfig.readPluginInfos(SolrConfig.java:296) at org.apache.solr.core.SolrConfig.loadPluginInfo(SolrConfig.java:281) at org.apache.solr.core.SolrConfig.&lt;init&gt;(SolrConfig.java:219)…
answer count: 1
has answer: http://stackoverflow.com/a/20889611

http://stackoverflow.com/a/20944467
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20942492
has body: This is very easy to in Google Map API V2 . If you would like to do this then you can follow this reference link: Go this stackoverflow link This man already give useful solution. I have done the same way as this site told. For your facility I have written the main things: 1.create a list of LatLng points such as: List&lt;LatLng&gt; routePoints; 2.Add the route points to the list (could/should be done in a loop): routePoints.add(mapPoint); 3.Create a Polyline and feed it the list of LatLng points as such: Polyline route = map.addPolyline(new PolylineOptions() .width(_strokeWidth) .color(_pathColor) .geodesic(true) .zIndex(z)); route.setPoints(routePoints); Try this and give feedback!!!
upvote count: 1

http://stackoverflow.com/q/21002992
has answer: http://stackoverflow.com/a/21005562
tagged with: java
type: Question
upvote count: 4
tagged with: aspectj
answer count: 2
has title: Spring pointcut for abstract class' protected method
downvote count: 0
score: 4
has answer: http://stackoverflow.com/a/21003110
tagged with: spring-aop
favorite count: 0
linked to: http://stackoverflow.com/q/15616710
type: UnansweredQuestion
has body: I am using Spring 3.2 and AspectJ 1.7.1. (It is not likely that I can upgrade to later versions in the near future.) I need to define a pointcut for a protected method in an abstract class. AFAIK I need AspectJ for methods that are not public, so I have only tried this with the (AspectJ) annotations: package com.aspects; @Aspect public class Aspect{ @Before("execution(* com.x.y.x.MyClass.myMethod(..))") public void beforeAspect(){ //do something here } } In my beans.xml I have: &lt;aop:aspectj-autoproxy /&gt; &lt;bean id="myAspect" class="com.aspects.Aspect"/&gt; I have checked and my Aspect class is created (constructor is getting called), no exception is being thrown when the application is launched. However I can not get the beforeAspect to be called. For public methods in non abstract classes this works. How can I make it work for protected method in abstract class?
tagged with: spring

http://stackoverflow.com/comment/31391304
score: 1
comment on: http://stackoverflow.com/a/20909695
type: AnswerComment
type: Comment
has text: @pushya More than likely, yes. Try it and see what happens.

http://stackoverflow.com/comment/31585146
type: Comment
has text: do you really need how to invoke two threads or you want to synchronize `increement` `decreement` function
type: QuestionComment
comment on: http://stackoverflow.com/q/21014305
score: 0

http://stackoverflow.com/q/20949987
has comment: http://stackoverflow.com/comment/31465399
has comment: http://stackoverflow.com/comment/31465105
has comment: http://stackoverflow.com/comment/31465238
score: 2
upvote count: 3
has title: Various types of images in Java
downvote count: 1
tagged with: javax.imageio
type: Question
linked to: http://stackoverflow.com/q/3944825
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31465049
has comment: http://stackoverflow.com/comment/31465460
tagged with: java
tagged with: image
has comment: http://stackoverflow.com/comment/31465143
has body: When attemting to make a simple application which uses an image I was amazed at the large number of image types available to me. I did a search on them and whilst finding a little about them cannot work out what image is ment to be used in what circumstances. The types of image I am confused about are Image, ImageIcon, and ImageIO.
answer count: 1
has answer: http://stackoverflow.com/a/20950387
favorite count: 0
tagged with: imageicon
accepted answer: http://stackoverflow.com/a/20950387

http://stackoverflow.com/a/20890642
accepted answer of: http://stackoverflow.com/q/20890554
answers question: http://stackoverflow.com/q/20890554
type: Answer
has comment: http://stackoverflow.com/comment/107780479
score: 5
type: AcceptedAnswer
upvote count: 5
has body: A simpler approach is to use a power of 2 size and do the following. final double[] array; final int sizeMask; final AtomicInteger i = new AtomicInteger(); public CircularBuffer(int size) { assert size &gt; 1 &amp;&amp; ((size &amp; (size -1)) == 0); // test power of 2. array = new double[size]; sizeMask = size -1; } void add(double value) { array[i.getAndIncrement() &amp; sizeMask] = value; }
downvote count: 0
has comment: http://stackoverflow.com/comment/107864905
has comment: http://stackoverflow.com/comment/137891143

http://stackoverflow.com/comment/31407406
has text: I am trying your answer but it is asking me to create Media.getBitmap(); function.
comment on: http://stackoverflow.com/a/20919417
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/20937779
has body: Ok, the straightforward interpretation of the code is: - The mappers walks over some (presumably random) subset of the data, and generates canopy centers all of which are at least T1 distance from each other. These centers are emitted. - The reducer then walks over all the canopy centers that belong to each specific stock key (like MSFT, GOOG, etc) from all the mappers and then ensures that there are no canopy centers that are within T1 of each other for each stock key value (e.g., no two centers in GOOG are within T1 of each other, although a center in MSFT and a center in GOOG may be close together). The goal of the code is unclear, personally I think there's got to be a bug. The reducers basically solve the problem as if you are trying to generate centers for each stock key independently (i.e., calculate canopy centers for all data points for GOOG), while the mappers seem to solve the problem of trying to generate centers for all stocks. Placed together like that, you get a contradiction so neither problem is actually getting solved. If you want centers for all stock keys: - Then the map output must send everything to ONE reducer. Set the map output key to something trivial like a NullWritable. Then the reducer will perform the correct operations without change. If you want centers for EACH stock key: - Then the mapper needs to be changed so that effectively you have one separate canopy list for each stock key, you can either do this by keeping a separate arrayList for each stock key (preferred, since it will be faster) or, you can just change the distance metric such that stock keys that belong to different stock keys are an infinite distance apart (so they never interact). P.S. By the way there are also some unrelated issues with your distance metric. First, you're parsing the data using Double.parseDouble, but not catching NumberFormatException. Since you're giving it stockData, which incudes non-digit strings like 'GOOG' in the very first field, you're going …
answers question: http://stackoverflow.com/q/20931868
has comment: http://stackoverflow.com/comment/31443877
type: Answer
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20931868

http://stackoverflow.com/q/20935474
possible better answer: http://stackoverflow.com/a/20935528
has comment: http://stackoverflow.com/comment/31438186
has answer: http://stackoverflow.com/a/20935528
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31437852
has title: Fixed length array vs fields
accepted answer: http://stackoverflow.com/a/20935565
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/31437822
has comment: http://stackoverflow.com/comment/31437926
type: Question
has comment: http://stackoverflow.com/comment/31437929
has body: What is faster? I want to write an API for processing and calculating with vectors and matrices. A "Matrix4f" needs 4*4 float values. Should i write this as 16 fields or a two-dimensional array? But if i use fields, inheritance is impossible.
tagged with: performance
has comment: http://stackoverflow.com/comment/31438113
answer count: 2
has comment: http://stackoverflow.com/comment/31437808
has answer: http://stackoverflow.com/a/20935565
tagged with: arrays
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31437838
tagged with: field

http://stackoverflow.com/a/35868654
upvote count: 77
answers question: http://stackoverflow.com/q/20937362
type: Answer
score: 77
downvote count: 0
has body: The @Context annotation allows you to inject request/response context details into JAX-RS provider and resource classes. Injection can be performed into a class field, a bean property or a method parameter. The following list summarizes all the types that can be injected using the @Context annotation, according to the JAX-RS 2.0 specification: javax.ws.rs.core.Application javax.ws.rs.core.HttpHeaders javax.ws.rs.core.Request javax.ws.rs.core.SecurityContext javax.ws.rs.core.UriInfo javax.ws.rs.core.Configuration javax.ws.rs.container.ResourceContext javax.ws.rs.ext.Providers Except for Configuration and Providers, which are injectable in both client and server-side providers, all the other types are server-side only. The following types are available only when the application is deployed in a servlet container: javax.servlet.HttpServletRequest javax.servlet.HttpServletResponse javax.servlet.ServletConfig javax.servlet.ServletContext JAX-RS 2.1 introduced other types that can be injected with @Context: javax.ws.rs.sse.Sse javax.ws.rs.sse.SseEventSink Besides the standard types listed above, JAX-RS implementations, such as Jersey, RESTEasy and Apache CXF, might define their own types that can be injected using @Context. Find below a quick description of each JAX-RS type available for injection: Application: The instance of the application-supplied Application subclass can be injected into a class field or method parameter. Access to the Application subclass instance allows configuration information to be centralized in that class. URIs and URI templates: UriInfo provides both static and dynamic, per-request information, about the components of a request URI. Headers: HttpHeaders provides access to request header information either in map form or via strongly typed convenience methods. Response headers may be provided using the Response class. Content negotiation and preconditions: The methods of Request allow a caller to determine the best matching representation vari…

http://stackoverflow.com/a/20918605
score: 0
answers question: http://stackoverflow.com/q/20918188
type: Answer
has body: If you change the java.lang.Object and if it does not passthe ByteCode verification process, then it may throw error. Other wise there is no check enfored by jvm to say it is safe or not

http://stackoverflow.com/q/20983060
tagged with: java
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/20983568
has title: No route to host : connect
has answer: http://stackoverflow.com/a/77467980
has body: I am getting my public IP from the website, but sometimes I get this error: java.net.NoRouteToHostException: No route to host: 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 java.net.Socket.connect(Unknown Source) at sun.net.NetworkClient.doConnect(Unknown Source) at sun.net.www.http.HttpClient.openServer(Unknown Source) at sun.net.www.http.HttpClient.openServer(Unknown Source) at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source) at sun.net.www.http.HttpClient.parseHTTP(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at java.net.URL.openStream(Unknown Source) at Connection.getIp(Connection.java:86) at Connection.setIP(Connection.java:31) at Connection.connect(Connection.java:67) I guess it's because the system did not get the reply from the web yet, and cannot continue, but im sure that im wrong.. Why does that happen? How can I 'fix' it? public String getIp() throws IOException { URL whatismyip = new URL("http://icanhazip.com"); BufferedReader in = new BufferedReader(new InputStreamReader(whatismyip.openStream())); return in.readLine(); } Well this is kind of a VPN management system, so I can reconnect and change the ip of the vpn, but I need to check if the ip has changed and thats how I do it and the error OCCURS from this method: public boolean connect() throws IOException, InterruptedException { String ip = this.setIP(); if (ip != null) { if (ip.equals(this.defaultIp)) { System.out.println("equals"); previousIp = ip; HMACommand.connect(); Thread.sleep(500); while (ip.equals(this.defau…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/136571795
tagged with: ip
type: Question
tagged with: network-programming

http://stackoverflow.com/comment/31433971
score: 0
type: Comment
type: QuestionComment
has text: It is widely considered that though RegEx is powerful, parsing HTML requires an HTML parser. See [this answer](http://stackoverflow.com/a/1732454/418556) for an amusing expression of that thought.. OK - what @OliCharlesworth said..
comment on: http://stackoverflow.com/q/20933454

http://stackoverflow.com/a/20880373
downvote count: 0
has comment: http://stackoverflow.com/comment/31334366
has comment: http://stackoverflow.com/comment/31334463
has comment: http://stackoverflow.com/comment/31334831
has comment: http://stackoverflow.com/comment/31334966
answers question: http://stackoverflow.com/q/20879407
type: Answer
score: 7
has body: You are using Maven, so you can use Maven's features to have a look what jars you need. Run the following in the root of your project: mvn dependency:analyze And you'll see the line [WARNING] Unused declared dependencies found: with a list of dependencies that you don't actually need.
upvote count: 7

http://stackoverflow.com/comment/31450181
score: 0
type: QuestionComment
has text: I use Pastebin links because the other two classes were quite long. If that doesn't matter, then in the future I will simply paste the code.
type: Comment
comment on: http://stackoverflow.com/q/20940921

http://stackoverflow.com/a/20907474
has comment: http://stackoverflow.com/comment/31387073
has body: If the only moving things on screen are the characters controlled by keys (using keyBindings) I believe you could successfully repaint the screen only when a character is moved, so the movement method could call repaint at the end. I tried it myself for some simple projects and that worked fine. Just every moving object would call repaint after it moved. In one of the projects (really simple one) I called repaint inside actionPerformed for the keyBinding, it looked like this: class Right extends AbstractAction{ @Override public void actionPerformed(ActionEvent e){ if (board.character.x &lt; 465){ //check if not trying to move off the screen. board.character.x += 7; board.repaint(); } } }
score: 0
answers question: http://stackoverflow.com/q/20905171
type: Answer

http://stackoverflow.com/q/20937100
has comment: http://stackoverflow.com/comment/31441187
has comment: http://stackoverflow.com/comment/31441169
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20937208
score: 1
tagged with: java
has body: I need to check when the value of a variable is changed in my activity by a service so that I can then update the UI with the new values. I am currently using an infinite loop to check for this within a new thread, will this be using a lot of resources/is there a more efficient way to do this?
type: Question
has title: Checking for variable change using infinite loop
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/31441189
has answer: http://stackoverflow.com/a/20937208
upvote count: 1

http://stackoverflow.com/comment/31378809
has text: Thanks for the advice, I have moved the pieceScan initialisation to the constructor but I continue to have the same error. Any more suggestions would be welcome.
comment on: http://stackoverflow.com/a/20904023
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31380493
has text: Yes, you are right. I stopped the local server and started it again. But I guess that didn't work properly. Once I restarted my system the server was forced to start again and then showed me the correct output. And there are two servlets in my code so the web.xml need not be modified.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/20902288

http://stackoverflow.com/comment/31409135
has text: There is no question here...
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/20920498

http://stackoverflow.com/a/20862756
has comment: http://stackoverflow.com/comment/31301074
has comment: http://stackoverflow.com/comment/31301207
has comment: http://stackoverflow.com/comment/31300992
has body: Take a longer look at your code... return means, stop processing commands and exit the method immediately, so anything after the return statement will not be executed (with the possible exception of finally blocks) private static DefaultListModel&lt;String&gt; createListModel(ArrayList&lt;String&gt; myListModel) { DefaultListModel&lt;String&gt; l = new DefaultListModel&lt;&gt;(); for (String s : myListModel) { l.add(0, s); } // This causes the. Ethos to exit... return l; // So these lines won't be executed... DefaultListModel jList1 = createListModel(myListModel); jList1.setModel(myListModel); } Having said that, if you loved the return statement to the end of the method, it will setup a infinite recursive method call which will result in a StackOverflowExcception, because you are calling createListModel again... A better soliton would be to remove the last lines from the method and simply apply the model from the same call context... jList1.setModel(createListModel(myListModel)); For example...
answers question: http://stackoverflow.com/q/20862722
downvote count: 0
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/31301600

http://stackoverflow.com/comment/31279877
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/20851921
has text: @user3145523 why did you undo my edit? I corrected the display so that your question is legible...

http://stackoverflow.com/a/20916888
answers question: http://stackoverflow.com/q/20916153
has comment: http://stackoverflow.com/comment/31467310
upvote count: 7
has comment: http://stackoverflow.com/comment/43065790
score: 7
downvote count: 0
has comment: http://stackoverflow.com/comment/31450595
has comment: http://stackoverflow.com/comment/31450246
has comment: http://stackoverflow.com/comment/31750512
has body: Do not use char to hold a byte value in Java. I realize that is standard practice in C, but in Java bytes belong in byte arrays only. Every time you convert bytes to a String or convert a String to bytes, you are using the encoder or decoder of a Charset. In many Charsets (including UTF-8, which is what your system apparently uses), not every byte value can be converted to a character; such bytes will be discarded or replaced with some default number. And in many Charsets, some characters do not correspond to a single byte, but rather to multiple bytes, which is where your ef bf bf is coming from. That is why your use of new String(byte[]) and String.getByes() is corrupting your data. Do not use char arrays. Do not convert bytes to or from Strings. Use only byte arrays to hold bytes. If you want to convert a byte array to an array of 16-bit values, use ByteBuffer to convert it to a short array: short[] sixteenBitValues = new short[byteArray.length / 2]; ByteBuffer.wrap(byteArray).asShortBuffer().get(sixteenBitValues); In general, if you want to append bytes to a byte array, you should use a ByteBuffer: ByteBuffer buffer = ByteBuffer.allocate(oldByteArray.length + 2); buffer.put(oldByteArray); buffer.asShortBuffer().put(crcresult); byte[] newByteArray = buffer.array(); If your CRC16 method will only operate on a char array, you need to avoid using String, or any other method that will invoke a Charset encoding, and force the bytes to char values yourself: char[] charBuffer2 = new char[byteBuffer.length]; for (int i = 0; i &lt; byteBuffer.length; i++) { charBuffer2[i] = (char) (byteBuffer[i] &amp; 0xff); } It sounds like your CRC16 method is making the C-based assumption that char holds a single byte, so if you have any control over that class, you should change it to accept a byte[] argument.
has comment: http://stackoverflow.com/comment/43065974
type: Answer
has comment: http://stackoverflow.com/comment/31752828

http://stackoverflow.com/q/20915678
tagged with: jtable
has comment: http://stackoverflow.com/comment/31401012
type: Question
has comment: http://stackoverflow.com/comment/31401366
tagged with: sql
tagged with: jdbc
score: 1
has title: jtable refresh in setModel
has comment: http://stackoverflow.com/comment/31401501
upvote count: 1
tagged with: swing
has body: I'm following this example code to create my own tableModel class to display data from a db using cachedRowSet, and use rowSetEvent to refresh the table when insert a row and delete a row to the cachedRowSet. https://github.com/abissell/jdbctutorial/blob/master/src/com/oracle/tutorial/jdbc/CoffeesTableModel.java public void rowChanged(RowSetEvent event) { try { tm.rs.moveToCurrentRow(); tm = new MyTableModel(tm.rs); // to get right row nums table.setModel(tm); } catch (SQLException er) { er.printStackTrace(); } } public class MyTableModel extends AbstractTableModel { CachedRowSet rs; ResultSetMetaData meta; int cols, rows; public MyTableModel(CachedRowSet r) { rs = r; try { meta = rs.getMetaData(); cols = meta.getColumnCount(); rs.beforeFirst(); rows = 0; while (rs.next()) { rows++; } rs.beforeFirst(); } catch(SQLException e) { e.printStackTrace(); } } public void insert(String[] info) { try { rs.moveToInsertRow(); for(int i = 0;i &lt; cols;i++) { rs.updateString(i+1, info[i]); } rs.insertRow(); rs.moveToCurrentRow(); } catch(SQLException e) { e.printStackTrace(); } } public void delete(int id) { try { rs.beforeFirst(); while(rs.next()) { if(Integer.parseInt(rs.getString(1))==id) { rs.deleteRow(); break; } } } catch (SQLException ex) { ex.printStackTrace(); } } @Override public int getRowCount() { return rows; } @Override public int getColumnCount() { return cols; } @Override public String getColumnName(int col) { try { return meta.getColumnLabel(col + 1); } catch (SQLException e) { return e.toString(); } } @Override public Class&lt;?&gt; getColumnClass(int columnIndex) { return String.class; } @Override public boolean isCellEditable(int rowIndex, int columnIndex) { return false; } @Override public Object getValueAt(int rowIndex, int columnIndex) { try { if (!rs.absolute(rowIndex + 1)) { return null; } rs.absolute(rowIndex + 1); Object o = rs.getObject(columnIndex + 1); if (o == null) { return null; } else { return o.toString(); } } catch (SQLException e) { e.printS…
tagged with: java
linked to: http://stackoverflow.com/q/8257148
has comment: http://stackoverflow.com/comment/31400880
has comment: http://stackoverflow.com/comment/31400722
answer count: 0
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31411755
has comment: http://stackoverflow.com/comment/31417934
favorite count: 0
has comment: http://stackoverflow.com/comment/31404054

http://stackoverflow.com/a/21022670
accepted answer of: http://stackoverflow.com/q/21011676
score: 2
has body: Objects which aren't moving sleep Your initial thought was correct, when an object comes to rest it is put to sleep, this is for a number of reasons; avoiding jitter is one, but it also increases efficiency significantly. While sleeping an object doesn't experience gravity, so if you remove the object supporting it it doesn't notice. Usually you don't have to worry about this; if the object experiences an effect "internal to the physics engine" such as being involved with a collision it is automatically woken. However if you make external changes (such as removing an object) you have to worry about waking the object up. Wake the objects that could have been affected by the external change You can wake a sleeping object up by calling .activate() on the rigidBodyControl, remember sleep is done on a per object basis so you may need to wake more than 1. At present the program does not keep a track of all the RigidBodyControl so I have added a HashSet<RigidBodyControl>() to hold them, when a brick is added to the scene it's rigidBodyControl should be added to this HashSet and when it is removed from the scene it should be removed from the hashset. For an efficient solution you should only wake objects that could have been affected by the removal, but in this case it's probably everything anyway and I have simply woken everything by running through all of the HashSet<RigidBodyControl>() and calling activate() on them. A complete program that demonstrates these changes is shown below public class HelloPhysics extends SimpleApplication { public static void main(String args[]) { HelloPhysics app = new HelloPhysics(); app.start(); } /** Prepare the Physics Application State (jBullet) */ private BulletAppState bulletAppState; /** Prepare Materials */ Material wall_mat; Material stone_mat; Material floor_mat; /** Prepare geometries and physical nodes for bricks and cannon balls. */ Node removables; private static final Box box; private RigidBodyControl ball_phy; private static …
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/31756161
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21011676
type: Answer
has comment: http://stackoverflow.com/comment/31756857

http://stackoverflow.com/a/20858112
answers question: http://stackoverflow.com/q/20857308
has body: As far as I know it's still impossible, at least with default Java driver. There is a feature request demanding the same thing, but it's still not implemented. It seems, though, that server itself already supports query timeouts, so we can expect the driver to support them too sooner or later. Meanwhile you have one more solution to try here. TImeout can be completely disabled with the following option: cursor.addOption(com.mongodb.Bytes.QUERYOPTION_NOTIMEOUT)
has comment: http://stackoverflow.com/comment/31292269
upvote count: 2
has comment: http://stackoverflow.com/comment/47398344
has comment: http://stackoverflow.com/comment/31429527
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20857308
type: Answer

http://stackoverflow.com/q/20954416
has title: AdView blocks UI Thread
tagged with: android
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: multithreading
has body: my problem is simple. The banners I have created block my UI thread choreographer says the app does much work on UI thread, I tried to move the code that loads the ad in an AsyncTask but I get a NPE. Thanks. @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); BugSenseHandler.initAndStartSession(this, "94a8d6d1"); setContentView(R.layout.activity_main); /*adView=new AdView(this, AdSize.BANNER, MYD_AD_UNIT_ID); RelativeLayout layout = (RelativeLayout)findViewById(R.id.mainActivityLayout); RelativeLayout.LayoutParams layoutParams=new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT); layoutParams.addRule(RelativeLayout.ALIGN_BOTTOM, RelativeLayout.TRUE); adView.setGravity(Gravity.BOTTOM); layout.addView(adView,layoutParams); req=new AdRequest(); req.addTestDevice("D68A8F7804BE1E58A861CEABCED3EBAE");*/ new LoadAd().execute(""); and the Asynctask class LoadAd extends AsyncTask&lt;String,Integer,Long&gt;{ @Override protected Long doInBackground(String... params) { adView=new AdView(MainActivity.this, AdSize.BANNER, MYD_AD_UNIT_ID); RelativeLayout layout = (RelativeLayout)findViewById(R.id.mainActivityLayout); RelativeLayout.LayoutParams layoutParams=new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT); layoutParams.addRule(RelativeLayout.ALIGN_BOTTOM, RelativeLayout.TRUE); adView.setGravity(Gravity.BOTTOM); layout.addView(adView,layoutParams); req=new AdRequest(); req.addTestDevice("D68A8F7804BE1E58A861CEABCED3EBAE"); adView.loadAd(req); return null; } } The NPE I get is this.. 01-06 18:16:48.725: D/MainActivity(26484): Resumed 01-06 18:16:48.995: V/WebViewChromium(26484): Binding Chromium to the background looper null 01-06 18:16:49.155: W/dalvikvm(26484): threadid=13: thread exiting with uncaught exception (group=0x417e0c68) 01-06 18:16:52.699: E/AndroidRuntime(26484): FATAL EXCEPTION: AsyncTask #1 01-06 18:16:52.699: E/AndroidRuntime(26484): Process: social.geek, …
score: 1
has comment: http://stackoverflow.com/comment/31473516
tagged with: java
upvote count: 1
type: Question
tagged with: admob
has comment: http://stackoverflow.com/comment/31473914
has answer: http://stackoverflow.com/a/20954487
downvote count: 0

http://stackoverflow.com/comment/32054200
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20987053
has text: That's because in your example you're overriding `paint`, which I did suggest not doing. `JApplet` does not have a `paintComponent` method. Instead, you should create a custom component extending from `JPanel` and place all your custom painting in it and then add it to the applet
score: 0

http://stackoverflow.com/comment/31278855
score: 0
type: Comment
has text: I think I can poke my way through now that you got selection back for me, and I'll take a look at that post too. one last question though. Since I've got drawable folders for all the dpi buckets would i need to put that xml in each one or could i make another folder, say @myfolder/clickable?
type: AnswerComment
comment on: http://stackoverflow.com/a/20850928

http://stackoverflow.com/comment/31532937
comment on: http://stackoverflow.com/a/20985460
score: 0
type: Comment
has text: 'No suitable driver' found means that the jar is not on your classpath. Start with a really basic class with a main method and try to load the driver there first and when working, you can move to a webapp. If you don't know how to set the classpath to include the jar, then checkout the Java tutorials.
type: AnswerComment

http://stackoverflow.com/q/20859243
has title: Java get number or currency format from string
has answer: http://stackoverflow.com/a/20859642
type: Question
type: AnsweredQuestion
tagged with: numbers
has body: I have code which contains XML which is parsed and treats all values as strings. Some of these strings are metric values with currency or % or number formatting. How can I obtain this formatting from the string and then reapply it later. The formatting is removed when numbers are cast to doubles. $4500.30 45.0% //parse out String metric1 = "$4500.30"; String metric2 = "45.0%"; //remove special char metric1 = metric1.replaceAll("[^A-Za-z0-9.]", ""); //I need to reapply formatting after it is removed(such as $)
tagged with: java
accepted answer: http://stackoverflow.com/a/20859582
answer count: 2
has comment: http://stackoverflow.com/comment/31293496
tagged with: number-formatting
has answer: http://stackoverflow.com/a/20859582
possible better answer: http://stackoverflow.com/a/20859642
score: 0

http://stackoverflow.com/a/20963808
answers question: http://stackoverflow.com/q/20955341
accepted answer of: http://stackoverflow.com/q/20955341
type: Answer
upvote count: 4
score: 4
has comment: http://stackoverflow.com/comment/31499082
has body: Assuming you're using Maven (you've tagged this question as such), I simply add the following to my pom.xml file: ... &lt;properties&gt; &lt;!-- Hudson properties: see http://wiki.hudson-ci.org/display/HUDSON/Building+a+software+project#Buildingasoftwareproject-HudsonSetEnvironmentVariables --&gt; &lt;jenkins.buildId&gt;${env.BUILD_ID}&lt;/jenkins.buildId&gt; &lt;jenkins.buildNumber&gt;${env.BUILD_NUMBER}&lt;/jenkins.buildNumber&gt; &lt;jenkins.buildTag&gt;${env.BUILD_TAG}&lt;/jenkins.buildTag&gt; &lt;jenkins.cvsBranch&gt;${env.CVS_BRANCH}&lt;/jenkins.cvsBranch&gt; &lt;jenkins.executorNumber&gt;${env.EXECUTOR_NUMBER}&lt;/jenkins.executorNumber&gt; &lt;jenkins.hudsonUrl&gt;${env.HUDSON_URL}&lt;/jenkins.hudsonUrl&gt; &lt;jenkins.javaHome&gt;${env.JAVA_HOME}&lt;/jenkins.javaHome&gt; &lt;jenkins.jobName&gt;${env.JOB_NAME}&lt;/jenkins.jobName&gt; &lt;jenkins.svnRevision&gt;${env.SVN_REVISION}&lt;/jenkins.svnRevision&gt; &lt;jenkins.workspace&gt;${env.WORKSPACE}&lt;/jenkins.workspace&gt; &lt;/properties&gt; ... ...and then from your code you can simply do a: String url = System.getProperty("jenkins.hudsonUrl"); // could be null Putting these into properties makes life more simple for my purposes, especially when using Maven profiles to control my builds. For example, I make sure to create a "jenkins" profile that is activated when I build on a Jenkins build server. When this is done, all the aforementioned jenkins properties are set. When not run as a jenkins profile, those properties are set to some other default value. Anyway, that's another topic, but food for thought. Hopefully it make sense.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/21011322
has comment: http://stackoverflow.com/comment/31580325
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: If I'm following what you're asking, and understanding your code correctly (I've never used that CsvMapper), change the final loop to while (iter.hasNext()) { Map&lt;String, Object&gt; row = iter.next(); System.out.Println("Entry #= " + row.get("Entry #"); } If you want to access the columns numerically rather than by name (why?), set up a mapping from number to column name and use that to retrieve the key you pass to the get() operation.
accepted answer of: http://stackoverflow.com/q/21007485
has comment: http://stackoverflow.com/comment/31580299
has comment: http://stackoverflow.com/comment/31613858
upvote count: 1
answers question: http://stackoverflow.com/q/21007485
score: 1

http://stackoverflow.com/q/20867349
type: Question
tagged with: spring-mvc
tagged with: java
has comment: http://stackoverflow.com/comment/31309167
has comment: http://stackoverflow.com/comment/31309718
linked to: http://stackoverflow.com/q/11155392
upvote count: 1
has body: I am developing a site in JSP, but I have some errors in my code. Please help me with the following error: org.apache.jasper.JasperException: An exception occurred processing JSP page/WEBINF/jsp/Invoice.jsp at line 165 162: &lt;table&gt; 163: &lt;tr&gt; 164: &lt;td&gt;Invoice No :&lt;/td&gt; 165: &lt;td&gt;&lt;form:input path="invoiceno" /&gt;&lt;/td&gt; 166: &lt;td&gt;Sr No:&lt;/td&gt; 167: &lt;td&gt;&lt;form:input path="srno" /&gt;&lt;/td&gt; 168: &lt;/tr&gt; root cause java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'MetalBean' available as request attribute org.springframework.web.servlet.support.BindStatus.&lt;init&gt;(BindStatus.java:141) org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:179) org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:199) org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:165) org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.autogenerateId(AbstractDataBoundFormElementTag.java:152) org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.resolveId(AbstractDataBoundFormElementTag.java:143) org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.writeDefaultAttributes(AbstractDataBoundFormElementTag.java:127) org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:421) org.springframework.web.servlet.tags.form.InputTag.writeTagContent(InputTag.java:142) org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:103) org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:80) org.apache.jsp.WEB_002dINF.jsp.Invoice_jsp._jspx_meth_form_005finput_005f17(Invoice_jsp.java:1005) org.apac…
answer count: 1
tagged with: jsp
favorite count: 0
has title: org.apache.jasper.JasperException Error in code
has answer: http://stackoverflow.com/a/20873919
accepted answer: http://stackoverflow.com/a/20873919
tagged with: spring
type: AnsweredQuestion
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31309650

http://stackoverflow.com/a/20952396
type: Answer
has body: You could use something like this $.ajax( { type: "POST", url: "/TestServlet", data: { tv_zip: '90210' }, // zipcode dataType: "json", success: function(response) { // replace the contents of div with id=some_div with the response. // You will want to format / tweak this. $('#some_div').html(response); }, error: function(xhr, ajaxOptions, thrownError) { alert(xhr.responseText); } } );
answers question: http://stackoverflow.com/q/20951889
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20951889

http://stackoverflow.com/q/20953307
has comment: http://stackoverflow.com/comment/31474685
has comment: http://stackoverflow.com/comment/31472182
has comment: http://stackoverflow.com/comment/31471542
has comment: http://stackoverflow.com/comment/31471783
score: 0
has comment: http://stackoverflow.com/comment/31472190
has comment: http://stackoverflow.com/comment/31472618
tagged with: android
tagged with: user-interface
has comment: http://stackoverflow.com/comment/31473946
tagged with: listener
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31472023
has comment: http://stackoverflow.com/comment/31471528
has answer: http://stackoverflow.com/a/20954865
tagged with: java
has body: Hello I have a project in which one Activity and several layout. In the layouts contain various elements, such as buttons. I can not add buttons to these listeners from the main Activity. The method onClick() is used in the Activity (Activity implements View.OnClickListener) public class MainActivity extends Activity implements View.OnTouchListener { //.... @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); FrameLayout mainLayout = (FrameLayout) findViewById(R.id.container); mainLayout.setOnTouchListener(this); LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View one = (View) LayoutInflater.from(this).inflate(R.layout.one, null); flipper = (ViewFlipper) findViewById(R.id.viewFlip); int layouts[] = new int[]{R.layout.one, R.layout.two, R.layout.three}; for (int layout : layouts) { flipper.addView(inflater.inflate(layout, null)); } conBut = (Button) one.findViewById(R.id.conBut2); conBut.setOnClickListener(new listen()); } private class listen implements View.OnClickListener { @Override public void onClick(View view) { // .... } } //.... } The result is a button, without action. Please, help me. UPD1: public boolean onTouch(View view, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: fromPosition = event.getX(); break; case MotionEvent.ACTION_MOVE: float toPosition = event.getX(); if ((fromPosition - MOVE_LENGTH) &gt; toPosition) { fromPosition = toPosition; flipper.setInAnimation(AnimationUtils.loadAnimation(this, R.anim.go_next_in)); flipper.setOutAnimation(AnimationUtils.loadAnimation(this, R.anim.go_next_out)); flipper.showNext(); } else if ((fromPosition + MOVE_LENGTH) &lt; toPosition) { fromPosition = toPosition; flipper.setInAnimation(AnimationUtils.loadAnimation(this, R.anim.go_prev_in)); flipper.setOutAnimation(AnimationUtils.loadAnimation(this, R.anim.go_prev_out)); flipper.showPrevious(); } defau…
has title: Listener for the button of external Layout
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/31471729
tagged with: button

http://stackoverflow.com/comment/31409683
has text: but that is not a copy between *kernel space memory and user space memory*, so that's irrelevant. That is a copy between disk and memory.
type: AnswerComment
comment on: http://stackoverflow.com/a/20897452
score: 2
type: Comment

http://stackoverflow.com/comment/31508781
score: 0
type: AnswerComment
type: Comment
has text: Thanks for your answer, @Octopus. So you say that the format that i received back is ok?
comment on: http://stackoverflow.com/a/20969559

http://stackoverflow.com/comment/31559473
comment on: http://stackoverflow.com/a/21000513
type: AnswerComment
has text: Okay, wait a second...
score: 0
type: Comment

http://stackoverflow.com/a/20966570
score: 2
downvote count: 0
has body: This is only for one dimension but I hope you get the idea, by checking the directional keys and adding/subtracting 1 and then casting it to an int (or flooring) will give you the next tile. If you release the key you still have an unreached target and the entity will keep moving until it reaches the target tile. I think it would look something like this: void update()( // Getting the target tile if ( rightArrowPressed ) { targetX = (int)(currentX + 1); // Casting to an int to keep // the target to next tile }else if ( leftArrowPressed ){ targetX = (int)(currentX - 1); } // Updating the moving entity if ( currentX &lt; targetX ){ currentX += 0.1f; }else if ( currentX &gt; targetX ){ currentX -= 0.1f; } }
has comment: http://stackoverflow.com/comment/31498381
upvote count: 2
answers question: http://stackoverflow.com/q/20961596
type: Answer
has comment: http://stackoverflow.com/comment/31508523

http://stackoverflow.com/comment/31345459
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20886463
type: QuestionComment
has text: ``#!/bin/sh # Copyright 2002, 2003 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # Split off Server Number ServerNumber=\`echo $1 |grep ":"\` if [ "$ServerNumber" ] then shift fi exec /usr/openwin/bin/Xsun $ServerNumber +nkeyboard +nmouse -dev vfb $* ``

http://stackoverflow.com/q/20915010
has comment: http://stackoverflow.com/comment/31399439
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31399797
tagged with: java
tagged with: swing
has answer: http://stackoverflow.com/a/20915027
type: Question
has comment: http://stackoverflow.com/comment/31399464
has body: Sorry if this is a really stupid question but I can't figure out how to set the size of a JButton. I'm trying to create a custom JButton class which can be called from anywhere with custom text to make things easier. I am also trying to set a background image which doesn't appear to be working either. I have tried using this.setSize(1000, 1000) (surely this should work) but this does nothing at all. Here is my code: package menu; import javax.swing.*; @SuppressWarnings("serial") public class Button extends JButton { public Button(String name) { ImageIcon background = new ImageIcon("/assets/buttons/menu.png"); //Is this how you set a background image for a button? this.setText(name); this.setIcon(background); this.setLayout(null); //This hasn't made a difference this.setSize(300, 80); //This does nothing } }
score: 0
accepted answer: http://stackoverflow.com/a/20915027
has title: How to set size and image of JButton?
answer count: 1
has comment: http://stackoverflow.com/comment/31399416
has comment: http://stackoverflow.com/comment/31399746
tagged with: size

http://stackoverflow.com/comment/31556288
type: Comment
comment on: http://stackoverflow.com/a/20995258
score: 0
type: AnswerComment
has text: Tried that but couldn't find one native to ColdFusion 6, any idea for an easy implementation?

http://stackoverflow.com/a/20994366
has comment: http://stackoverflow.com/comment/31547970
has comment: http://stackoverflow.com/comment/31548353
answers question: http://stackoverflow.com/q/20994151
has comment: http://stackoverflow.com/comment/31547926
has comment: http://stackoverflow.com/comment/31548104
has body: Override onTouchEvent. Use instance variables float x,y @Override public boolean onTouchEvent(MotionEvent event) { x = event.getX(); y = event.getY(); invalidate(); // to refresh draw return true; } Use x and y to draw the image. public boolean onTouchEvent (MotionEvent event) Added in API level 1 Implement this method to handle touch screen motion events. If this method is used to detect click actions, it is recommended that the actions be performed by implementing and calling performClick(). This will ensure consistent system behavior, including: obeying click sound preferences dispatching OnClickListener calls handling ACTION_CLICK when accessibility features are enabled Parameters event The motion event. Returns True if the event was handled, false otherwise. You need to know the center and the radius of the circle to detect touch withing the circle. My be this helps you understand Creating a spray effect on touch draw in android
has comment: http://stackoverflow.com/comment/31547846
has comment: http://stackoverflow.com/comment/31548508
has comment: http://stackoverflow.com/comment/31548272
has comment: http://stackoverflow.com/comment/31547814
score: 0
has comment: http://stackoverflow.com/comment/31548795
has comment: http://stackoverflow.com/comment/31547778
type: Answer
has comment: http://stackoverflow.com/comment/31548045

http://stackoverflow.com/q/20900618
has comment: http://stackoverflow.com/comment/31371196
tagged with: eclipse
has comment: http://stackoverflow.com/comment/31371312
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/20900668
downvote count: 8
answer count: 5
has title: Syntax error on eclipse
has answer: http://stackoverflow.com/a/20900656
has answer: http://stackoverflow.com/a/20900650
type: AnsweredQuestion
has body: I am getting red X's in my code for the closing } I have. They all look fine to me the IDE insists that I am wrong. I'm not sure why this is incorrect. Could someone guide me the way please thank you! The errors occur at the last 2 closing } 1 error: Syntax error on token "}", { expected after this token 2 error: Syntax error, insert "}" to complete ClassBody Here is my code public class BinaryTree { // root node pointer. Will be null for an empty tree private Node root; /* -- Node -- The binary tree is built using this nested node class. Each node stores on data element, and has left and right sub-tree pointer which may be null. The node is a "dumb" nested class -- we just use it for storage; */ private static class Node { // Node class Node left; Node right; int data; Node(int newData) { // create Node left = null; right = null; data = newData; } } /* Creates an empty binary tree == null root pointer */ public void BinaryTree() { root = null; } /* Returns true if the given target is in the binary tree */ public boolean lookup(int data) { // look up a number return(lookup(root, data)); // use this to parse through a tree to search for element } /* recursive lookup -- given a node, recur down searching for the given data. */ private boolean lookup(Node node, int data) { if (node == null) { return(false); } if (data == node.data) { return(true); } else if (data &lt; node.data) { return(lookup(node.left, data)); } else { return(lookup(node.right, data)); } } public void insert(int data) { root = insert(root, data); } /* Recursive insert -- given a pointer, recur down and insert the given data into the tree. Returns the new node pointer (the standard way to communicate a changed pointer back to the caller). */ private Node insert(Node node, int data) { if (node == null) { node = new Node(data); } else { if (data &lt;= node.data) { node.left = insert(node.left, data); } else { node.right = insert(node.right, data); } } } // I get an error here #1 return (node); } // I a…
score: -8
possible better answer: http://stackoverflow.com/a/20900645
type: Question
has comment: http://stackoverflow.com/comment/31371329
has answer: http://stackoverflow.com/a/20900645
accepted answer: http://stackoverflow.com/a/20900656
has answer: http://stackoverflow.com/a/20900707
tagged with: java

http://stackoverflow.com/q/20864470
has answer: http://stackoverflow.com/a/21035683
favorite count: 0
score: 32
upvote count: 32
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/64696755
has body: Is it possible to write an Avro schema/IDL that will generate a Java class that either extends a base class or implements an interface? It seems like the generated Java class extends the org.apache.avro.specific.SpecificRecordBase. So, the implements might be the way to go. But, I don't know if this is possible. I have seen examples with suggestions to define an explicit "type" field in each specific schema, with more of an association than inheritance semantics. I use my base class heavily in my factory classes and other parts of the code with generics like &lt;T extends BaseObject&gt;. Currently, I had it code generated from the JSON Schema, which supports inheritance. Another side question: can you use IDL to define just records without the protocol definition? I think the answer is no because the compiler complains about the missing protocol keyword. Help appreciated! Thanks.
has answer: http://stackoverflow.com/a/74977655
type: Question
tagged with: avro
has answer: http://stackoverflow.com/a/20899145
answer count: 6
accepted answer: http://stackoverflow.com/a/21035683
has answer: http://stackoverflow.com/a/53463602
has title: Polymorphism and inheritance in Avro schemas
has answer: http://stackoverflow.com/a/64696755
downvote count: 0
has answer: http://stackoverflow.com/a/58615564

http://stackoverflow.com/comment/31561992
has text: `prepare` is called per every action, `validate` is called per validation, both are doing different job. Seems you stuck with the methods provided. Create your own methods, or your own classes and call those methods or classes when required.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20999003

http://stackoverflow.com/q/20938730
tagged with: java
has comment: http://stackoverflow.com/comment/31444868
type: Question
upvote count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/31444727
accepted answer: http://stackoverflow.com/a/20939431
tagged with: infinite-loop
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/20939431
tagged with: android
favorite count: 0
has body: I am writing a simple application to scan and record WiFi Access Points, there are three options; a single scan, 10 scans, or scan for a period of time. When I enter my nWiFiScans activity it preforms the scans, records the file and STARTS THE ACTIVITY AGAIN!!! WHY WOULD IT DO THIS??? nWiFiScans.java public class nWiFiScans extends Activity { //declarations public static String pntNameStr; public static int numScans; public static int scansMin; LinearLayout layout1; ScrollView scrollLayout; TextView label1; EditText n1Text; EditText n2Text; LayoutParams params_layout1; WifiManager mainWifi = null; WifiReceiver receiverWifi; List&lt;ScanResult&gt; wifiList; StringBuilder sb = new StringBuilder(); Intent intent; SimpleDateFormat time; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); scrollLayout = new ScrollView(this); scrollLayout.setBackgroundColor(Color.BLUE); //Create new layout in "this" activity params_layout1 = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT, 1); layout1 = new LinearLayout(this); layout1.setBackgroundColor(Color.RED); layout1.setLayoutParams(params_layout1); //Create TextView in "this" activity label1 = new TextView(this); label1.setBackgroundColor(Color.YELLOW); //Put some text in the TextView // Get the message from the intent intent = getIntent(); pntNameStr = intent.getStringExtra(MainActivity.EXTRA_pntNameStr); numScans = intent.getIntExtra(MainActivity.EXTRA_numScans, 1); label1.setText(pntNameStr); //Place the TextView inside the Layout layout1.addView(label1); layout1.setOrientation(LinearLayout.VERTICAL); //scrollLayout.addView(label1); //layout1.addView(n1Text); //layout1.addView(n2Text); //By default the layout is set to HOR, so we change it to VERT orientation: // Display layout1 when the activity is created: setContentView(layout1); mainWifi = (WifiManager) getSystemService(Context.WIFI_SERVICE); checkIfWifiIsOn(mainWifi); receiverWifi = new WifiReceiver(); registerReceiv…
has title: What could cause an Android activity to loop infinitely?
has comment: http://stackoverflow.com/comment/31444956
type: AnsweredQuestion

http://stackoverflow.com/comment/31339928
has text: That would work for html but I am using it in a Java GUI not a web page.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20883969
type: Comment

http://stackoverflow.com/comment/31351941
type: QuestionComment
has text: please show us updated version of your code
score: 0
comment on: http://stackoverflow.com/q/20880744
type: Comment

http://stackoverflow.com/comment/31526724
comment on: http://stackoverflow.com/a/20982385
score: 0
type: Comment
has text: Who the heck numbers seats with hexadecimal values?!
type: AnswerComment

http://stackoverflow.com/comment/31555185
score: 0
has text: But where are you wrapping your two lables? I mean to ask that you should put them in separate divs or spans.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20996490

http://stackoverflow.com/comment/31285588
has text: recheck if [CommonsIO] http://commons.apache.org/io/ is available in your class path.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20855212

http://stackoverflow.com/comment/31292555
type: QuestionComment
comment on: http://stackoverflow.com/q/20855346
has text: Still no success to find the cause of this error. The session factory object is created as shown in several examples and the notation seems good to me. If anybody have an idea that can help me to find the error I would be grateful.
score: 0
type: Comment

http://stackoverflow.com/comment/31591163
score: 1
type: Comment
has text: Already did that Piotr. Still no exception is thrown :(
type: QuestionComment
comment on: http://stackoverflow.com/q/21017641

http://stackoverflow.com/q/20924230
tagged with: http://stackoverflow.com/tag/gif
linked to: http://stackoverflow.com/q/11648696
has comment: http://stackoverflow.com/comment/31418255
has comment: http://stackoverflow.com/comment/31418328
has comment: http://stackoverflow.com/comment/31416454
has comment: http://stackoverflow.com/comment/31418373
answer count: 3
linked to: http://stackoverflow.com/q/573055
tagged with: paintcomponent
has comment: http://stackoverflow.com/comment/31416701
favorite count: 0
has answer: http://stackoverflow.com/a/20924586
upvote count: 2
has answer: http://stackoverflow.com/a/20924716
has answer: http://stackoverflow.com/a/20925987
tagged with: swing
downvote count: 1
has comment: http://stackoverflow.com/comment/31416417
linked to: http://stackoverflow.com/q/299495
has title: Java Draw a GIF
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20925987
score: 1
tagged with: java
has body: I'm trying to draw a GIF using the Java Graphics API, but I'm not able to successfully draw a GIF using my below code. Only the first image or thumbnail of the GIF is drawn but it doesn't play. public void paintComponent(Graphics g){ super.paintComponent(g); BufferedImage img = null; try { URL url = new URL("GIF URL"); img = ImageIO.read(url); } catch (Exception e) { } g.drawImage(img, 5, 5, this); } Essentially I am creating graphics for a login screen and I want to draw a GIF that loops. EDIT: Updated my code and changed the question a bit.
tagged with: jpanel
has comment: http://stackoverflow.com/comment/31418213
type: Question
accepted answer: http://stackoverflow.com/a/20924716

http://stackoverflow.com/comment/31324497
type: QuestionComment
score: 1
has text: You should probably keep "compile" and "run" as two separate operations.
type: Comment
comment on: http://stackoverflow.com/q/20875110

http://stackoverflow.com/q/20899117
has answer: http://stackoverflow.com/a/20899232
tagged with: linux
has answer: http://stackoverflow.com/a/20899222
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/20905148
answer count: 4
favorite count: 0
accepted answer: http://stackoverflow.com/a/20899232
tagged with: cpu-usage
tagged with: multithreading
has title: linux top command CPU usage doesn't add up / how to view Java threads usage in realtime?
upvote count: 1
has body: When I run top -p &lt;pid&gt; command, I can see that process is using about 10% of cpu but when I press "H" to list threads, cpu usage of each of the thread is shown as 0%. Why is that so? I want to see Java threads CPU usage in realtime, is top not the best way? Screenshots (before pressing H) After pressing H-
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20899149
tagged with: java
has answer: http://stackoverflow.com/a/20899149
type: Question

http://stackoverflow.com/q/20889249
has comment: http://stackoverflow.com/comment/31350295
favorite count: 0
has answer: http://stackoverflow.com/a/20889461
tagged with: android
has answer: http://stackoverflow.com/a/20889491
type: AnsweredQuestion
score: 3
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31350032
has body: I have an Android project (running in emulator) in which clicking the 'Novels' button on the main menu should lead to the values of pieces where the typeField = 0 (ie false) in the 'pieceTable' in the SQL database being displayed in a ListActivity through an ArrayList. However, when the Novels button is clicked, the application is stopped and a dialogue box shown, stating 'Unfortunately, EnglishLitRevision has stopped'. There is no LogCat output. I wouldn't be surprised if this is a very basic error out of ignorance, but I would be grateful if anyone can identify the problem. UPDATE - filter was not set to 'error' on LogCat! LogCat output is shown below: 01-02 18:26:06.344: E/AndroidRuntime(548): FATAL EXCEPTION: main 01-02 18:26:06.344: E/AndroidRuntime(548): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.lawson.englishlitrevision/com.lawson.englishlitrevision.Novel}: java.lang.NullPointerException 01-02 18:26:06.344: E/AndroidRuntime(548): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956) 01-02 18:26:06.344: E/AndroidRuntime(548): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981) 01-02 18:26:06.344: E/AndroidRuntime(548): at android.app.ActivityThread.access$600(ActivityThread.java:123) 01-02 18:26:06.344: E/AndroidRuntime(548): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147) 01-02 18:26:06.344: E/AndroidRuntime(548): at android.os.Handler.dispatchMessage(Handler.java:99) 01-02 18:26:06.344: E/AndroidRuntime(548): at android.os.Looper.loop(Looper.java:137) 01-02 18:26:06.344: E/AndroidRuntime(548): at android.app.ActivityThread.main(ActivityThread.java:4424) 01-02 18:26:06.344: E/AndroidRuntime(548): at java.lang.reflect.Method.invokeNative(Native Method) 01-02 18:26:06.344: E/AndroidRuntime(548): at java.lang.reflect.Method.invoke(Method.java:511) 01-02 18:26:06.344: E/AndroidRuntime(548): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.…
has comment: http://stackoverflow.com/comment/31350145
accepted answer: http://stackoverflow.com/a/20889461
upvote count: 3
possible better answer: http://stackoverflow.com/a/20889491
has title: Android Application 'Stopping' without LogCat Error
tagged with: sql
downvote count: 0

http://stackoverflow.com/a/20892701
type: Answer
answers question: http://stackoverflow.com/q/20891073
upvote count: 3
score: 3
downvote count: 0
has body: So SOAP is a xml message that you send across the network. There are various way that you can send this SOAP message across the network. This mechanism is called the transport protocol. Traditionally you would use HTTP as the transport protocol however there is nothing stopping you from sending a SOAP message over JMS(Java Message Queue) , SMTP (Simple Mail Transfer Protocol) or even a plain socket. Essentially when you define the protocol in the WSDL it is saying I will send this message using the protocol defined in the WSDL. In your example the WSDL clearly states it will use the HTTP protocol this section here contains the information: transport="http://schemas.xmlsoap.org/soap/http" This Wikipedia Entry on SOAP has a transport section that carries more detail. The binding deals with how the XML is transported over the network and which style it will be using. There are various styles of sending SOAP messages such as document, literal and RPC. This is all got to do with how not where. The service and port elements in the WSDL deals with where I can find the service etc. So that is why you dont specify the web service address in the binding section but in the port and service section. It would be good to read up about the different styles as well. See this article to get a insight into RPC,Literal and Document terminology.

http://stackoverflow.com/q/20936700
type: Question
has comment: http://stackoverflow.com/comment/31440383
has answer: http://stackoverflow.com/a/20936807
possible better answer: http://stackoverflow.com/a/20936777
accepted answer: http://stackoverflow.com/a/20936798
downvote count: 0
favorite count: 0
has body: I'm playing with string manipulation and I would like to do something like this, when a user types the lesson name: Windows Server, the program should remove Windows plus white space character and display only Server. I managed to do this using this code: Scanner in = new Scanner(System.in); String lesson; System.out.println("Input lesson name: "); lesson = in.nextLine(); String newLesson = lesson.replaceAll("Windows\\s+", ""); System.out.println("New Lesson is " + newLesson); But now I want to remove multiple characters like Linux and Unix. How would I include in my regex Linux and Unix? If the user would type in Linux Administration, the program should display Administration only.
has answer: http://stackoverflow.com/a/20936798
has title: Java remove multiple characters from string
has comment: http://stackoverflow.com/comment/31440336
has comment: http://stackoverflow.com/comment/31440353
has comment: http://stackoverflow.com/comment/31440334
answer count: 4
has answer: http://stackoverflow.com/a/20936777
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/20936823
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/31504247
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20867854
has text: Hi Jerry, oh yeah I just notice that the demo u did oso had that error. LOL. I just noticed it too..
score: 0

http://stackoverflow.com/q/20961593
score: 0
has title: Variable performing like a pointer
has comment: http://stackoverflow.com/comment/31488340
answer count: 1
has comment: http://stackoverflow.com/comment/31488124
tagged with: android
has comment: http://stackoverflow.com/comment/31488224
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/137975
type: Question
has body: In Java, I have two classes that each take values from a Singleton class but it seems to be changing values in the Singleton and I would just like a local copy. This is a shortened version of whats happening in my classes. method.getName() should return "Abbey", as thats how it was created earlier public class MethodFragment1 extends Fragment { private Method method = MethodLab.get(getActivity()).getMethod(); method.setName("Test"); } public class MethodFragment2 extends Fragment { private Method method = MethodLab.get(getActivity()).getMethod(); System.out.println(method.getName()); } The output is "Test" Do both classes not get a local copy of the Method from the Singleton class MethodLab and if not how do I get a local copy?
has answer: http://stackoverflow.com/a/20961695
accepted answer: http://stackoverflow.com/a/20961695
has comment: http://stackoverflow.com/comment/31488187

http://stackoverflow.com/q/20928056
type: UnansweredQuestion
has body: import static java.lang.System.out; import java.util.Scanner; public class alphabets { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); out.print("Which verse?"); int verse = keyboard.nextInt(); switch (verse) { case 1: out.println("AAAA"); break; case 2: out.println("BBBBBB"); break; case 3: out.println("CCCCC"); break; case 4: out.println("DDDD"); break; default: out.println("No such verse"); break; } out.println("The Alphabet."); } } Every time I "save as" the import java.util.Scanner; is deleted. And obviously after this the program will not run because the deleted import is missing. I have tried Preferences> Editor> Save Actions> Configure> Remove Unnecessary Casts. This doesn't work (though I am not sure this is what I should do). Any guidance would be wonderful. Thanks.
score: 3
has comment: http://stackoverflow.com/comment/31424029
tagged with: java
tagged with: eclipse
type: Question
downvote count: 0
answer count: 1
favorite count: 0
has title: Import declarations deleted after I "save as" using Eclipse
has answer: http://stackoverflow.com/a/20928073
has comment: http://stackoverflow.com/comment/31424006
upvote count: 3

http://stackoverflow.com/comment/32029254
type: AnswerComment
type: Comment
has text: Hi, I tried this code and other as well but I can't make it work. I'm really desperate here. can you please reprogram it? I know that I'm asking a lot.. :(
comment on: http://stackoverflow.com/a/20947115
score: 0

http://stackoverflow.com/q/20999559
has answer: http://stackoverflow.com/a/20999600
tagged with: super
tagged with: java
linked to: http://stackoverflow.com/q/49002
has answer: http://stackoverflow.com/a/20999716
accepted answer: http://stackoverflow.com/a/20999646
has answer: http://stackoverflow.com/a/20999641
has comment: http://stackoverflow.com/comment/31558580
type: Question
has title: Java - how to call different super() according to inheriting class's constructor argument?
score: 5
has answer: http://stackoverflow.com/a/20999633
upvote count: 5
has answer: http://stackoverflow.com/a/20999635
has comment: http://stackoverflow.com/comment/31557358
tagged with: inheritance
downvote count: 0
answer count: 7
has body: I am trying to make the inheriting class ask for less arguments, and calculate the 'correct' mising arguments for the super class. Looking for help on how to do this, without using factory methods. This is an example code to simplify things. Son(int) will call super(int,boolean) based on the value of int. class Base { ... public Base (int num, boolean boo2) { ...} ... } class Son extends Base { ... public Son (int num) { if (num &gt; 17) super(num, true); else super(num , false); } ... } I also considered making Base an interface, but that doesn't allow me to enforce some argument correctness checks. Appreciate your help.
has comment: http://stackoverflow.com/comment/31557469
favorite count: 0
has comment: http://stackoverflow.com/comment/31557425
has comment: http://stackoverflow.com/comment/31558556
has answer: http://stackoverflow.com/a/20999604
possible better answer: http://stackoverflow.com/a/20999600
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20999646

http://stackoverflow.com/comment/31500888
comment on: http://stackoverflow.com/q/20968700
score: 0
has text: Another similar question has been [asked before](http://stackoverflow.com/questions/17949757/regular-expression-for-dutch-phone-number). Try the solutions there and see if it satisfies your needs. On another note, you don't need to escape `+` in a character class since it will lose it's meaning, put `-` at the end of the character class and it won't form a range which means it also loses it's meaning. Congratulation, you just saved 4 bytes and a pain to the eyes `[0-9+-]{8,14}`
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31326519
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20876253
has text: try to put library in your libs folder.
score: 0

http://stackoverflow.com/a/21017757
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21017235
has body: Some solutions I can think of: Put the buttons in a different panel (easy, recommended). Set the buttons invisible with setVisible(false) during the print and visible again after (keeping in mind setVisible does more than meets the eye). Tinker with the print mechanism manually with overrides for print/printAll/printChildren (not recommended).
upvote count: 2

http://stackoverflow.com/comment/31312111
type: QuestionComment
comment on: http://stackoverflow.com/q/20864268
score: 0
has text: @RichardTingle for me two way references can be a bad thing, if Chapter refs Book, then Book refs its chapters it means wanting a single chapter could create refs to the other 1000 sibling chapters indirectly, meaning they have to be loaded, take up memory etc. Correct me if I am wrong.
type: Comment

http://stackoverflow.com/comment/31353175
type: QuestionComment
has text: Try casting peopleI to double when you calculate the pricePP
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20890768

http://stackoverflow.com/comment/31503266
score: 0
type: QuestionComment
has text: MMM no, i've never done it 'manually' before. I had no problems so far, so i guess that eclipse did it. Everything works fine until this morning. Anyway now ill look into in on the internet to know how to set them.
type: Comment
comment on: http://stackoverflow.com/q/20969993

http://stackoverflow.com/q/20952594
has answer: http://stackoverflow.com/a/23548886
has body: I need help figuring out how to correctly click on a link using javaFx WebEngine.executeScript. I tried the code: webEngine.executeScript("document.querySelectorAll(\"a[ajaxify^='/ajax/messaging/composer.php?']\")[0].click();"); However every time i run my application the following error is generated when executing the above code. The error is as follows: netscape.javascript.JSException: TypeError: 'undefined' is not a function at com.sun.webpane.platform.WebPage.twkExecuteScript(Native Method) at com.sun.webpane.platform.WebPage.executeScript(WebPage.java:1438) at javafx.scene.web.WebEngine.executeScript(WebEngine.java:811) at javafxapplication2.MainController$4.run(MainController.java:201) at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:173) at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29) at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:73) at java.lang.Thread.run(Thread.java:722) I also verified that the object exists but for some reason calling the click() function on it is not working. Thanks in advance for any help.
tagged with: java
has title: Clicking on a link in JavaFX using WebEngine.executeScript function not working
type: Question
has answer: http://stackoverflow.com/a/23550957
score: 0
answer count: 2
type: UnansweredQuestion
tagged with: javafx-2
has comment: http://stackoverflow.com/comment/31879723
has comment: http://stackoverflow.com/comment/31552992

http://stackoverflow.com/q/20870299
favorite count: 0
tagged with: illegalmonitorstateexcep
type: UnansweredQuestion
has body: Though I have written wait inside synchronized block. I am getting IllegalMonitorStateException. What's the reason then? package trials; public class WaitNotifyTrial { public static void main(String[] args){ Generator g=new Generator(); g.start(); System.out.println("Start"); synchronized (g) { try { g.wait(); } catch (InterruptedException e) { // TODO Auto-generated catch block System.out.println("Printing exception"); e.printStackTrace(); } System.out.println(g.value); } } } class Generator extends Thread{ int value; public void run(){ synchronized (this) { value=10; } notify(); } } }
has comment: http://stackoverflow.com/comment/31314775
score: 1
tagged with: multithreading
type: Question
has title: IllegalMonitorStateException inside synchronized block
tagged with: java
tagged with: runtime-error
upvote count: 1
has comment: http://stackoverflow.com/comment/31314821
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31387119
has answer: http://stackoverflow.com/a/20870564

http://stackoverflow.com/comment/31678037
type: Comment
has text: @Geek It is in attempt to verbalize my intuition: each OR operand can be any boolean expression---that's one degree of freedom per operand. Opposed to that, each element of a `Set<String>` must be a String and the compiler will complain if it isn't---there are no degrees of freedom there.
comment on: http://stackoverflow.com/a/20952370
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31425558
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20928771
type: AnswerComment
has text: is there anyother way to do it?

http://stackoverflow.com/a/20929962
downvote count: 0
has comment: http://stackoverflow.com/comment/31427638
has comment: http://stackoverflow.com/comment/31583746
has comment: http://stackoverflow.com/comment/34929404
has comment: http://stackoverflow.com/comment/34929527
has comment: http://stackoverflow.com/comment/31579287
type: Answer
has body: It depends what you mean: It is possible to write an application installer for a Java app that will also install an embedded JRE. One caveat is that the Oracle Java binary license does not permit you to embed a partial JRE. It is the whole JRE ... or nothing. Under some circumstances, it is possible to compile Java to native code that can be executed without an Oracle JRE installation. However, there are serious (IMO) drawbacks to both of these approaches. The embedded JRE approach can lead to a proliferation of JRE installations on the user's machine, and issues with timely application of Java security patches. There are serious limitations to what you can do with the compile-to-native-code approach. For instance the GCJ compiler / runtime only supports Java 1.4 with some 1.5 additions ... All in all, it is better to require the user to download the latest JRE from a reputable source and install it in the standard place. Note that this is a simple procedure for all but the most technophobic users provided they have admin rights. (And if they don't, they can't install your software either ...)
score: 3
has comment: http://stackoverflow.com/comment/34930640
has comment: http://stackoverflow.com/comment/31579403
upvote count: 3
has comment: http://stackoverflow.com/comment/31428157
has comment: http://stackoverflow.com/comment/34929938
has comment: http://stackoverflow.com/comment/34929675
has comment: http://stackoverflow.com/comment/31427746
has comment: http://stackoverflow.com/comment/34905138
has comment: http://stackoverflow.com/comment/31427898
has comment: http://stackoverflow.com/comment/31579155
has comment: http://stackoverflow.com/comment/31583577
has comment: http://stackoverflow.com/comment/34905113
has comment: http://stackoverflow.com/comment/34904968
answers question: http://stackoverflow.com/q/20929681
has comment: http://stackoverflow.com/comment/34905073

http://stackoverflow.com/comment/31573169
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/21007174
has text: @DanielNuriyev The addition of move semantics, and proper use of `vector`'s constructors nullifies 3 of the arguments made in that blog post. As always, C++ does not guarantee that your poorly written code will be optimized (I don't know of a single language that does, though).
type: Comment

http://stackoverflow.com/a/20864702
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Here's a recursive solution using Class.isArray: static int getDimensionality(final Class&lt;?&gt; type) { if (type.isArray()) { return 1 + getDimensionality(type.getComponentType()); } return 0; } public static void main (String[] args) { System.out.println(getDimensionality(int.class)); // 0 System.out.println(getDimensionality(int[].class)); // 1 System.out.println(getDimensionality(int[][].class)); // 2 System.out.println(getDimensionality(int[][][].class)); // 3 } Although as PM 77-1 points out, this is not truly a measure of dimensionality but of the depth of a jagged array in terms of its static type. There are no true multidimensional arrays in Java, just arrays of arrays.
answers question: http://stackoverflow.com/q/20864655
has comment: http://stackoverflow.com/comment/31304510
accepted answer of: http://stackoverflow.com/q/20864655
upvote count: 9
score: 9

http://stackoverflow.com/comment/31381340
score: 0
comment on: http://stackoverflow.com/q/20905957
type: Comment
type: QuestionComment
has text: check the answer here: http://stackoverflow.com/questions/18068627/logcat-message-the-google-play-services-resources-were-not-found-check-your-pr

http://stackoverflow.com/q/20910952
has body: I am trying to make a regexp to replace line beginnings for a line begin plus a \t. The goal ir to learn regular expressions and how to use the matcher class. Here is my code till now: StringBuilder ambe = new StringBuilder(); Pattern pattern = Pattern.compile("(^\\s*\\w*)"); Matcher matcher = pattern.matcher(pop.toString()); ambiente.append("Ambe: [\n"); ambiente.append(matcher.replaceAll("\t$1")); ambiente.append("]\n"); return ambiente.toString(); Inside pop there is several \n to break lines. but this code is just replacing the first line. Any advice?
tagged with: regex
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/20911006
accepted answer: http://stackoverflow.com/a/20911006
tagged with: java
type: Question
upvote count: 3
has title: Regex in java to match every "line begin" and replace
has comment: http://stackoverflow.com/comment/31391358
downvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/q/20951847
tagged with: classcastexception
tagged with: android
upvote count: 4
has title: Android java.lang.ClassCastException: android.widget.RelativeLayout cannot be cast to android.widget.EditText
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/20952028
type: Question
tagged with: android-layout
has answer: http://stackoverflow.com/a/20952028
tagged with: java
score: 4
has answer: http://stackoverflow.com/a/20951899
accepted answer: http://stackoverflow.com/a/20951899
has body: I get the following exception in Android when clicking a button to take me from an activity to another (I'm new in Android development, so it may not be the brightest of questions): java.lang.ClassCastException: android.widget.RelativeLayout cannot be cast to android.widget.EditText I have tried cleaning the project several times, I've tried the option Fix Project Properties from Android Tools, I've checked my xml for mistakes but I just can't seem to figure this out. I have to mention that the button worked well for some time until this exception occurred. Here is my xml: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/editCustomerPhone" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/background_dark" 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=".CustomerInfoActivity" > <TextView android:id="@+id/textView2" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Insert Customer Data:" android:textColor="@color/light_blue" android:textSize="20sp" android:textStyle="italic" /> <requestFocus /> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/frameLayout1" android:text="Name:" android:textAppearance="?android:attr/textAppearanceMedium" android:textColor="@android:color/background_light" android:textStyle="bold" android:typeface="serif" /> <TextView android:id="@+id/TextView02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/editCustomerPhone" android:layout_marginTop="14dp" android:text="…
has answer: http://stackoverflow.com/a/43377593
answer count: 3
favorite count: 0

http://stackoverflow.com/comment/31425051
type: Comment
type: QuestionComment
has text: which statements keep executing? the if-statement or the `postfix += " " + ops.pop()` statement? or both?
comment on: http://stackoverflow.com/q/20928176
score: 0

http://stackoverflow.com/q/20894381
has body: How do i align the arrows to be right above/below the numbers? Does each arrow need to have it's own linear layout? Is there a way to set this without setting a static amount of padding? I would like this to be generic enough to be used and show up properly on different devices... I'm relatively new to android development - especially the UI portion of it... so any help would be appreciated! What I See (Above) What I Would Like To See (Above)
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/20894470
tagged with: user-interface
possible better answer: http://stackoverflow.com/a/20894500
has answer: http://stackoverflow.com/a/20894500
tagged with: android
has answer: http://stackoverflow.com/a/20894501
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20894470
type: Question
has title: aligning Image Buttons with TextView XML
tagged with: java

http://stackoverflow.com/comment/53891649
comment on: http://stackoverflow.com/q/21006136
has text: There are 3 places that need to be updated. (1) File -> Settings (Ctrl+alt+s for the shortcut) then "Build, Execution, Deployment">Compiler>Java Compiler and change the "Target bytecode version" to your desired Java version. (2 and 3) The other place is under File>Project Structure (Ctrl+Alt+Shift+S)> "Project Settings">"Project" change Project SDK to point to the appropriate version of Java and set the Project language level to the correct version. The code assist only changes the language level for you unfortunately making this an annoyance for new projects.
type: Comment
type: QuestionComment
score: 40

http://stackoverflow.com/comment/31529413
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20983212
type: QuestionComment
has text: **What have you tried?** You've included an unrelated XSLT and said this works on an unrealted input, but I need it to work for a different input. Examine the XSLT you have, *try and write your own* that confroms to your data needs, and then create a new question about a specific problem.

http://stackoverflow.com/q/20960930
score: 0
downvote count: 1
tagged with: method-call
has body: Here is my little sourcecode. It works but i need help at method call. I dont know "how to" enter the values. I make "new SmallestElement ()" and try to call the method. the message i get: What i have to write in the boxes? Can someone make an example? public class SmallestElement { public int getSmallestElement(int[] array, int start, int ende) { int mitte = (start + ende) / 2; if(start == ende) { return array[start]; } else { return Math.min(getSmallestElement(array, start, mitte), getSmallestElement(array, mitte+1, ende)); } } }
type: AnsweredQuestion
tagged with: java
has title: Need BlueJ help: Method Call array
has answer: http://stackoverflow.com/a/20961257
type: Question
tagged with: bluej
accepted answer: http://stackoverflow.com/a/20961257
upvote count: 1
tagged with: arrays
answer count: 1
favorite count: 0

http://stackoverflow.com/q/20905469
type: UnansweredQuestion
tagged with: arguments
linked to: http://stackoverflow.com/q/3205027
linked to: http://stackoverflow.com/q/2916865
tagged with: java
has body: I am writing a code that accepts a list of files as an input. I am doing stress testing and an error occurs if there are a lot of files as an input. My main function accepts an array of Strings as an input. public static void main(String[] args) I have around 200 files as an input. My args accepts input in this format: -f &lt;file path&gt; At one point on the list of files, Java will throw a File Not Found exception because it gets an incorrect path. There is always only one character missing. And the preceding file entries are read correctly. I tried to get the length of the string when one character got missing, and it is always on 8090th character. Example: If I have a list of files in a nested directory. My input will be something like this. -f test\test1\test1_test2\test1_test2_test3\test3_test4.txt Repeated inputs of this kind would result to: -f test\test1\test1_test2\test1_test2_test3\test3_test4.txt ... -f test\test1\test1_**tst2**\test1_test2_test3\test3_test4.txt ... -f test\test1\test1_test2\test1_test2_test3\test3_test4.txt There is a missing "e" which should be the 8090th character. But the next file entries are being read correctly. What am I missing?
type: Question
score: 0
has title: Java String[] args missing character
answer count: 2
duplicate of: http://stackoverflow.com/q/2916865
has comment: http://stackoverflow.com/comment/31380215
tagged with: arrays
tagged with: string
has answer: http://stackoverflow.com/a/20905516
tagged with: args
has comment: http://stackoverflow.com/comment/31380655
has answer: http://stackoverflow.com/a/20905851

http://stackoverflow.com/q/20925120
tagged with: java
type: Question
has body: While making war file through ant script,how can we add properties file based on environment(QC,STAGING
tagged with: ant
score: 0
has title: Ant script for Adding different properties file based on environment(QC,STAGING,PRODUCTION)
answer count: 1
has answer: http://stackoverflow.com/a/20925545
type: UnansweredQuestion

http://stackoverflow.com/q/20912130
has comment: http://stackoverflow.com/comment/31394008
has comment: http://stackoverflow.com/comment/31393962
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31400355
has comment: http://stackoverflow.com/comment/31394541
has comment: http://stackoverflow.com/comment/31417319
has comment: http://stackoverflow.com/comment/31394080
has answer: http://stackoverflow.com/a/20921409
has comment: http://stackoverflow.com/comment/31393897
has comment: http://stackoverflow.com/comment/31394085
score: 0
has comment: http://stackoverflow.com/comment/31395670
answer count: 1
tagged with: events
tagged with: keyboard
has body: Hi want to send Event(keyboard press) on application thats not focused using Java .I searched for this in google but i found only if the application's screen is focused.
has comment: http://stackoverflow.com/comment/31393845
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31393942
has comment: http://stackoverflow.com/comment/31394499
has title: Sending Keyboard event to Off Screen Application using Java
has comment: http://stackoverflow.com/comment/31394304

http://stackoverflow.com/q/20878710
has body: I've got an excercise from university which looks like: int a = 10; int b = 3; double c = a / b; The question is: Which value is c. Now I would say, c is 3.3. It's casted implicit to double before calculating the result. But the correct answer to this question is according to my records 3.0. How this can be? Does the compiler really calculate the result first as integer and then in a second step casts it to double? Or did I understand that incorrectly?
has title: Implicit typecasting - Int to double
has answer: http://stackoverflow.com/a/20878756
has answer: http://stackoverflow.com/a/20878737
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31330612
tagged with: implicit-conversion
has comment: http://stackoverflow.com/comment/31330695
tagged with: java
possible better answer: http://stackoverflow.com/a/20878737
type: Question
has answer: http://stackoverflow.com/a/20878735
tagged with: casting
accepted answer: http://stackoverflow.com/a/20878735
has comment: http://stackoverflow.com/comment/31330639
score: 0
answer count: 3

http://stackoverflow.com/a/35535866
score: 0
has body: Note that you have this code... pixels = ((DataBufferInt)image.getRaster().getDataBuffer()).getData(); while it should be like this... pixels = ((DataBufferInt)img.getRaster().getDataBuffer()).getData(); Change image to img. Hope it works!
type: Answer
answers question: http://stackoverflow.com/q/20852641

http://stackoverflow.com/comment/31480091
type: QuestionComment
has text: Hi Dave, could this be related to http://stackoverflow.com/questions/20667653/tomcat-not-reading-spring-boot-application-properties ?
type: Comment
comment on: http://stackoverflow.com/q/20854585
score: 0

http://stackoverflow.com/q/20975496
has comment: http://stackoverflow.com/comment/31578244
tagged with: background
type: Question
tagged with: effect
has comment: http://stackoverflow.com/comment/31513615
has body: I'm working at a game, where the action is underwater. I want to make something very simple that goes on top of every texture in the game, to simulate the underwater effect. Using just a photo with transparency will do this But this is not that good looking, and it feels beter without it. I want to make something similar to water texture from the game, but I want to make the little waves moving, so it gives an underwater aspect. Maybe something like - http://www.youtube.com/watch?v=UlrGi7jwmIM, but without thoose complex movements, just simple waves. I tried to use libgdx particle editor, but for a simple flame (the default one), it eats a lot of my FPS, and anyways, I don't need a complex effect just a simple one, that can cover my 800x480 game screen, and gives the effect of playing underwater. Something like http://www.youtube.com/watch?v=DA_dU_46aIc , but 2D. Does anyone got some ideeas?
has comment: http://stackoverflow.com/comment/31514182
tagged with: libgdx
has comment: http://stackoverflow.com/comment/31513523
has title: LibGDX - a simple water background
has comment: http://stackoverflow.com/comment/31513529
has comment: http://stackoverflow.com/comment/31513775
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32950078
score: 2
has comment: http://stackoverflow.com/comment/31513964
answer count: 0
upvote count: 2
tagged with: java

http://stackoverflow.com/a/20957413
type: Answer
has comment: http://stackoverflow.com/comment/31479501
has comment: http://stackoverflow.com/comment/31480068
upvote count: 1
has comment: http://stackoverflow.com/comment/31480669
has body: I'm trying to create a basic UI for a simple Temperature Conversion app I do not know why a temperature conversion app would need one ViewPager, let alone two in the same activity at the same time. I can't figure out how to create a SINGLE page with two SEPARATE scrollable view pagers, one occupying the top half and the other occupying the bottom one In terms of the ViewPagers themselves, use a LinearLayout or something to vertically stack them. Your bigger headache will come with the PagerAdapter implementations. At least one of these will have to be something other than FragmentPagerAdapter or FragmentStatePagerAdapter. Those implementations assume that they are the only such adapter for your activity, and I would expect that having two will cause collisions.
score: 1
answers question: http://stackoverflow.com/q/20957311
has comment: http://stackoverflow.com/comment/31479406
has comment: http://stackoverflow.com/comment/31479454
downvote count: 0

http://stackoverflow.com/q/20927053
tagged with: tcp
tagged with: java
has body: im trying since month to do a proper "push" without using external librarys or gcm. First i tried xmpp with asmack, then mosquitto with paho or ibm mqtt client and http with alarmtimer. Finally i ended with deacon and meteord but since it's not very good (on server side - high cpu and memory load) im trying to do a longpolling connection. I know that it requires a heartbeat and finally i was thinking about the Delay (300 seconds heartbeat should be enough?) and the proper way. Is it better (battery usage and so on) to send a Heartbeat (with 1 Byte or whatever) from server to client (delay for example 300 seconds) and setting a socket timeout on client side of 300, or is it better to do send it from the client to the server? Currently im using a Service which register an observer in onCreate and unregister in onDestroy. The Observer is observing an object which do establish a tcp socket connection in a Thread and retry it onec it's disconnects (socket timeout). I do also check with a broadcastreciever if the network connection changed and reconnect if needed. What happen when the device go into standby? Do i really need an alarmmanager or timertask to recieve OR send the packet? Does the Device drop the Connection onec it goes into standby? Currently i tried sending from server to client with a 120 second delay and even when the devices display turned of its still possible to send the heartbeat. But at least it looks like that the battery drain is not "acceptable". So.. What is the best way to do that? Thank you so far.
has title: Android Long Polling TCP Connection
tagged with: long-polling
type: Question
has answer: http://stackoverflow.com/a/22804227
has answer: http://stackoverflow.com/a/20927270
score: 4
upvote count: 4
answer count: 3
has answer: http://stackoverflow.com/a/22499708
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: sockets
tagged with: android

http://stackoverflow.com/q/20964527
has comment: http://stackoverflow.com/comment/31650688
has comment: http://stackoverflow.com/comment/31633747
has body: I want to validate an image which is in the class property here is the code snippet.. &lt;img class="sprite edit-adv-icon" alt="Master" src="http://images/spacer.png"&gt; and class property like below : .edit-adv-icon { background-position: -689px -2px; display: inline-block; vertical-align: middle; width: 35px;`enter code here` } icon-s...-v1.css (line 41) .sprite { background: url("../images/icon-sprite-v1.png") repeat scroll 0 0 rgba(0, 0, 0, 0); }
possible better answer: http://stackoverflow.com/a/20966891
tagged with: selenium-webdriver
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20966891
downvote count: 0
score: 1
has title: How to validate an image in the class properties in selenium Web Driver
tagged with: selenium
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/20966374
accepted answer: http://stackoverflow.com/a/20966374
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/20967023
linked to: http://stackoverflow.com/q/16337043
has comment: http://stackoverflow.com/comment/31493824
favorite count: 0

http://stackoverflow.com/q/20901988
type: Question
answer count: 2
has body: I have to do load test for a stand alone java application. I have just one class file can i do the testing with Jmeter ? If yes then can some body throw some light over it or share any tutorial? Actually when i went through net, i got to know that Jmeter is meant for testing web application only but i got few blogs regarding testing of stand alone application as well but they were not very much helpful. Please help.
downvote count: 0
has title: Using Jmeter for load testing of a standalone java application
possible better answer: http://stackoverflow.com/a/20902245
favorite count: 0
upvote count: 2
tagged with: load-testing
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/31373645
tagged with: jmeter
has answer: http://stackoverflow.com/a/20902227
accepted answer: http://stackoverflow.com/a/20902227
tagged with: java
has answer: http://stackoverflow.com/a/20902245

http://stackoverflow.com/comment/31543687
type: Comment
has text: Which specific cell ? Using JS or what ?
score: 0
comment on: http://stackoverflow.com/q/20991500
type: QuestionComment

http://stackoverflow.com/comment/31488681
comment on: http://stackoverflow.com/q/20961816
score: 0
has text: Great that worked but now is there a way to get rid of the "null" element in the array? `[null, 2, null, 4, null, null, -2, null, 6, null]`
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20877946
has body: Each 'row' of a GridBagLayout can have different numbers of columns, so it hardly makes sense to specify it in the constructor.
has comment: http://stackoverflow.com/comment/31332021
downvote count: 0
answers question: http://stackoverflow.com/q/20877894
type: Answer
has comment: http://stackoverflow.com/comment/31331932
has comment: http://stackoverflow.com/comment/31331779
has comment: http://stackoverflow.com/comment/31331763
score: 7
upvote count: 7

http://stackoverflow.com/comment/31291527
type: Comment
has text: .dat is short for 'data' which you might note is a vague term. .dat files are often (but not always) text.
score: 3
comment on: http://stackoverflow.com/q/20858283
type: QuestionComment

http://stackoverflow.com/a/21175053
answers question: http://stackoverflow.com/q/20851342
type: Answer
score: 0
has body: Is your java source directory copied into the android-build directory? The android folder in your source folder needs to be listed in the qmake variable ANDROID_PACKAGE_SOURCE_DIR see: http://qt-project.org/doc/qt-5/deployment-android.html#qmake-variables

http://stackoverflow.com/comment/31280339
has text: are you sure there are no leading/trailing space for the first element's string, it is exactly equal ?
comment on: http://stackoverflow.com/q/20852144
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20989940
upvote count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/20990184
has answer: http://stackoverflow.com/a/20990184
type: Question
has title: How to create new instance with the same value?
has comment: http://stackoverflow.com/comment/31540276
has body: Actually, I searched the solution for that in web. I also found Copy an object in Java. In my object, there are a lot mapping. Even I use Cloneable and Copy Constructor, I still need to copy for each fields? My requirement is to know which data changed between Old Object and New Object. My object Example Tree : MotorProposal - startDate : Date ---&gt; can change - endDate : Date ---&gt; can change - customer : Cutomer - vehicleList : List&lt;Vehicle&gt; ---&gt; can chnage - carNo : String ---&gt; can change - loading : int ---&gt; can change - cubicCapacity : int ---&gt; can chnage - driver : Driver ---&gt; can change - fullName : String ---&gt; can change - address : Stirng ---&gt; can change - license : Stirng ---&gt; can change - expYear : int ---&gt; can change - model : Model -there other fields -there other fields Is there another way to create new Instance with the same value without copying for each field? My expected program MotorProposal oldProposal = --&gt; come from DB MotorProposal newProposal = org.someapi.ObjectUtil.newInstance(oldProposal); Update Currently, I solve this case Martin Dinov suggested. As below. ObjCopy.java public class ObjCopy { public static Serializable newInstance(Serializable obj) { Serializable result = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(buffer); oos.writeObject(obj); oos.flush(); oos.close(); ByteArrayInputStream in = new ByteArrayInputStream(buffer.toByteArray()); ObjectInputStream ois = new ObjectInputStream(in); return (Serializable)ois.readObject(); } catch (Exception e) { //do nothing e.printStackTrace(); } return result; } } Test.java public class Test { public static void main(String[] args) { Country country = new Country(); country.setName("Myanmar"); Province province_1 = new Province(); province_1.setCountry(country); province_1.setName("Yangon"); Province province_2 = (Province)ObjCopy.newInstance(province_1); province_2.getCountry()…
answer count: 2
has answer: http://stackoverflow.com/a/20990171
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31540781
linked to: http://stackoverflow.com/q/475842
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/31540270
accepted answer: http://stackoverflow.com/a/20990171

http://stackoverflow.com/a/20989946
downvote count: 0
score: 4
type: AcceptedAnswer
has body: According to the documentation public static PdfStamper createSignature(PdfReader reader, OutputStream os, char pdfVersion) throws DocumentException, IOException You can give any OutputStream you want, so I suggest you do ByteArrayOutputStream output = new ByteArrayOutputStream(); PdfStamper stamper = PdfStamper.createSignature(reader, output, '\0', null, true); Then you can retrieve the content of output as an array of bytes (http://docs.oracle.com/javase/7/docs/api/java/io/ByteArrayOutputStream.html)
accepted answer of: http://stackoverflow.com/q/20989280
type: Answer
answers question: http://stackoverflow.com/q/20989280
upvote count: 4

http://stackoverflow.com/comment/31530944
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20984429
has text: I've down-voted this question for following reasons: ' No information has been provided on what you've tried to resolve the issue ' and 'No information has been provided about what are you trying to achieve with this piece of code?'
score: 0

servlets
tags question: http://stackoverflow.com/q/20907351
tags question: http://stackoverflow.com/q/20911903
tags question: http://stackoverflow.com/q/20888958
tags question: http://stackoverflow.com/q/20971447
tags question: http://stackoverflow.com/q/20867208
tags question: http://stackoverflow.com/q/20969956
tags question: http://stackoverflow.com/q/20963970
tags question: http://stackoverflow.com/q/20881144
tags question: http://stackoverflow.com/q/20883269
tags question: http://stackoverflow.com/q/20987051
tags question: http://stackoverflow.com/q/20901785
tags question: http://stackoverflow.com/q/20995368
tags question: http://stackoverflow.com/q/20975407
tags question: http://stackoverflow.com/q/20951889
tags question: http://stackoverflow.com/q/20949396
tags question: http://stackoverflow.com/q/20896237
tags question: http://stackoverflow.com/q/20874099
tags question: http://stackoverflow.com/q/20899607
tags question: http://stackoverflow.com/q/20938907
tags question: http://stackoverflow.com/q/20856067
tags question: http://stackoverflow.com/q/20871886
tags question: http://stackoverflow.com/q/20921400
tags question: http://stackoverflow.com/q/20956020
tags question: http://stackoverflow.com/q/20906302
tags question: http://stackoverflow.com/q/20958755
tags question: http://stackoverflow.com/q/20983866
tags question: http://stackoverflow.com/q/20980960
tags question: http://stackoverflow.com/q/20858207
tags question: http://stackoverflow.com/q/21018679
tags question: http://stackoverflow.com/q/20864482
tags question: http://stackoverflow.com/q/21002233
tags question: http://stackoverflow.com/q/21009968
tags question: http://stackoverflow.com/q/21007383
tags question: http://stackoverflow.com/q/20977226
tags question: http://stackoverflow.com/q/20917274
tags question: http://stackoverflow.com/q/20853509
tags question: http://stackoverflow.com/q/20950689
tags question: http://stackoverflow.com/q/20947806
tags question: http://stackoverflow.com/q/20959453
tags question: http://stackoverflow.com/q/21015889
tags question: http://stackoverflow.com/q/20856016
tags question: http://stackoverflow.com/q/20978550
tags question: http://stackoverflow.com/q/20867864
tags question: http://stackoverflow.com/q/20898848
tags question: http://stackoverflow.com/q/20895723
tags question: http://stackoverflow.com/q/20908446
tags question: http://stackoverflow.com/q/20999027
tags question: http://stackoverflow.com/q/20965050
tags question: http://stackoverflow.com/q/20946493
tags question: http://stackoverflow.com/q/20913780
tags question: http://stackoverflow.com/q/20934739
tags question: http://stackoverflow.com/q/20920845
tags question: http://stackoverflow.com/q/20935413
tags question: http://stackoverflow.com/q/20936738
tags question: http://stackoverflow.com/q/20961820
tags question: http://stackoverflow.com/q/20903257
tags question: http://stackoverflow.com/q/21001260
tags question: http://stackoverflow.com/q/20908204
tags question: http://stackoverflow.com/q/20907427
tags question: http://stackoverflow.com/q/20907877
tags question: http://stackoverflow.com/q/20993160
tag name: servlets
tags question: http://stackoverflow.com/q/20994466
tags question: http://stackoverflow.com/q/20917860
tags question: http://stackoverflow.com/q/20925004
tags question: http://stackoverflow.com/q/21015397
tags question: http://stackoverflow.com/q/20956169
tags question: http://stackoverflow.com/q/20937893
tags question: http://stackoverflow.com/q/21008374
type: Tag
tags question: http://stackoverflow.com/q/20919734
tags question: http://stackoverflow.com/q/20943532
tags question: http://stackoverflow.com/q/20937169
tags question: http://stackoverflow.com/q/20900782
tags question: http://stackoverflow.com/q/20950521
tags question: http://stackoverflow.com/q/20883656
tags question: http://stackoverflow.com/q/20965988
tags question: http://stackoverflow.com/q/20989523
tags question: http://stackoverflow.com/q/21016543
tags question: http://stackoverflow.com/q/20970297

http://stackoverflow.com/comment/31369477
type: Comment
comment on: http://stackoverflow.com/a/20887855
type: AnswerComment
has text: Yes, I'm aware of that, this is only the way for storing the particular level in a file, and loading the data from it before the level starts, I never meant constant reading of the file while playing :)
score: 0

http://stackoverflow.com/q/20878255
tagged with: eclipse
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/20878349
downvote count: 0
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/31329834
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/47761335
tagged with: java
has title: Error persists~ "fullscreen_content_controls cannot be resolved or is not a field"
has body: I'm kind of a noob android developer, and I hit a few bumps while trying to create a button that opens a new layout. While I was doing that, I got a few errors that would not go away no matter what I tried. In response, I copied most of the xml files and java files that I had changed from the original structure, and I added them to a new project, thinking all my errors would go away. I really need some help, I can't tell you how long I have been stuck on this small error. I have attached the main FullScreenActivity.java, activity_main.xml, the Android Manifest, and the error messages. Thank you in advance for the help guys, I really do appreciate it! c: FullScreenActivity.java ~ package sehej.android.doge; import sehej.android.doge.util.SystemUiHider; import sehej.android.doge.R; import android.annotation.TargetApi; import android.app.Activity; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.view.MotionEvent; import android.view.View; public class FullscreenActivity extends Activity { /** * Whether or not the system UI should be auto-hidden after * {@link #AUTO_HIDE_DELAY_MILLIS} milliseconds. */ private static final boolean AUTO_HIDE = true; /** * If {@link #AUTO_HIDE} is set, the number of milliseconds to wait after * user interaction before hiding the system UI. */ private static final int AUTO_HIDE_DELAY_MILLIS = 3000; /** * If set, will toggle the system UI visibility upon interaction. Otherwise, * will show the system UI visibility upon interaction. */ private static final boolean TOGGLE_ON_CLICK = true; /** * The flags to pass to {@link SystemUiHider#getInstance}. */ private static final int HIDER_FLAGS = SystemUiHider.FLAG_HIDE_NAVIGATION; /** * The instance of the {@link SystemUiHider} for this activity. */ private SystemUiHider mSystemUiHider; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); **** final View controlsView = f…
type: Question
accepted answer: http://stackoverflow.com/a/20878349
possible better answer: http://stackoverflow.com/a/47761335

http://stackoverflow.com/q/20968797
favorite count: 0
has comment: http://stackoverflow.com/comment/31502492
has answer: http://stackoverflow.com/a/20970592
downvote count: 0
has body: Hello and a happy new year, we are still struggling with our simulation application. Especially with using SQLite as a 'real time' look up table for simulation data while running. Let me show you the table design first: SQLfiddle - Link Here you can see a table 'testtable' with: 'id' (integer): as the primary key 'time_abs' (integer): represents a time stamp associated with the simulation clock 'r_m' (double): stands for 'mass rate' (unit is kg/s e.g.) of some flow 'T_r' (double): stands for 'temperature of mass flow' 'type'(varchar): stands for the kind of the mass flow (e.g. water) 'x0' (varchar): represents the departure of the mass flow (e.g. vessel #1) 'x1' (varchar): represents the destination of the mass flow (e.g. vessel #2) (Actually there are some more chemical and physical attributes written into this table) The simulation creates those data and it is written with Java methods into the database, which works pretty good (a few 10k/s possible). The issue is: While the simulation is running the simulation engine sometime needs certain information like "What is the total mass in vessel1 at time 14?" We receive this information with a query like this: SELECT total(r_m) FROM testtable WHERE time_abs&lt;=14 AND x1='vessel2') - (SELECT total(r_m) FROM testtable WHERE time_abs&lt;=14 AND x0='vessel2'); (which is: adding all income rates and substracting all outcome rates at one local point) Which works fine at the beginning. But in the end we have about 8 to 10 million rows in this table and the performance drops a lot. E.g. this query almost take 6 seconds (3-4 seconds with SQLite mangaer in firefox). Also in the end we would like to plot total mass over a period of 1000 time units (time_abs) with this query which will need about 1000*6 seconds. Obviously to much. So the question is, what can we do to significantly increase the performance?
has comment: http://stackoverflow.com/comment/31501878
has comment: http://stackoverflow.com/comment/31501097
has answer: http://stackoverflow.com/a/20978675
type: AnsweredQuestion
score: 2
tagged with: java
tagged with: database
type: Question
upvote count: 2
possible better answer: http://stackoverflow.com/a/20970592
accepted answer: http://stackoverflow.com/a/20969811
has title: SQLite and performance issue with SELECT total(value)
has comment: http://stackoverflow.com/comment/31502886
has comment: http://stackoverflow.com/comment/31501648
has comment: http://stackoverflow.com/comment/31502366
answer count: 3
tagged with: sql
has answer: http://stackoverflow.com/a/20969811
tagged with: sqlite
has comment: http://stackoverflow.com/comment/31502224

http://stackoverflow.com/comment/31449388
type: AnswerComment
score: 0
type: Comment
has text: Hmm, you mean that it now works for the first orientation change, but not the next? That's very strange. I'm not sure why that would be the case...
comment on: http://stackoverflow.com/a/20940511

http://stackoverflow.com/comment/31417655
type: Comment
comment on: http://stackoverflow.com/q/20892163
score: 0
type: QuestionComment
has text: @Yagnesh user has project he is owner of and project he participates in.

http://stackoverflow.com/a/21016890
has comment: http://stackoverflow.com/comment/31625760
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21013484
upvote count: 1
has body: As shown in this complete example, DefaultMutableTreeNode "may also hold a reference to a user object." Your userObject can return the display name in toString(), while providing an accessor for the search name. Addendum: I need only the name to be shown there, not the date. The getTreeCellRendererComponent() method of DefaultTreeCellRenderer invokes "convertValueToText(), which ultimately invokes toString() on value." Your implementation should instead call setText() with your preferred value, perhaps derived from the value established by the super implementation.
type: Answer

set-theory
type: Tag
tag name: set-theory
tags question: http://stackoverflow.com/q/20890802

http://stackoverflow.com/comment/31318880
comment on: http://stackoverflow.com/a/20872208
type: AnswerComment
score: 0
type: Comment
has text: Ah thanks, I missed the "1S". I have edited that class but I still get an error. Could you please guide me on that?

http://stackoverflow.com/a/20934348
downvote count: 0
answers question: http://stackoverflow.com/q/20934314
type: Answer
has body: Because with most Java operators (~ included), integer operands are promoted before the operator is applied. So byte is promoted to int; your code is equivalent to this: b = (byte) ~((int) b); Therefore in general, assigning back to a byte will lose information in the upper bits. (Although it's pretty meaningless in this case.)
accepted answer of: http://stackoverflow.com/q/20934314
upvote count: 5
score: 5
type: AcceptedAnswer

http://stackoverflow.com/q/20983867
downvote count: 2
has comment: http://stackoverflow.com/comment/31529860
has comment: http://stackoverflow.com/comment/31529671
has comment: http://stackoverflow.com/comment/31529584
type: Question
has comment: http://stackoverflow.com/comment/31529714
score: -2
tagged with: java
accepted answer: http://stackoverflow.com/a/20983909
tagged with: indexoutofboundsexception
has comment: http://stackoverflow.com/comment/31529692
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31529885
has comment: http://stackoverflow.com/comment/31529690
has answer: http://stackoverflow.com/a/20983909
has title: arrayOutOfBounds exception java on my Java project
type: AnsweredQuestion
has body: I can't seem to find the problem on the following error : Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 31 This error is received in this part of the code : for (int i = 0; i &lt; templateKeuze.length(); i++) { if(woord[i].startsWith("?")){ System.out.println("\nGeef je input voor de parameter "+woord[i]); vervang = Input.readLine(); templateKeuze.replace(woord[i],vervang); } else{ continue; } }
has comment: http://stackoverflow.com/comment/31529848

http://stackoverflow.com/comment/102050822
comment on: http://stackoverflow.com/a/28149802
score: 0
type: AnswerComment
type: Comment
has text: You sir are a genus, thank you! I was running this in OpenShift and kept having to create a PVC for that directory and mount it!

http://stackoverflow.com/a/20983659
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/31529260
answers question: http://stackoverflow.com/q/20983642
has comment: http://stackoverflow.com/comment/31529561
score: 6
accepted answer of: http://stackoverflow.com/q/20983642
has comment: http://stackoverflow.com/comment/31529434
has comment: http://stackoverflow.com/comment/31529289
has body: Calling this(); as if it were a method is the way to invoke another constructor from within a constructor. You are effectively calling Fingerprint(). Please see the Java Tutorial on the subject, section "Using this with a Constructor".
has comment: http://stackoverflow.com/comment/31529378
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31529214

http://stackoverflow.com/comment/49751370
comment on: http://stackoverflow.com/a/27502664
type: AnswerComment
score: 0
type: Comment
has text: I created ~/Library/Preferences/AndroidStudio/idea.properties and in it have the path to my jdk : STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk No editing of the Info.plist necessary!

http://stackoverflow.com/q/20898241
upvote count: 1
has title: How a validate a phone number (number entered is present)
tagged with: gwt
tagged with: java
has body: I have created a Gwt application which has a form for user registration which contains a phone number textbox. I have applied a regex to validate its a ten digit number. Now is there any way to check that the number entered by user is not fake like if he is not entering number like 1234567890 or 0000000000. One technique I know is to send verification code on this number, but apart from that is there any other way. Also if send msg is the only option is there any gwt client side to send immediate msg to that number.
type: UnansweredQuestion
tagged with: phone-number
answer count: 0
downvote count: 0
score: 1
favorite count: 0
type: Question

http://stackoverflow.com/comment/32118301
score: 1
type: AnswerComment
has text: They claim to be open source, the code can be found [here](http://sourceforge.net/projects/itext/) and there are [two licenses available](http://itextpdf.com/pricing), commercial and AGPL.
comment on: http://stackoverflow.com/a/21305303
type: Comment

http://stackoverflow.com/comment/31422430
has text: So have would you generate those stubs, would exexute the stories using junit from eclipse ?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20921971

http://stackoverflow.com/comment/31593160
score: 1
has text: It tells me that you're leaking the context and it's being held by a message queue. First, verify if there is any non-static inner class in your activity. Objects from non-static inner classes hold a reference to its parent, so you may want double-check it. Also double-check the runnable which you're posting: does it take too long to run? As long as it is in the message queue, the activity's context will not be destroyed.
comment on: http://stackoverflow.com/q/21002343
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31589508
type: AnswerComment
comment on: http://stackoverflow.com/a/21016717
type: Comment
score: 0
has text: And you don't have access to these jars? If is not the case, what I did in the past, even if it sounds "cheap", is to create dummy empty classes to match exactly the import's of the class I want to compile.

http://stackoverflow.com/q/21004273
has body: What would the syntax be if I had an object where I wanted to set an ArrayList? Here is a sample Object with getter and setter (multiple other Strings and ints are set inside Some_obj that have been removed for this example): public class Some_obj { protected ArrayList&lt;String&gt; spinnerList = new ArrayList&lt;String&gt;(); public ArrayList&lt;String&gt; getList() { return spinnerList; } public void setList(ArrayList&lt;String&gt; spinnerList) { this.spinnerList = spinnerList; } public Some_obj(ArrayList&lt;String&gt; _sl) { spinnerList = _sl; } } How would I declare it inside the object, since this current code is basically setting a new list any time it need to set the adapter for a spinner. Do I need to declare list like this? protected ArrayList&lt;String&gt; spinnerList; so I can do something like this? Some_obj obj = listViewCells.get(selectedPosition); obj.setList(listFromActivity); I'm currently able to populate the spinner successfully with listFromActivity, however I see it beneficial to store the listFromActivity inside Some_obj in the near future...it just seems like I can't figure out how to set an ArrayList inside Some_obj if it's first set as null inside Some_obj.
has comment: http://stackoverflow.com/comment/31569897
tagged with: java
has answer: http://stackoverflow.com/a/21005957
answer count: 1
tagged with: android-spinner
tagged with: arraylist
score: 0
tagged with: android
has title: Get and Set an ArrayList<String> inside an object to populate Spinner
accepted answer: http://stackoverflow.com/a/21005957
has comment: http://stackoverflow.com/comment/31569388
has comment: http://stackoverflow.com/comment/31567000
has comment: http://stackoverflow.com/comment/31569337
type: Question
type: AnsweredQuestion

http://stackoverflow.com/q/20930938
has body: so i got this problem.I'm trying to make simple action bar with some tabs.Somehow i'm getting NullPointerException and i can't figure out how to fix it.Here's some code: MainActivity.java public class MainActivity extends FragmentActivity { ViewPager Tab; TabPagerAdapter TabAdapter; ActionBar actionBar; PagerSlidingTabStrip tabs; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs); Tab = (ViewPager) findViewById(R.id.pager); TabAdapter = new TabPagerAdapter(getSupportFragmentManager()); Tab.setAdapter(TabAdapter); tabs.setViewPager(Tab); //line 27 where the error appears tabs.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { actionBar = getActionBar(); actionBar.setSelectedNavigationItem(position); } }); } } activity_main.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout 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" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;com.astuetz.PagerSlidingTabStrip android:id="@+id/tabs" android:layout_width="match_parent" android:layout_height="48dip" /&gt; &lt;android.support.v4.view.ViewPager android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" /&gt; &lt;/RelativeLayout&gt; Here is also the error log: 01-05 08:30:20.576: E/AndroidRuntime(19913): FATAL EXCEPTION: main 01-05 08:30:20.576: E/AndroidRuntime(19913): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.hiddensofia/com.example.hiddensofia.MainActivity}: java.lang.NullPointerException 01-05 08:30:20.576: E/AndroidRuntime(19913): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2463) …
tagged with: android
possible better answer: http://stackoverflow.com/a/20931613
has comment: http://stackoverflow.com/comment/31429578
has answer: http://stackoverflow.com/a/20931685
has answer: http://stackoverflow.com/a/20931613
tagged with: http://stackoverflow.com/tag/xml
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: android-fragments
tagged with: java
has title: Android .setViewPager returns NullPointerException
type: Question
tagged with: android-layout
answer count: 2
has comment: http://stackoverflow.com/comment/31429518
upvote count: 2
accepted answer: http://stackoverflow.com/a/20931685
favorite count: 0

http://stackoverflow.com/q/20881157
has comment: http://stackoverflow.com/comment/31337534
has comment: http://stackoverflow.com/comment/31336638
tagged with: java
has comment: http://stackoverflow.com/comment/31355798
has answer: http://stackoverflow.com/a/20881313
downvote count: 0
has title: Program does not load data correctly while working with ObjectInputStream,ObjectOutputStream
tagged with: arraylist
tagged with: file-io
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20881313
score: 1
favorite count: 0
tagged with: serialization
has comment: http://stackoverflow.com/comment/31372217
type: Question
upvote count: 1
has body: What am I trying to do Simulate a socialnetwork program,in which you can add your profile,change your status,your picture,add friends etc.The program must save it's content before closing in a file. How do I intend to do it As I can not append with ObjectOutputStream. I though of creating an ArrayList&lt;SocialProfiles&gt; (SocialProfiles) in this case are the profiles which I am trying to save. I want to load the profiles from the file to the ArrayList when the program starts,and when I am done adding profiles, I want to write the profiles from the ArrayList back to the file. I am using the size of the array as an index.Example when it first writes to the array,it writes to index 0.When it has 1 element it writes to index 1 etc etc. What is not going as it is supposed to? The program does not load the data from the file to the array. What do I call at Main try { fileoutput = new FileOutputStream("database.dat"); } catch (FileNotFoundException e2) { // TODO Auto-generated catch block e2.printStackTrace(); } try { output = new ObjectOutputStream(fileoutput); } catch (IOException e2) { // TODO Auto-generated catch block e2.printStackTrace(); } try { fileinput = new FileInputStream("database.dat"); } catch (FileNotFoundException e2) { // TODO Auto-generated catch block System.out.println("File database.dat nuk ekziston"); } try { input = new ObjectInputStream(fileinput); } catch (IOException e2) { } loadData(); frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { new Thread() { @Override public void run() { writeData(); try { fileinput.close(); fileoutput.close(); input.close(); output.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.exit(0); } }.start(); } }); Methods public void loadData(){ try{ while (true) { SocialProfile temp; temp = (SocialProfile)input.readObject(); profiles.add(profiles.size(),temp); } } catch(NullPointerException e){ } catch(EOFException e){ System…
answer count: 1

http://stackoverflow.com/a/20933977
has body: Try using hibernate single table inheritance mapping: @Entity @Inheritance(strategy= InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name="addresstype", discriminatorType= DiscriminatorType.STRING) public abstract class Address { ... common attributes here } @Entity @DiscriminatorValue("home") public class HomeAddress extends Address { ... } @Entity @DiscriminatorValue("work") public class WorkAddress extends Address { ... } And then create two collections, one for home addresses and the other for work addresses. If there is code that is valid only for home addresses then we use the HomeAddress type, the same if there is code that is only valid for work addresses we use WorkAddress. If there is code that is valid for both address types then we use the Address super type.
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/20925090
answers question: http://stackoverflow.com/q/20925090
has comment: http://stackoverflow.com/comment/31690756
downvote count: 0
score: 1

http://stackoverflow.com/q/20960541
has title: File Transport between Server/Client
has comment: http://stackoverflow.com/comment/31487104
accepted answer: http://stackoverflow.com/a/20961382
has comment: http://stackoverflow.com/comment/31488141
has comment: http://stackoverflow.com/comment/31486937
has comment: http://stackoverflow.com/comment/31487789
downvote count: 1
has comment: http://stackoverflow.com/comment/31486736
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31486907
has body: What kind of Service should I define for ".thrift"-file to use it later for my Program? This File Transport should be between the Client and the Server and it should be "partly". StreamFileService.thrift: struct FileChunk { 1: binary data 2: i64 remaining } service StreamFileService { FileChunk getBytes(1:string fileName, 2: i64 offset, 3: i32 size); } StreamFileClient.java: public class StreamFileClient { private int fileChunkSize = 16; private String filePath; public String getFilePath() { return filePath; } public void setFilePath(String filePath) { this.filePath = filePath; } private void invoke() { try { TTransport theClientTransport = new TFramedTransport(new TSocket( "127.0.0.1", 7911)); TProtocol theProtocol = new TBinaryProtocol(theClientTransport); StreamFileService.Client theClient = new StreamFileService.Client( theProtocol); theClientTransport.open(); filePath = "/home/output/output.pdf"; File theFile2 = new File(filePath); theFile2.createNewFile(); FileInputStream stream = new FileInputStream(theFile2); long currentPosition = 0; FileChannel theFileChannel = stream.getChannel(); boolean again = true; do { FileChunk chunk2 = theClient.getBytes(filePath, currentPosition, fileChunkSize); currentPosition += fileChunkSize; theFileChannel.write(chunk2.data); if (chunk2.remaining == 0) again = false; } while (again); stream.close(); } catch (TTransportException e) { e.printStackTrace(); } catch (TException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void main(String[] args) { StreamFileClient theClient = new StreamFileClient(); theClient.invoke(); } } StreamFileServer.java: public class StreamFileServer { private void start() { try { TNonblockingServerTransport theServerSocket = new TNonblockingServerSocket( 7911); StreamFileService.Processor theProcessor…
has comment: http://stackoverflow.com/comment/31487705
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/31488260
tagged with: thrift
type: Question
has comment: http://stackoverflow.com/comment/31564340
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/20961382
score: 4

http://stackoverflow.com/q/20870150
answer count: 1
downvote count: 0
favorite count: 0
has body: I've to code a Program in which user input values for array and program calculate the number of 14,16 and 18's sum and element combination for that particular sum with minimum wastage. Like {3,6,12,7,1,4} here 14's sum=0 with wastage:0 And combination:0 16's sum=1 with wastage:0 And combination:12,4 18's sum=1 with wastage:1 And combination:3,6,7,1 Total Wastage:1 And Other can be 14's sum=0 with wastage:0 And combination:0 16's sum=1 with wastage:1 And combination:3,7,1,4 18's sum=1 with wastage:0 And combination:12,6 Total Wastage:1 I thinks It's best. And can be Other Combination with greater wastage. Now the problem is I have to calculate permutations(through recursion) for input array and then apply logic which calculate sequentially for any permutation...and choose the best with lowest Total wastage from all permutation.My Code is OK for values of 1 to 7. onward like 8,9 or more, calculation time increases with a big difference because of increasing permutation numbers and their objects.I want the code to work for around 50 numbers. Can any one suggest any better solution or change? My code: Class for deal with one permutation. public class ResultSet { public int fourteen = 0, sixteen = 0, eighteen = 0; int ElementSum = 0, TotalWastage = 0, LastActivated = 0; int[] FourteenWastages, SixteenWastages, EighteenWastages, InputCombination; String[] FourteenCombination; String[] SixteenCombination; String[] EighteenCombination; public ResultSet(int[] in) { InputCombination = in; FourteenWastages = new int[InputCombination.length]; SixteenWastages = new int[InputCombination.length]; EighteenWastages = new int[InputCombination.length]; FourteenCombination = new String[InputCombination.length]; SixteenCombination = new String[InputCombination.length]; EighteenCombination = new String[InputCombination.length]; selector(); wastagecalculator(); } public void details() { System.out.println("Fourteen: " + fourteen); for (int j = 0; j &lt; fourteen; j++) { System.out.println…
has answer: http://stackoverflow.com/a/20870206
score: 1
upvote count: 1
type: Question
type: AnsweredQuestion
tagged with: performance
accepted answer: http://stackoverflow.com/a/20870206
tagged with: algorithm
tagged with: java
has title: Need best combination of array elements for specific sum with minimum wastage

http://stackoverflow.com/q/20855376
has body: I'm trying to get text from pdf using Square Annotation. I use below code to extract text from PDF using PDFBOX. CODE try { PDDocument document = null; try { document = PDDocument.load(new File("//Users//" + usr + "//Desktop//BoldTest2 2.pdf")); List allPages = document.getDocumentCatalog().getAllPages(); for (int i = 0; i &lt; allPages.size(); i++) { PDPage page = (PDPage) allPages.get(i); Map&lt;String, PDFont&gt; pageFonts = page.getResources().getFonts(); List&lt;PDAnnotation&gt; la = page.getAnnotations(); for (int f = 0; f &lt; la.size(); f++) { PDAnnotation pdfAnnot = la.get(f); PDFTextStripperByArea stripper = new PDFTextStripperByArea(); stripper.setSortByPosition(true); PDRectangle rect = pdfAnnot.getRectangle(); float x = 0; float y = 0; float width = 0; float height = 0; int rotation = page.findRotation(); if (rotation == 0) { x = rect.getLowerLeftX(); y = rect.getUpperRightY() - 2; width = rect.getWidth(); height = rect.getHeight(); PDRectangle pageSize = page.findMediaBox(); y = pageSize.getHeight() - y; } Rectangle2D.Float awtRect = new Rectangle2D.Float(x, y, width, height); stripper.addRegion(Integer.toString(f), awtRect); stripper.extractRegions(page); PrintTextLocation2 prt = new PrintTextLocation2(); if (pdfAnnot.getSubtype().equals("Square")) { testTxt = testTxt + "\n " + stripper.getTextForRegion(Integer.toString(f)); } } } } catch (Exception ex) { } finally { if (document != null) { document.close(); } } } catch (Exception ex) { } By using this code, I am only able to get the PDF text. How do I do to get the font information like BOLD ITALIC together within the text. Advice or references are highly appreciated.
tagged with: fonts
tagged with: annotations
upvote count: 1
has comment: http://stackoverflow.com/comment/31459090
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: pdfbox
linked to: http://stackoverflow.com/q/20878170
type: Question
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/20964453
accepted answer: http://stackoverflow.com/a/20964453
favorite count: 0
tagged with: http://stackoverflow.com/tag/pdf
has title: PdfBox - Get font Information using

http://stackoverflow.com/q/20995625
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
linked to: http://stackoverflow.com/q/8726400
has title: How to Convert inputStream to JSONObject. Needs to upload File over Android Application
tagged with: jackson
has comment: http://stackoverflow.com/comment/31550683
has comment: http://stackoverflow.com/comment/31619752
answer count: 1
type: UnansweredQuestion
tagged with: android
has body: I have a file ABC(inputstream) that needs to upload from Android App over Jersey Java Rest Server.I am able to send the file alone but I have jsonObj(object converted to json ) along with file. I am trying to convert inputstream into json String and then insert it into jsonObj. But no luck. Please guide me the way to approach this. Update [1] Java Client: with JSONObject ClientConfig config = new DefaultClientConfig(); Client client = Client.create(config); WebResource service = client.resource(getBaseURI()); JSONObject json = new JSONObject(); json.put("id", "1213"); json.put("name", "3"); json.put("date", "2013-12-09"); String input = new String( json.toString()); ClientResponse response = service.path("/insert/").type(MediaType.APPLICATION_JSON). post(ClientResponse.class,input); with inputStream String fileName="D://workspaces/src/readMe.pdf"; InputStream fileInStream = new FileInputStream(fileName); ClientResponse response = service.path("/uploadFile").type(MediaType.APPLICATION_OCTET_STREAM) .post(ClientResponse.class, fileInStream); I hope Server code not required. Now this work perfectly, But i want them together, i guess input stream can be merged with JSONObject, the question is how ?? some folks says that Jackson, but i need this client code on android application where i can not afford extra libs.
has answer: http://stackoverflow.com/a/21014529
score: 0

http://stackoverflow.com/a/20857804
type: Answer
answers question: http://stackoverflow.com/q/20857460
has body: you have not passed the layoutParam for the new TextView. You are setting the value in the TextView object. See this for dynamic addition of textview Currently, your textview is unknown about the textview. You need to tell your layout that you want to add new textview to it.
has comment: http://stackoverflow.com/comment/31290918
score: 0

http://stackoverflow.com/a/21359845
answers question: http://stackoverflow.com/q/20898439
accepted answer of: http://stackoverflow.com/q/20898439
type: AcceptedAnswer
has body: i finally figured out where the problem came from. the issue is that when i pack all my images, i set the Max page width and Max page height to 4086. i am guessing that somehow Nexus did not "really" load those images. problem solved when i reduced both Max page width and Max page height to 2048. anyway, i still appreciated helps from both @noone and @son-of-the-northern-darkness
score: 0
type: Answer

http://stackoverflow.com/q/20997164
has comment: http://stackoverflow.com/comment/31557275
tagged with: cordova
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31552946
has body: I'm making an android app which uses bluetooth using phonegap and I'm having issues handling code because it get's called every 100ms. I want to try if the issue occurs because my phonegap javascript code is to long causing delays. To try this I want to dispaly the received message using a native textbox. Is this possible? and How would I do this? Thanks Martijn PS: I've tried using Toast but since I want to change the displayed value every 100ms this doesn't work. Code upon receiving a message this is the order the code is processed bytes = mmInStream.read(buffer); s_message = new String(buffer, 0, bytes); String[] strArray = s_message.split(","); mHandleReceivedThread = new HandleReceivedThread(strArray); mHandleReceivedThread.start(); In the HandleReceivedThread: if(strArrayReceived[0].startsWith("Pressure")) { if(strArrayReceived[1].contains("Pressure")) { double Pressure = Double.parseDouble(strArrayReceived[1].replace("Pressure", "")); double PressureResult = Pressure/10; String PressureValue = String.valueOf(PressureResult); webView.sendJavascript("PressureValue = " + Pressure + ";"); webView.sendJavascript("document.getElementById('Pressure').innerHTML = " + PressureValue + ";"); Log.e(TAG, "Message fail: " + strArrayReceived[1] ); } else { double Pressure = Double.parseDouble(strArrayReceived[1] double PressureResult = Pressure/10; String PressureValue = String.valueOf(PressureResult); webView.sendJavascript("PressureValue = " + Pressure + ";"); webView.sendJavascript("document.getElementById('Pressure').innerHTML = " + PressureValue + ";"); } } this is basically what happens. And this happens every 100ms , and for some reason the displaying of the Value has lag and sometimes the received message (which should be "Pressure,1500" , or a different value) is Pressure,1500Pressure , causing errors (which I've managed to fix). but this still isn't optimal. The message is send correctly and if I use a simple chat app they are received correctly. if there is anyth…
tagged with: java
type: Question
has title: phonegap displaying text in native textbox
score: 0
has comment: http://stackoverflow.com/comment/31560139
has comment: http://stackoverflow.com/comment/31553087
tagged with: android

http://stackoverflow.com/a/21010014
upvote count: 3
answers question: http://stackoverflow.com/q/21009973
score: 3
has comment: http://stackoverflow.com/comment/31577638
has comment: http://stackoverflow.com/comment/31577647
downvote count: 0
type: Answer
has body: You should call setDelay(...) on your timer in its actionPerformed when you want to change its delay time. This is all easily findable in the Timer's API which I suggest that you check out. Regarding your new edit: ?newRandom()?? Don't stop the Timer Choose a reasonable random number for your next time delay. Sometimes this can be as simple as creating an array or ArrayList of delays and randomly selecting one of them. Else you could use a random.nextInt(A + B) - B + 1 to get a random number between A and B.

http://stackoverflow.com/a/20972998
type: Answer
score: 4
has body: Luckily you cannot do that on non-rooted devices now.
upvote count: 4
answers question: http://stackoverflow.com/q/20972911
downvote count: 0

http://stackoverflow.com/comment/31487460
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20961102
type: AnswerComment
has text: I tried that and got the same results. However, I did notice that the problem had gone away (the bogus 634 had returned to 624).

http://stackoverflow.com/comment/31486736
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20960541
has text: Could you try to improve your question? And what does "partly" mean? And maybe describe what you already tried? In it's current format the question is quite likely to be closed, not answered.

http://stackoverflow.com/comment/31383767
has text: I am using Java, Yes Out of those 4 lines im trying to get the pass/fail out then delete them out of the text file
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20907243

apache-tomee
tags question: http://stackoverflow.com/q/20888773
type: Tag
tag name: apache-tomee
tags question: http://stackoverflow.com/q/20856833

http://stackoverflow.com/comment/31575843
comment on: http://stackoverflow.com/q/21008989
has text: Sionnach733: Well, an instance. Isn't that somehow related? I mean name of the instance and the name of the class must be the same, right?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/31539204
type: Comment
has text: I have tried it,still facing the same problem.i am using JAVA_HOME = "C:\Program Files (x86)\Java\jdk1.6.0\jre" is it correct??
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20988072

http://stackoverflow.com/a/21002151
has body: Create a custom ErrorHandler that does nothing import java.io.*; import javax.xml.parsers.*; import org.w3c.dom.*; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; public class FooMain { public static Document slurpXML(String s) throws Exception { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); builder.setErrorHandler(new ErrorHandler() { @Override public void warning(SAXParseException exception) throws SAXException { } @Override public void error(SAXParseException exception) throws SAXException { } @Override public void fatalError(SAXParseException exception) throws SAXException { } }); Document rv = builder.parse(new ByteArrayInputStream(s.getBytes("UTF-8"))); return rv; } public static void main(String args[]) throws Exception { try { slurpXML("foo"); } catch (Throwable e) {} // try to silence it - in vain } }
upvote count: 6
type: AcceptedAnswer
type: Answer
score: 6
accepted answer of: http://stackoverflow.com/q/21001961
answers question: http://stackoverflow.com/q/21001961
downvote count: 0

http://stackoverflow.com/q/21011367
answer count: 1
tagged with: musicbrainz
tagged with: java
accepted answer: http://stackoverflow.com/a/21033702
tagged with: api
type: AnsweredQuestion
score: 2
downvote count: 0
has body: I am trying to use the musicBrainz api for getting the discography of an artist using the following method: http://www.musicbrainz.org/ws/2/release/?query=artist:eminem but i get a lot of unsorted and repeated data. I know that i can use keywords (AND, OR, etc) but i do not really know how to sort it by date or filter repeated data. Is there a way to do this in the rest call or have i to implement these sort methods in my code?
favorite count: 0
type: Question
tagged with: android
has title: Get discography of an artist exactly like the overview page on musicbrainz
has answer: http://stackoverflow.com/a/21033702
upvote count: 2

http://stackoverflow.com/q/20856930
tagged with: url
favorite count: 0
score: 2
linked to: http://stackoverflow.com/q/10116961
has answer: http://stackoverflow.com/a/20857138
has comment: http://stackoverflow.com/comment/31288775
downvote count: 1
possible better answer: http://stackoverflow.com/a/20857416
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20857558
has answer: http://stackoverflow.com/a/20857416
upvote count: 3
tagged with: java
has title: How to Store output of API?
has comment: http://stackoverflow.com/comment/31288804
type: Question
tagged with: api
accepted answer: http://stackoverflow.com/a/20857558
answer count: 3
has body: I am hitting API with this code- public static int hitUrl(String urlToHit) { try { URL url = new URL(urlToHit); HttpURLConnection http = (HttpURLConnection)url.openConnection(); int statusCode = http.getResponseCode(); return statusCode; } catch(Exception e) { e.printStackTrace(); return 0; } } Like this I am getting return value 200. It means I am hitting url successfully. But I have to store output of API. My API returns uniqueId. How can I store the output ?

opennlp
type: Tag
tags question: http://stackoverflow.com/q/20931154
tag name: opennlp

http://stackoverflow.com/q/20896538
score: 5
upvote count: 5
tagged with: eclipse
downvote count: 0
answer count: 1
tagged with: jar
has answer: http://stackoverflow.com/a/20923584
tagged with: proguard
favorite count: 0
type: UnansweredQuestion
tagged with: maven
has title: How to get Proguard to overwrite the original jar with the optimized one?
has body: I'm having trouble trying to get Proguard to overwrite the original jar generated by Maven with Proguard's optimized version. This is a section of my POM.xml: com.github.wvengen proguard-maven-plugin package proguard 4.11 ${project.build.finalName}.jar ${project.build.finalName}.jar -keep class ** -dontskipnonpubliclibraryclasses -dontskipnonpubliclibraryclassmembers ${java.home}/lib/rt.jar ${java.home}/lib/jsse.jar ${java.home}/lib/jce.jar net.sf.proguard proguard-base 4.11 Note these two lines: ${project.build.finalName}.jar ${project.build.finalName}.jar I'm trying to get Proguard to use the original jar as the input and output it to that same jar, but what I get is the original jar being suffixed with "_proguard_base" and the optimized jar being named how it should be. This only happens if the inJar and outJar options are the same. Also, i'm using Eclipse with the Maven plugin for this. Any help is appreciated.
tagged with: java
type: Question

http://stackoverflow.com/q/20871460
has comment: http://stackoverflow.com/comment/31317208
type: Question
linked to: http://stackoverflow.com/q/14608667
has comment: http://stackoverflow.com/comment/31317148
tagged with: hibernate
has comment: http://stackoverflow.com/comment/31317211
has title: How do I map return value from Stored Procedure to my entity class in Hibernate
has comment: http://stackoverflow.com/comment/31317177
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/20871508
has comment: http://stackoverflow.com/comment/31317167
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31317250
has body: How do I map return value from Stored Procedure to my entity class in Hibernate. If selected column is been queried in SP.
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/q/20999631
tagged with: aem
has answer: http://stackoverflow.com/a/21004995
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21017241
upvote count: 1
type: Question
tagged with: sling
tagged with: javascript
answer count: 2
has title: Why does "paragraph reference component" show empty tiles (Geometrixx example)?
downvote count: 0
has body: I use "paragraph reference component" to include pages/subpages. Why does this component show empty tiles (see the attached pic for Geometrixx)? Can it be configured sothat empty tiles not shows?
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/20969794
tagged with: java
has comment: http://stackoverflow.com/comment/31504553
has body: I am new to coding and need help with parsing an XML file using XSLT and providing output in HTML. I have the code below. I need the script name and type which has result="INFORMATION" <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="class.xsl"?> <Property line_number="1"/> <Property script_iter_count="0"/> <Property script_name="DSE.DSEBalanceInquiry_FC.DseBalanceInquiry_FC_Test_003"/> <Property script_id="DSE.DSEBalanceInquiry_FC.DseBalanceInquiry_FC_Test_003.java"/> <Property script_name="DSE.DSEBalanceInquiry_FC.DseBalanceInquiry_FC_Test_003"/> <Property line_number="35"/> <Property script_id="DSE.DSEBalanceInquiry_FC.DseBalanceInquiry_FC_Test_003.java"/> XSLT code: <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="w3.org/1999/XSL/Transform">; <xsl:template match="/"> Type Result <xsl:for-each select="TestLog/Event"> <xsl:value-of select="Type"/> <xsl:value-of select="Result"/> </xsl:for-each> </xsl:template> </xsl:stylesheet>
type: Question
has comment: http://stackoverflow.com/comment/31505151
answer count: 1
has comment: http://stackoverflow.com/comment/31503976
has answer: http://stackoverflow.com/a/20971384
accepted answer: http://stackoverflow.com/a/20971384
score: 0
has title: How to transform an XML file using XSLT
tagged with: http://stackoverflow.com/tag/html
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/31502824
tagged with: xslt
type: AnsweredQuestion

http://stackoverflow.com/q/20857635
score: -3
has comment: http://stackoverflow.com/comment/31290382
has comment: http://stackoverflow.com/comment/31290235
downvote count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31290227
tagged with: java
has body: So i want to extract few characters from a string and then display it on Textview like this: Uri uri = Uri.parse("content://sms/inbox"); Cursor crsr = getContentResolver().query(uri, null, null, null, null); startManagingCursor(crsr); String[] columns = new String[] { "address", "person", "date", "body", "type" }; String address = ""; String msg = ""; ArrayList&lt;String&gt; conversations = new ArrayList&lt;String&gt;(); if (crsr.getCount() &gt; 0) { while (crsr.moveToNext()) { address = crsr.getString(crsr.getColumnIndex(columns[0])); msg = crsr.getString(crsr.getColumnIndex(columns[3])); msg = msg.substring(1, 30) + "..."; // THIS CAUSES FATAL ERROR conversations.add(address + "\n\n" + msg); } } It is pretty simple to use substring but i can't get why it is giving error and showing fatal errors, here is trace: E/AndroidRuntime(14023): FATAL EXCEPTION: main E/AndroidRuntime(14023): java.lang.RuntimeException: Unable to start activity...... E/AndroidRuntime(14023): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2313) E/AndroidRuntime(14023): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2365) E/AndroidRuntime(14023): at android.app.ActivityThread.access$600(ActivityThread.java:156) E/AndroidRuntime(14023): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) E/AndroidRuntime(14023): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime(14023): at android.os.Looper.loop(Looper.java:153) E/AndroidRuntime(14023): at android.app.ActivityThread.main(ActivityThread.java:5336) E/AndroidRuntime(14023): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime(14023): at java.lang.reflect.Method.invoke(Method.java:511) E/AndroidRuntime(14023): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833) E/AndroidRuntime(14023): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) E/AndroidRuntime(14023): at de.robv.android.xposed.XposedBridge…
possible better answer: http://stackoverflow.com/a/20857650
has answer: http://stackoverflow.com/a/20857650
type: Question
answer count: 2
upvote count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/20857655
has title: java substring raising an exception
tagged with: android
has answer: http://stackoverflow.com/a/20857655

http://stackoverflow.com/comment/31406437
score: 0
comment on: http://stackoverflow.com/a/20917799
type: Comment
has text: super. I'll try. Where did you took this from? How can I create a folder if not exist?
type: AnswerComment

http://stackoverflow.com/a/20998569
has comment: http://stackoverflow.com/comment/31570684
answers question: http://stackoverflow.com/q/20980946
type: Answer
has comment: http://stackoverflow.com/comment/31605042
has body: OP- I had a similar issue with a .jar that had a signature in it. Over the last few months java security has become a major PITA with everything needing to be exactly right. In my case I had number of .jar files, some had signatures in them, others didn't. I created a code signing cert for my domain, then wrote a .bat file to strip out the META-INF folder (which contains the manifest file and signatures for the .class files), re-jar the files then sign them. Mine would not work unless I added the lines below (using jar umf change.txt, change.txt being the five lines I have listed below) The first thing (which you have probably already tested, but I will say it anyway) is that you will need to trust the cert. But I think your problem is that you need to add additional lines to the manifest file (before you sign it!). I added these lines to my manifest, signed it using jarsigner and then it worked fine. Codebase: * Permissions: all-permissions Application-Library-Allowable-Codebase: * Caller-Allowable-Codebase: * Application-Name: &lt;my app name&gt; I'm not a Java programmer, so I'm not completely 100% sure why each is needed. But from what I can tell, Java security knows where you called the .jar file from, and if there is a class outside that it won't call it because it exists outside the .jar. By adding the codebase parameters, it says trust anything. You can change it to a specific web address (such as http/https://) to lock it down more specifically. Hope this helps.
score: 0

http://stackoverflow.com/q/21014745
has answer: http://stackoverflow.com/a/21014864
tagged with: java
has body: I'am confused. I'm trying to get an int value: Integer ord = new Double(33 / (-2 * 1.1)).intValue(); Expectation: -15 Output: -14 What's wrong? When I try: Double d = 33 / (-2 * 1.1); Output: -14.999999999999998 Any ideas? Thanks in advance!
accepted answer: http://stackoverflow.com/a/21014815
tagged with: floating-point
has comment: http://stackoverflow.com/comment/31586580
has comment: http://stackoverflow.com/comment/31587080
possible better answer: http://stackoverflow.com/a/21014808
type: Question
upvote count: 4
downvote count: 4
has answer: http://stackoverflow.com/a/21014808
linked to: http://stackoverflow.com/q/1661273
has comment: http://stackoverflow.com/comment/31585825
has comment: http://stackoverflow.com/comment/31585889
has answer: http://stackoverflow.com/a/21014833
answer count: 6
duplicate of: http://stackoverflow.com/q/1661273
score: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21014874
has comment: http://stackoverflow.com/comment/31586042
has comment: http://stackoverflow.com/comment/31585878
tagged with: division
has answer: http://stackoverflow.com/a/21014815
has answer: http://stackoverflow.com/a/21014848
has comment: http://stackoverflow.com/comment/34347792
type: AnsweredQuestion
has title: Division is incorect in java

http://stackoverflow.com/comment/31434219
comment on: http://stackoverflow.com/q/20933583
type: QuestionComment
has text: `Child extends Parent`, right?
score: 0
type: Comment

http://stackoverflow.com/comment/31461999
type: AnswerComment
comment on: http://stackoverflow.com/a/20948283
score: 0
type: Comment
has text: @TheNewIdiot I explained in my last sentence.

http://stackoverflow.com/comment/31317332
type: AnswerComment
comment on: http://stackoverflow.com/a/20870320
has text: I apologise grennis, it is because he said it in a way that made sense to me more and answered my specific quesiton
type: Comment
score: 0

http://stackoverflow.com/q/20967299
tagged with: web-services
has comment: http://stackoverflow.com/comment/31504068
tagged with: java
has title: Getting a connection timed out exception in webservices
has comment: http://stackoverflow.com/comment/31499444
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31502494
has comment: http://stackoverflow.com/comment/31498503
tagged with: wsdl
has comment: http://stackoverflow.com/comment/31498002
has body: I am getting the following exception when I try to submit a request through webservice. The stack trace is as below: Exception in thread "main" com.sun.xml.internal.ws.client.ClientTransportException: HTTP transport error: java.net.ConnectException: Connection timed out: connect at com.sun.xml.internal.ws.transport.http.client.HttpClientTransport.getOutput(HttpClientTransport.java:117) at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:194) at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:122) at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:95) at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:626) at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:585) at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:570) at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:467) at com.sun.xml.internal.ws.client.Stub.process(Stub.java:308) at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:146) at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:98) at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78) at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:129) at $Proxy40.externalSearchPerson(Unknown Source) at com.igniteibroker.Main.personSearch(Main.java:52) at com.igniteibroker.Main.main(Main.java:64) Caused by: java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:69) 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.PlainSocketImpl.connect(Pla…
type: Question
tagged with: exception
has comment: http://stackoverflow.com/comment/31498043
has answer: http://stackoverflow.com/a/20967574
has comment: http://stackoverflow.com/comment/31498129
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/20971978

storage
tag name: storage
tags question: http://stackoverflow.com/q/21005884
tags question: http://stackoverflow.com/q/20991102
type: Tag

http://stackoverflow.com/comment/31494645
score: 0
type: Comment
has text: Clean your workspace 1 or more type. If not resolved try run server in debug mode. This is bug in Eclipse IDE. Sometime it behaves stange.
comment on: http://stackoverflow.com/a/20965214
type: AnswerComment

http://stackoverflow.com/comment/31342067
comment on: http://stackoverflow.com/q/20881532
type: Comment
type: QuestionComment
score: 1
has text: It's pretty simple: your server response does not include the proper CORS headers. This is not a browser bug, and there is no client-side code issue. If you want to get to the bottom of this, trace your server-side code a bit closer to ensure the headers are ALWAYS included in the response. You should start by inserting a proxy between client and server to examine the headers yourself.

http://stackoverflow.com/comment/31417649
type: QuestionComment
has text: That JSON is badly formatted.
score: 0
comment on: http://stackoverflow.com/q/20924965
type: Comment

http://stackoverflow.com/a/20965938
type: Answer
score: 2
downvote count: 0
has body: You will have to use arrays instead of lists initially, but you can easily do a: List&lt;SearchInfo&gt; params = Arrays.asList(myArray); Converting JSON If your parameters are valid JSON, as it seems from your example, it's quite simple to convert into a custom object, see here. Converting something else Otherwise you can create a custom formatter with Spring that will format the Strings that come from your request parameters into your custom objects. Basically you'll have to first create a class that registers the type of objects to format and which class does the formatting: import org.springframework.format.FormatterRegistrar; import org.springframework.format.FormatterRegistry; public class SearchInfoFormatterRegistrar implements FormatterRegistrar { @Override public void registerFormatters(FormatterRegistry registry) { registry.addFormatterForFieldType(SearchInfo.class, new SearchInfoFormatter()); } } Then implement the class doing the formatting (mind you, this is not just casting an object to a different type, you actually have to use some logic): import org.springframework.format.Formatter; public class SearchInfoFormatter implements Formatter&lt;SearchInfo&gt; { @Override public String print(SearchInfo info, Locale locale) { // Format SearchInfo into String here. } @Override public SearchInfo parse(String text, Locale locale) { // Format String into SearchInfo here. } } Finally, you add them into your configuration: &lt;bean name="conversionService" class="org.springframework.format.support.FormattingConversionServiceFactoryBean"&gt; &lt;property name="formatterRegistrars"&gt; &lt;set&gt; &lt;bean class="org.my.SearchInfoFormatterRegistrar" /&gt; &lt;/set&gt; &lt;/property&gt; &lt;/bean&gt;
upvote count: 2
accepted answer of: http://stackoverflow.com/q/20914307
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20914307

http://stackoverflow.com/comment/31367736
comment on: http://stackoverflow.com/q/20898619
type: QuestionComment
type: Comment
score: 2
has text: ItemStateChanged events can be trigger twice as it deals with the deselection of the current value and selection of the new one. This the default behaviour. You need to inspect the state event to determine what type of event it is...

http://stackoverflow.com/comment/31535071
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20986674
score: 0
has text: Your Base64 encode should return a String, shouldn't it?

http://stackoverflow.com/a/20979037
score: 1
answers question: http://stackoverflow.com/q/20977210
has comment: http://stackoverflow.com/comment/52235263
upvote count: 1
type: AcceptedAnswer
has body: So after some fiddling around I figured out a solution to my question by programmatically rendering each gridview and header: Using a basic layout like this (since the number of gridviews needed is unknown): &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;LinearLayout android:id="@+id/appListFragment" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" /&gt; &lt;/ScrollView&gt; And a buildAdapter method in the fragment like so: boolean headerSectionsRendered = false; ... private void buildAdapter() { String gridViewIdString; /* fill the adapter */ for (String category : mApps.keySet()) { /* get all of the apps for current category */ mAppAdapter = new AppsAdapter(getActivity(), mApps.get(category)); /* begin programmatically creating the view */ LinearLayout appListLayout = (LinearLayout) getActivity() .findViewById(R.id.appListFragment); /* create the section header */ TextView appSectionHeader = new TextView(getActivity()); appSectionHeader.setLayoutParams(new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); appSectionHeader.setText(category); LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) appSectionHeader .getLayoutParams(); params.setMargins(15, 8, 15, 5); // left, top, right, bottom appSectionHeader.setLayoutParams(params); appSectionHeader.setTextSize(16); /* create GridView for the current section*/ GridView appSectionGridView = new GridView(getActivity()); appSectionGridView.setLayoutParams(new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); appSectionGridView.setVerticalSpacing(10); appSectionGridView.setHorizontalSpacing(10); appSectionGridView.setNumColumns(3); appSectionGridView.setGravity(Gravity.CENTER); appSectionGrid…
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20977210

http://stackoverflow.com/q/20871795
has comment: http://stackoverflow.com/comment/31318053
has comment: http://stackoverflow.com/comment/31318081
answer count: 3
has comment: http://stackoverflow.com/comment/31318096
has comment: http://stackoverflow.com/comment/31318070
has comment: http://stackoverflow.com/comment/31318011
has answer: http://stackoverflow.com/a/20871834
has comment: http://stackoverflow.com/comment/31318573
has answer: http://stackoverflow.com/a/20872287
has comment: http://stackoverflow.com/comment/31318663
favorite count: 0
has comment: http://stackoverflow.com/comment/31318456
has comment: http://stackoverflow.com/comment/31318207
has comment: http://stackoverflow.com/comment/31318542
accepted answer: http://stackoverflow.com/a/20872287
upvote count: 1
has title: NullpointerException in reading file with java
downvote count: 1
has answer: http://stackoverflow.com/a/20872081
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31317816
score: 0
has comment: http://stackoverflow.com/comment/31318530
tagged with: java
tagged with: file
possible better answer: http://stackoverflow.com/a/20872081
has comment: http://stackoverflow.com/comment/31318043
has comment: http://stackoverflow.com/comment/31318152
type: Question
linked to: http://stackoverflow.com/q/14089146
has comment: http://stackoverflow.com/comment/31318055
has comment: http://stackoverflow.com/comment/31318132
has comment: http://stackoverflow.com/comment/31318118
has body: I have this constructor, that mentioned to read an xls file in order to be manipulated by JXCEL API. Fill(String file, int sheet, int cols, int rows) { vService = new VipServiceImpl(); java.net.URL url = this.getClass().getResource("vips.xls"); System.out.println(url); //This gave me null File f; try { f = new File(url.toURI()); } catch (URISyntaxException e) { f = new File(url.getPath()); } excelHandler = new ExcelHandler(f, sheet, cols, rows); } I have to mention that i have put the file vips.xls in the same directory as Fill class file, but it gives me a null pointer exception on the line of new File(url.toURI()); UPDATE: I really do now the difference between the classpath and filesystem path:(
has comment: http://stackoverflow.com/comment/31317982
has comment: http://stackoverflow.com/comment/31318026

http://stackoverflow.com/comment/31529072
score: 0
comment on: http://stackoverflow.com/q/20983278
has text: Looks like you know what you are doing so please forgive the stupid questions... Is your activity recreated on orientation change? Will you post the ListActivity you are testing this on?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21007730
has comment: http://stackoverflow.com/comment/31575685
type: Answer
has comment: http://stackoverflow.com/comment/31575257
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/21006718
has body: When it comes to JSON processing, string manipulation only works in special and simple cases. For the general case, a good JSON parser library should be used. Jackson is among the top of such libraries in terms of performance, efficiency, versatility and reliability, plus it is published under the commercial-friendly Apache 2.0 license. Following is a simple implementation of the requested answer in Jackson. public static void main(String[] args) { String ss = "{\"description\":\"Some Text\", \"machinename\":\"machineA\", \"ipaddress\":\"192.128.0.0\"}"; System.out.println("JSON string before: " + ss); try { ObjectMapper mapper = new ObjectMapper(); Map<String, String> map = (Map<String, String>)mapper.readValue(ss, Map.class); map.put("version", "v3"); ss = mapper.writeValueAsString(map); } catch (Exception e) { e.printStackTrace(); } System.out.println("JSON string after: " + ss); }

http://stackoverflow.com/a/20874242
has comment: http://stackoverflow.com/comment/31360514
has comment: http://stackoverflow.com/comment/31327422
answers question: http://stackoverflow.com/q/20869779
has comment: http://stackoverflow.com/comment/31330814
has body: use this pattern (?!Sir|Miss)([A-Z][a-z]+) (?!(?:Mrs|Mr|No)\.)([A-Z][a-z]+) and replace w/ $1-$2 Demo (?!Sir|Miss) list of special words to ignore ([A-Z][a-z]+) word starting with upper case letter ' ' followed by a space (?!(?:Mrs|Mr|No)\.) list of special dot-ending words ([A-Z][a-z]+) followed by a word starting with upper case letter per the modified request in the comment below (?!Sir|Miss)([A-Z][a-z]+) (?!(?:Mrs|Mr|No)\.)(?=[A-Z][a-z]+) and replace w/ $1- Demo
score: 0
type: Answer

http://stackoverflow.com/comment/37283407
has text: The pattern suggested above is a bit too greedy when making replacements – '11x' becomes '1*1*x'. I removed the numbers in the second part of the pattern, and it now works fine for all the cases I've tried. (Is there a purpose for those numbers that I haven't though of?) Changing the comment/example to this: `([0-9]+|[a-z\\)])(?=[a-z\\(])`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20912733
type: Comment

http://stackoverflow.com/a/20967643
has body: there is a new example on the imcache project about spring configuration. Check it out at imcache spring configuration example. Its name is SpringConfigurationExample.java
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/20967587
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20967587
type: Answer

http://stackoverflow.com/q/20922285
score: 1
tagged with: java
tagged with: noclassdeffounderror
accepted answer: http://stackoverflow.com/a/20922321
type: Question
answer count: 2
tagged with: apache
downvote count: 0
has answer: http://stackoverflow.com/a/20922390
has answer: http://stackoverflow.com/a/20922321
has body: I get a NoClassDefFoundError exception for org/apache/commons/math/linear/SingularMatrixException. Does anybody know what JAR file I need in order to resolver this? I tried adding 'commons-math3-3.2.jar' to my project's Java Build Path, but that didn't help. Or is there something else that I am missing in my project settings? Thanks
upvote count: 1
favorite count: 0
has title: Java class SingularMatrixException not found
has comment: http://stackoverflow.com/comment/31412540
possible better answer: http://stackoverflow.com/a/20922390
type: AnsweredQuestion

http://stackoverflow.com/a/20857285
has body: Good question. My initial answer here was not correct, even though it received 5 upvotes. Answer rewritten after spending some time after wrong leads in Android libcore sources. Your code is correct and the trailing slash is not significant. File constructor removes any trailing slashes anyway. (See fixSlashes() called by init() in the sources.) Reasons that could explain why the directory was not created: Your app did not have the WRITE_EXTERNAL_STORAGE permission. The code was not run. It's in a static initializer. You'll have to e.g. instantiate the class so that the class loader loads it and the static initializer is run.
downvote count: 1
answers question: http://stackoverflow.com/q/20857252
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/31291291
score: 3
has comment: http://stackoverflow.com/comment/31290199
has comment: http://stackoverflow.com/comment/31289627
has comment: http://stackoverflow.com/comment/31289781
has comment: http://stackoverflow.com/comment/31293265

http://stackoverflow.com/comment/31413369
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20922621
has text: @CodeLover: I seated min and max api versions as 7 and 18 yet. Or there somting else what i not do?
score: 0

http://stackoverflow.com/a/20918402
accepted answer of: http://stackoverflow.com/q/20918359
upvote count: 1
type: AcceptedAnswer
has body: This is my code for upload, and it's work. You need import httpmime jar PHP code $uploads_dir = '/Library/WebServer/Documents/Upload/upload/'.$_FILES['userfile']['name']; if(is_uploaded_file($_FILES['userfile']['tmp_name'])) { echo $_POST["contentString"]."\n"; echo "File path = ".$uploads_dir; move_uploaded_file ($_FILES['userfile'] ['tmp_name'], $uploads_dir); } else { echo "\n Upload Error"; echo "filename '". $_FILES['userfile']['tmp_name'] . "'."; print_r($_FILES); JAVA code HttpClient client = new DefaultHttpClient(); HttpPost postMethod = new HttpPost("http://localhost/Upload/index.php"); File file = new File(filePath); MultipartEntity entity = new MultipartEntity(); FileBody contentFile = new FileBody(file); entity.addPart("userfile",contentFile); StringBody contentString = new StringBody("This is contentString"); entity.addPart("contentString",contentString); postMethod.setEntity(entity); HttpResponse response = client.execute(postMethod); HttpEntity httpEntity = response.getEntity(); String state = EntityUtils.toString(httpEntity);
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20918359

http://stackoverflow.com/q/20967440
has comment: http://stackoverflow.com/comment/31498346
tagged with: prepared-statement
type: Question
has body: I have a basic connection to an oracle database, I getting back the first two print statements i.e connecting to the database and reading back the query which is to be inserted but I'm not reaching line updateQuery = statement.executeUpdate(); and therefore the statement isn't executed. I'm getting no error and I have the ojdbc driver downloaded, any suggestions ? import java.sql.DriverManager; import java.sql.Connection; import java.sql.SQLException; import java.sql.PreparedStatement; public class conn1 { public static void main(String[] argv) { //Scanner out = new Scanner(String); //In Java, we use plain JDBC calls to insert a record in STUDENTS table. We use sequence STUDENT_SEQ to generate primary key. //Once the record is inserted, we want the last inserted primary value. PreparedStatement statement = null; int updateQuery = 0; String QUERY = "INSERT INTO SYS.STUDENTS (student_id, NAME, EMAIL, BIRTH_DATE)" + "VALUES ('1','Hermoine', 'Hermoine@hogwarts.edu', '08-Nov-1987')"; // load oracle driver try { Class.forName("oracle.jdbc.driver.OracleDriver"); } catch (ClassNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } // get database connection from connection string Connection connection = null; try { connection = DriverManager.getConnection( "jdbc:oracle:thin:@localhost:1521:attendanced", "louise", "Attend123!"); } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } if (connection != null) { System.out.println("Successfullly connected to Oracle DB"); try { statement = connection.prepareStatement(QUERY); System.out.println("Insert This Query :" + QUERY); updateQuery = statement.executeUpdate(); //Erroneous line. if (updateQuery != 0) { System.out.println("Record inserted successfully"); } else { System.out.println("Error, Record not inserted"); } } catch (SQLException e) { e.printStackTrace(); } } else { System.out.println("Failed to connect to Oracle DB"); } } }
has comment: http://stackoverflow.com/comment/31503580
has comment: http://stackoverflow.com/comment/31499068
tagged with: database
has comment: http://stackoverflow.com/comment/31498684
has comment: http://stackoverflow.com/comment/31499223
downvote count: 0
has comment: http://stackoverflow.com/comment/31499170
has comment: http://stackoverflow.com/comment/31499578
favorite count: 0
has comment: http://stackoverflow.com/comment/31503052
has comment: http://stackoverflow.com/comment/31499570
has comment: http://stackoverflow.com/comment/31499671
has comment: http://stackoverflow.com/comment/31499437
type: UnansweredQuestion
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/31499351
answer count: 0
has comment: http://stackoverflow.com/comment/31498354
score: 1
tagged with: java
has title: Oracle database connection via Java
upvote count: 1
has comment: http://stackoverflow.com/comment/31499185

http://stackoverflow.com/comment/31321380
has text: That's good idea and i'm going to use it! But i'm curious if there is another more appropriate way to do this!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20873512
type: Comment

http://stackoverflow.com/comment/31415887
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20923686
has text: What scope is `#{admin.customerList}`?

http://stackoverflow.com/q/20861476
score: -2
has answer: http://stackoverflow.com/a/20861537
has title: Sorting a matrix by rows in java
answer count: 3
accepted answer: http://stackoverflow.com/a/20861638
upvote count: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/20861506
has comment: http://stackoverflow.com/comment/31297945
has answer: http://stackoverflow.com/a/20861638
has body: I have to get a matrix with rows sorted (descending) like sortrows function in matlab. A = 95 45 92 41 13 1 84 95 7 73 89 20 74 52 95 7 73 5 19 44 20 95 7 40 35 60 93 67 76 61 93 81 27 46 83 76 79 91 0 19 41 1 to B = 76 61 93 81 27 46 83 76 79 91 0 19 41 1 95 7 40 35 60 93 67 95 7 73 5 19 44 20 95 7 73 89 20 74 52 95 45 92 41 13 1 84 I am using JAMA which not contains a method like sortrows in matlab. Which is the fastest way of doing this?
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/20861506
type: Question
type: AnsweredQuestion

http://stackoverflow.com/q/20873144
tagged with: http
type: Question
linked to: http://stackoverflow.com/q/16098293
has comment: http://stackoverflow.com/comment/31321342
has comment: http://stackoverflow.com/comment/31320697
has comment: http://stackoverflow.com/comment/31320673
has comment: http://stackoverflow.com/comment/31321367
score: 0
has body: I'm hoping someone can help figure this out. I've got a problem trying to run some backend php code from java that extracts sql data and sends it back via gson. I've used posting from java to php and inserting it into mysql database as a model, but, I can't seem to get beyond the HTTP 400 response code that is returned. I've edited the following java console to remove identifying names, but, the context should remain the same. security: JSS is not configured network: Connecting https://secure.justhost.com/&lt;server&gt;/&lt;folder&gt;/&lt;php program name&gt;.php with proxy=DIRECT network: Cache entry not found [url: http://secure.justhost.com:443/crossdomain.xml, version: null] network: Connecting http://secure.justhost.com:443/crossdomain.xml with proxy=DIRECT network: Connecting http://secure.justhost.com:443/ with proxy=DIRECT java.io.IOException: Server returned HTTP response code: 400 for URL: http://secure.justhost.com:443/crossdomain.xml at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at com.sun.deploy.net.CrossDomainXML.check(Unknown Source) at com.sun.deploy.net.CrossDomainXML.check(Unknown Source) at sun.plugin2.applet.SecurityManagerHelper.checkConnectHelper(Unknown Source) at sun.plugin2.applet.AWTAppletSecurityManager.checkConnect(Unknown Source) at sun.net.www.http.HttpClient.openServer(Unknown Source) at sun.net.www.protocol.https.HttpsClient.&lt;init&gt;(Unknown Source) at sun.net.www.protocol.https.HttpsClient.New(Unknown Source) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at java.net.HttpURLConnection.getResponseCode(Unknown Source) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source) at newpost…
has comment: http://stackoverflow.com/comment/31320716
has comment: http://stackoverflow.com/comment/31320914
linked to: http://stackoverflow.com/q/213251
type: UnansweredQuestion
tagged with: php
has title: Java calls php to retrieve SQL data
answer count: 0
tagged with: java
tagged with: mysql

http://stackoverflow.com/comment/31545849
type: QuestionComment
comment on: http://stackoverflow.com/q/20993262
has text: You have a small error: in `Container` items is a `OneToMany`, not a `OneToOne`.
score: 0
type: Comment

http://stackoverflow.com/q/20995005
linked to: http://stackoverflow.com/q/19209650
has title: Having trouble displaying graphics in Swing
type: AnsweredQuestion
tagged with: java
tagged with: image
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/20995544
has body: I've been trying to visually simulate a traffic problem, but for some reason I get only blank output in my swing window. Instead of a constantly-moving picture with vehicles, I get only a grey screen. My drawing class looks as follows: import java.awt.Graphics; import java.awt.image.BufferedImage; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.JPanel; public class RoadNetwork extends JPanel { BufferedImage tempicon = ImageIO.read(getClass().getResource("Truck.png")); BufferedImage truckicon = new BufferedImage(tempicon.getWidth(), tempicon.getHeight(), BufferedImage.TYPE_INT_ARGB); public RoadNetwork() throws IOException { repaint(); } protected void paintComponent (Graphics g) { super.paintComponent(g); g.clearRect(0, 0, 600, 600); // insert window size parameters here for (int i = 0; i &lt; AMEC.vehiclecounter; i++) { if (AMEC.vehicle[i].spawned == true &amp;&amp; AMEC.vehicle[i].finished == false) { // if the truck is somewhere on the plant g.drawImage(truckicon, AMEC.getcoord(i)[0], AMEC.getcoord(i)[1], this); } } g.drawImage(truckicon, 100, 100, this); } } The call to the class in my main function is done as follows: RoadNetwork roadnetwork = new RoadNetwork(); roadnetwork.setVisible(true); JFrame frame = new JFrame(); frame.add(roadnetwork); frame.setSize(600, 600); frame.setVisible(true); Then, with every iteration of my simulation, I call roadnetwork.repaint(); What am I missing?
possible better answer: http://stackoverflow.com/a/20995544
score: 0
has answer: http://stackoverflow.com/a/20995231
accepted answer: http://stackoverflow.com/a/20995231
tagged with: embedded-resource
has comment: http://stackoverflow.com/comment/31549261
tagged with: swing

http://stackoverflow.com/a/20898993
answers question: http://stackoverflow.com/q/20898983
score: 5
upvote count: 5
downvote count: 0
has body: You should better use SimpleDateFormat with setLenient(false); to validate your date string
type: Answer

http://stackoverflow.com/a/68226398
has body: document.add(new Chunk(&quot;&quot;)); worked for me after document.open(); when the data is not there in the report text.
upvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20898322
score: -1
downvote count: 1

http://stackoverflow.com/q/20988153
has comment: http://stackoverflow.com/comment/31537590
type: Question
has answer: http://stackoverflow.com/a/20988290
has answer: http://stackoverflow.com/a/21081824
linked to: http://stackoverflow.com/q/10083447
tagged with: javascript
tagged with: applet
score: 0
possible better answer: http://stackoverflow.com/a/20988279
answer count: 5
has comment: http://stackoverflow.com/comment/31537433
tagged with: file-upload
has comment: http://stackoverflow.com/comment/31537533
linked to: http://stackoverflow.com/q/2809688
has answer: http://stackoverflow.com/a/21155328
tagged with: file
has body: I would like to create a file destination chooser as like choosing save destination of download file from browser. But I have no idea how to figure it out. I want to create some files and save them at a place that choose from user. Similar with create new Java Class in Eclipse IDE and browser for source folder. I had found many File-Uploaders but these were browse for specific files not folders. Any suggestions for my problem? I would really appreciate your suggestions. Especially I am more prefer creating with Java (but not swing because I am creating web project) but I can also used by JavaScript or some other useful libs.
has title: File Destination Chooser
has answer: http://stackoverflow.com/a/21141511
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20988279
accepted answer: http://stackoverflow.com/a/21081824
tagged with: java

http://stackoverflow.com/comment/31467439
type: AnswerComment
comment on: http://stackoverflow.com/a/20951019
has text: Hey, thanks for answering! My problems still occur after doing this change. http://pastebin.com/M66knfF3
score: 0
type: Comment

http://stackoverflow.com/q/21007416
answer count: 3
tagged with: sql
has comment: http://stackoverflow.com/comment/31572794
has title: Update SQL using GET request in Java
has answer: http://stackoverflow.com/a/21007805
type: UnansweredQuestion
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/21045086
type: Question
has answer: http://stackoverflow.com/a/21065532
has body: I'm trying to update a sql database in java, but it only works in navigators. I am using a GET request for that, because the hosting doesn't allow me to activate the sql remote access. This is the java function: public static void insertScore(String user, boolean win){ URL url; HttpURLConnection connection=null; try { url = new URL("http://mypage/insert.php?user="+user+"&amp;win="+win); connection = (HttpURLConnection)url.openConnection(); connection.setRequestMethod("GET"); connection.connect(); } catch (MalformedURLException ex) { Logger.getLogger(SQL.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(SQL.class.getName()).log(Level.SEVERE, null, ex); } } And the insert.php file, this file it's ok, but if it helps you: &lt;?php if($_GET["win"]=='true'){ $sql="UPDATE Score SET `Win` = `Win` +1 WHERE `User` = '".$_GET['user']."'"; } else{ $sql="UPDATE Score SET `Lose` = `Lose` +1 WHERE `User` = '".$_GET['user']."'"; } $link = mysqli_connect('myhost','myuser','mypassword','mydb'); //everything ok here if (!$link) { die('Error: ' . mysql_error()); } $result=$link-&gt;query($sql); ?&gt; When I paste the link in safari http://mypage/insert.php?user=Steve&amp;win=true the Sql database updates correctly, but I don't how to do this using Java, it doesn't update anything in the database...
has comment: http://stackoverflow.com/comment/31572858
tagged with: get
score: 0

http://stackoverflow.com/a/20943189
has comment: http://stackoverflow.com/comment/31453551
type: Answer
score: 2
upvote count: 2
has body: this is how to identify a leap year for Gregorian calendar if ((y % 4 == 0 &amp;&amp; y % 100 !=0) || y % 400 == 0) { ... see http://en.wikipedia.org/wiki/Leap_year
answers question: http://stackoverflow.com/q/20943153
downvote count: 0
has comment: http://stackoverflow.com/comment/31453492

http://stackoverflow.com/q/20894938
type: Question
tagged with: java
has body: Previously i have posted question regarding inner join into multiple table. and most probably the SQL inner join code is not a problem. rsTry = stmtTry.executeQuery( "SELECT * FROM (User Inner Join CPU On User.SN = CPU.SN) Inner Join Software on CPU.SN = Software.SN"); Here is the code to store in database rsTry.moveToInsertRow(); rsTry.updateString(1, jtfSN.getText()); rsTry.updateString(2, jtfName.getText()); rsTry.updateString(3, jtfDepartment.getText()); rsTry.updateString(4, jtfHostname.getText()); rsTry.updateString(5, jtfModel.getText()); rsTry.updateString(6, jtfBrand.getText()); rsTry.updateString(9, jtfMsOffice.getText()); rsTry.updateString(10, jtfMsVisio.getText()); rsTry.insertRow(); My table Design User - SN | Name | Department CPU - Hostname | Model | Brand | SN S/w - SN | MsOffice | MsVisio i have no problem with inner join 2 tables and manage to update data as well. but when inner join 3 tables once i try to submit the data it will pop out ava.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in JOIN operation. at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6964) at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7121) at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3117) at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:337) at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:252) at testing.NewJFrame.testingJoint(NewJFrame.java:64) at testing.NewJFrame.actionPerformed(NewJFrame.java:40) 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:6505) at javax.swing.JComponent.pr…
answer count: 1
tagged with: ms-access
score: 0
has title: Inner Join mutiple tables with error in row when input data - Java
has comment: http://stackoverflow.com/comment/31455247
has comment: http://stackoverflow.com/comment/31362036
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21010075

http://stackoverflow.com/comment/31529216
type: AnswerComment
score: 0
type: Comment
has text: Catching it clears the flag, yes @millimoose. http://stackoverflow.com/questions/4906799/why-invoke-thread-currentthread-interrupt-when-catch-any-interruptexception
comment on: http://stackoverflow.com/a/20983626

http://stackoverflow.com/comment/31458046
has text: " it seems you want to print even number in the list" .. Quite frankly, he isn't telling what exactly he wants... Not your mistake.. :)
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20946154

http://stackoverflow.com/comment/31319318
type: AnswerComment
comment on: http://stackoverflow.com/a/20872246
type: Comment
score: 1
has text: @JonSkeet Yes, your right here. Voted your answer up :)

jboss6.x
tag name: jboss6.x
tags question: http://stackoverflow.com/q/20851629
type: Tag
tags question: http://stackoverflow.com/q/20946037
tags question: http://stackoverflow.com/q/20916771
tags question: http://stackoverflow.com/q/20944650
tags question: http://stackoverflow.com/q/21000682

http://stackoverflow.com/q/20969184
has comment: http://stackoverflow.com/comment/31501469
score: 1
tagged with: java
type: Question
upvote count: 2
linked to: http://stackoverflow.com/q/17027777
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/31501541
favorite count: 0
type: UnansweredQuestion
has body: Why always override hashcode() if overriding equals()? Give me an example..
has title: HashCode and Equals method in Java object
has comment: http://stackoverflow.com/comment/31501584
has answer: http://stackoverflow.com/a/20969209
duplicate of: http://stackoverflow.com/q/1990734

http://stackoverflow.com/q/20878221
has comment: http://stackoverflow.com/comment/31330096
has body: What are alternatives to @Autowire for static fields? I went through many questions and understood why @Autowired can't be used with static fields. The accepted answer of this question mentions You'll have to write your own logic to do this., as @Autowired cannot be used. As I am new to dependency injection, I did not get what steps would have to be followed to write our own logic to do this. What I got is that new cannot be used to create the object as it would tightly couple the 2 classes and DI is meant to be a solution for it. Also using @autowired with setters is not recommended in the second answer of the same question. So what are the alternatives to achieve same effect without using @Autowire ?
favorite count: 0
has answer: http://stackoverflow.com/a/24162445
linked to: http://stackoverflow.com/q/1018797
has answer: http://stackoverflow.com/a/20878500
tagged with: spring
tagged with: autowired
answer count: 4
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31330150
has title: Alternatives to @Autowire for static fields
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/37293830
possible better answer: http://stackoverflow.com/a/24162445
has answer: http://stackoverflow.com/a/20878964
accepted answer: http://stackoverflow.com/a/20878964
has answer: http://stackoverflow.com/a/49800772
score: 4
downvote count: 0

http://stackoverflow.com/comment/31526517
type: Comment
type: QuestionComment
has text: If you want to parse them as hexadecimal numbers, just precise the radix. `Integer.parseInt(lblSeatNo.getText(),16);`, otherwise it will use the default radix which is 10.
score: 3
comment on: http://stackoverflow.com/q/20982283

http://stackoverflow.com/a/21106289
type: AcceptedAnswer
score: 0
type: Answer
has body: Base on current research, we found that compare is incorrect, because it not follow A>B &amp;&amp; B>C then A>C e.g: A Load 8, Event 10. B Load 2, Event 8 C Load 1, Event 10; A&gt;B true; B&gt;C true; A&gt;C false A=C; That why failed.
accepted answer of: http://stackoverflow.com/q/20991339
answers question: http://stackoverflow.com/q/20991339

http://stackoverflow.com/comment/31573284
comment on: http://stackoverflow.com/q/21007613
score: 1
has text: @Emmanuel, that kind of comment can be posted beneath any question on stackoverflow.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31312283
type: AnswerComment
score: 0
has text: @user987339 he cannot, 14 is one point short for the upvote priviledge, I'll put him at 19, its the new year :)
type: Comment
comment on: http://stackoverflow.com/a/20858484

http://stackoverflow.com/q/20916776
tagged with: binary-search-tree
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31402808
tagged with: java
type: Question
tagged with: algorithm
has answer: http://stackoverflow.com/a/20916834
answer count: 2
has body: Here is one implementation of the remove method for BST. I quote from there: Removing an element from a search tree, although tricky, is conceptually straight-forward with one (common) exception: removing the element at a node with two non-null children. In this case, the solution is either: removeMax: remove the maximum (rightmost) node from the left subtree and replace the root's value with the value of the removed node. removeMin: remove the minimum (leftmost) node from the right subtree and replace the root's value with the value of the removed node. In either case the search tree's order structure is preserved. If you look at this binary tree, I want to remove 8 and if I choose to pick element from leftTree, using removeMax, I will choose 7 according to the above definition. but I need to choose 13 from right Tree using removeMin and that breaks the BST. am I not understanding this correctly? The way remove works is getting the either the maximum from the leftTree or minimum from the rightTree and replace the node to be removed with its data.
upvote count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/20916838
possible better answer: http://stackoverflow.com/a/20916834
has comment: http://stackoverflow.com/comment/31402875
has title: remove method implementation for binary search tree in Java?
has answer: http://stackoverflow.com/a/20916838
type: AnsweredQuestion

http://stackoverflow.com/a/20928073
upvote count: 3
has body: Uncheck "Organize imports" from Save Actions. But I'm afraid that if the import is deleted, it's because you don't have that class on your classpath. So, you'll have to check that as well.
downvote count: 0
answers question: http://stackoverflow.com/q/20928056
type: Answer
score: 3

http://stackoverflow.com/q/20872513
favorite count: 0
has comment: http://stackoverflow.com/comment/31319800
has answer: http://stackoverflow.com/a/20872600
tagged with: version
downvote count: 1
tagged with: ubuntu-12.04
upvote count: 0
has comment: http://stackoverflow.com/comment/31319397
has answer: http://stackoverflow.com/a/20875186
accepted answer: http://stackoverflow.com/a/20875186
has title: Tomcat 7 failing to load class due to unsupported class version exception, but java version seems correct (Ubuntu)
has answer: http://stackoverflow.com/a/20872626
possible better answer: http://stackoverflow.com/a/20872600
has body: I'm chasing a mystery issue and could use an extra pair of eyes.. I must be missing something! I have an war application that is built with source level 1.7. When I deploy it to a Tomcat 7 running on Ubuntu x64, I get an exception in the logs: INFO: Deploying web application archive /var/lib/tomcat7/webapps/develop-status.war Jan 1, 2014 11:14:08 AM org.apache.catalina.core.ContainerBase addChildInternal SEVERE: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/develop-status]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895) ... at java.lang.Thread.run(Thread.java:701) Caused by: java.lang.UnsupportedClassVersionError: com/specktro/orchid/deployment/monitor/DeploymentMonitorServletContextListener : Unsupported major.minor version 51.0 (unable to load class com.specktro.orchid.deployment.monitor.DeploymentMonitorServletContextListener) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2840) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1160) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1668) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1546) at org.apache.catalina.startup.WebAnnotationSet.loadClassAnnotation(WebAnnotationSet.java:144) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:73) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:56) at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:381) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:858) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:345) at or…
has comment: http://stackoverflow.com/comment/31319447
tagged with: tomcat7
type: AnsweredQuestion
tagged with: java
score: -1
type: Question
answer count: 3
tagged with: java-7

http://stackoverflow.com/q/21001183
has answer: http://stackoverflow.com/a/41877297
has comment: http://stackoverflow.com/comment/31567816
has comment: http://stackoverflow.com/comment/31560569
has comment: http://stackoverflow.com/comment/31561212
score: 0
has title: Selenium simple Click operation
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31584662
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31560779
downvote count: 1
tagged with: selenium-webdriver
tagged with: java
tagged with: selenium
upvote count: 1
has body: I use Selenium IDE, the operation is : "Click" locator: "//*[@panel-id='3']" Then I transform code to Java I get: Selenium selenium; selenium.click("//*[@panel-id='3']"); As result i get exception " Element is not currently visible " selenium.isVisible("//*[@panel-id='3']"); respond exception too; Where is problem?
has comment: http://stackoverflow.com/comment/31560800
type: Question

http://stackoverflow.com/comment/73854266
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20958144
has text: Here was the answer given to this question: http://sonarqube-archive.15.x6.nabble.com/Sonar-maven-plugin-never-ending-for-Java-file-gt-100-kb-td5020713.html

http://stackoverflow.com/a/21000513
has body: Why don't you have a private List&lt;WrappedGameProfile&gt; text = new ArrayList&lt;WrappedGameProfile&gt;(); public List&lt;WrappedGameProfile&gt; getText() { return text; } in your super class? than your code will be : public int getServerInfoSize(){ return getText().size(); } and please do camelcasing correct, the variable Text has to be text.
type: Answer
has comment: http://stackoverflow.com/comment/31559370
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/31561268
answers question: http://stackoverflow.com/q/21000390
has comment: http://stackoverflow.com/comment/31559787
has comment: http://stackoverflow.com/comment/31559473
downvote count: 0

http://stackoverflow.com/comment/31619891
type: Comment
type: QuestionComment
has text: Please post what exception you are getting.
comment on: http://stackoverflow.com/q/20885361
score: 0

http://stackoverflow.com/q/21015238
answer count: 1
score: 0
tagged with: url
tagged with: google-api
linked to: http://stackoverflow.com/q/9071568
has title: How to get snippet for an URL?
type: AnsweredQuestion
has body: I have an URL, how can I get a description for this website (like snippets returned by Google) in Java. Is this possible with the Google API or Bing API? HttpClient gives metadata, but we can't get the description of the website.
tagged with: java
tagged with: bing-api
tagged with: code-snippets
type: Question
has answer: http://stackoverflow.com/a/21015544
accepted answer: http://stackoverflow.com/a/21015544

http://stackoverflow.com/comment/31572315
score: 1
has text: Did you load your MySQL driver by calling: `Class.forName("com.mysql.jdbc.Driver");`?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21007204

http://stackoverflow.com/comment/31304776
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20864139
has text: [last in first out](http://en.wikipedia.org/wiki/LIFO_%28computing%29), I meant :/.
type: Comment

http://stackoverflow.com/q/20914187
type: Question
linked to: http://stackoverflow.com/q/4924131
has answer: http://stackoverflow.com/a/20914440
has body: I have an application that displays a list of photo albums and then, once an album is selected, displays photos in that album. I am using the memory cache/disk cache implementation from one of the google examples (since the photos are loaded from a website). Everything is working fine, but the disk cache initialization takes place every time an album is chosen, and the initialization takes considerable amount of time. I'd like to declare the disk cache "globally" and use it for all albums. I am not an expert in Java and not clear how to do this, particularly that various activities are being called and I can't just pass a reference to the cache when switching from one activity to another. Should the entire caching logic be build as a "service" and then "called" upon on as needed basis? Or is there a different and/or better/more elegant way of doing this? Thank You,
upvote count: 1
tagged with: android
answer count: 1
tagged with: global
favorite count: 0
has comment: http://stackoverflow.com/comment/31399743
type: AnsweredQuestion
has title: How to declare a resource globally in Android
downvote count: 0
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/20914440
tagged with: global-variables
tagged with: caching

http://stackoverflow.com/comment/31558001
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/20999591
has text: Alright I agree , but what if I say that most of the demo code(Python)of GAE that I am using in my application is not available in Java and I am having hard time to implement the Google App Engine Apis in Java?

http://stackoverflow.com/q/20977448
has comment: http://stackoverflow.com/comment/31516961
type: Question
has comment: http://stackoverflow.com/comment/31516927
score: 0
upvote count: 1
has title: How To Access An Array In A NetBeans Class From A JSP Page?
tagged with: arrays
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/31517014
tagged with: javabeans
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31516968
has answer: http://stackoverflow.com/a/21036047
has body: I have a Java class that has an array in it. I need to iterate over the array in the JSP page. How is that done? The class is: package beans; import java.io.Serializable; public class voteDB implements Serializable{ private static final long serialVersionUID = 1L; public sesion[] Users = new sesion[4];{ Users[0] = new sesion("John", 1234); Users[1] = new sesion("Paul", 2345); Users[2] = new sesion("Ringo", 3456); Users[3] = new sesion("George", 4567); } } and the JSP page is: <%@page import="beans.voteDB"%> <%@page import="beans.sesion"%> <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> Insert title here Bienvenido! <% String UsuarioIn="", ContrasenaIn=""; if (request.getParameter("usuario") != null){ UsuarioIn = request.getParameter("usuario"); } if (request.getParameter("contrsena") != null){ ContrasenaIn = request.getParameter("contrsena"); } %> <jsp:useBean id="sesionActual" class="beans.sesion" scope="session"/> <jsp:setProperty name="sesionActual" property="usuario" value="<%=UsuarioIn %>"/> <jsp:setProperty name="sesionActual" property="contrasena" value="<%=ContrasenaIn %>"/> Nombre: <jsp:getProperty property="usuario" name="sesionActual"/> Contrseña: <jsp:getProperty property="contrasena" name="sesionActual"/>
has comment: http://stackoverflow.com/comment/31516950
has comment: http://stackoverflow.com/comment/31516987
tagged with: java
has comment: http://stackoverflow.com/comment/31517306
downvote count: 1

http://stackoverflow.com/q/20898983
possible better answer: http://stackoverflow.com/a/20898993
favorite count: 0
has body: I am reading from a file containing lines in the format YYYYMMDD. How can I use regular expressions to check the validity of these lines? Thank you. The application is a Java application.
linked to: http://stackoverflow.com/q/8647893
answer count: 5
tagged with: datetime
linked to: http://stackoverflow.com/q/2149680
tagged with: regex
has answer: http://stackoverflow.com/a/20899090
has answer: http://stackoverflow.com/a/20899039
has title: Java regular expression - YYYYMMDD
has comment: http://stackoverflow.com/comment/31368256
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: date
has answer: http://stackoverflow.com/a/20899034
accepted answer: http://stackoverflow.com/a/20899034
has answer: http://stackoverflow.com/a/20899279
upvote count: 2
duplicate of: http://stackoverflow.com/q/2149680
has answer: http://stackoverflow.com/a/20898993
downvote count: 1

android-viewpager
tag name: android-viewpager
tags question: http://stackoverflow.com/q/20967852
type: Tag
tags question: http://stackoverflow.com/q/20957311

http://stackoverflow.com/comment/31398800
type: AnswerComment
score: 0
has text: so to fix my errors I should use indexOf? I also tried that..it didn't work. yeah, I realize that. I tried something along the lines of this(for both methods): plaintextString.replaceAll(c, dottie[characterIndex]); characterIndex++; this didn't work either..
type: Comment
comment on: http://stackoverflow.com/a/20914447

rmi
tags question: http://stackoverflow.com/q/20934625
tags question: http://stackoverflow.com/q/20978526
tags question: http://stackoverflow.com/q/20982947
tags question: http://stackoverflow.com/q/21001486
tag name: rmi
tags question: http://stackoverflow.com/q/20967220
tags question: http://stackoverflow.com/q/20947316
type: Tag
tags question: http://stackoverflow.com/q/20894897
tags question: http://stackoverflow.com/q/20884353
tags question: http://stackoverflow.com/q/20874204

http://stackoverflow.com/comment/31334047
score: 0
has text: @JBNizet ok a valid question ... i have already tested this application with jsp... just for the sake of learning i am trying to access the html. and also spring dosent bind us only to use jsps.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20880307

http://stackoverflow.com/comment/31380518
comment on: http://stackoverflow.com/a/20904744
type: Comment
score: 1
has text: @user2051347 I think Normliaze filter is a min/max one, while standardize is to eliminate the mean value then divides std.Thanks
type: AnswerComment

http://stackoverflow.com/comment/31366809
comment on: http://stackoverflow.com/q/20898176
type: QuestionComment
has text: Ordering. Unordered will always be more efficient
type: Comment
score: 0

http://stackoverflow.com/a/20859610
has body: saveOrUpdate is only about primary keys, not arbitrary unique constraints. To decide whether it's a save or update, Hibernate doesn't consult the database at all: it just checks whether the primary key property is set on the object under consideration. Unfortunately it will be quite difficult to make Hibernate generate the appropriate statement which will not fail on unique constraint violation. You don't have direct control over the generated SQL and the syntax is highly database-specific.
type: Answer
answers question: http://stackoverflow.com/q/20859430
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20859430
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/a/21011090
score: 43
accepted answer of: http://stackoverflow.com/q/21009870
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 43
has body: For older versions of IntelliJ: Preferences > Inspections > JavaDoc issues > Declaration has JavaDoc problems For newer versions of IntelliJ: File > Settings... > Editor > Inspections > Java > JavaDoc issues > Declaration has JavaDoc problems Make sure to move "scope" slider to desired level of visibility for packages, classes, methods, fields and inner classes, by default it is set to "none". You can also set "severity" level. In addition to continuous monitoring, you can also invoke inspections on demand with Cmd-Option-Shift-I, and enforce inspections prior to VCS commits(although it does not prevent you from committing your code with command line). You can also create specific inspection profiles, one for the university submissions, and another for your side projects, for example.
answers question: http://stackoverflow.com/q/21009870
has comment: http://stackoverflow.com/comment/36334045

http://stackoverflow.com/q/20974607
has comment: http://stackoverflow.com/comment/31511871
tagged with: macos
has answer: http://stackoverflow.com/a/21056093
score: 25
answer count: 4
type: AnsweredQuestion
has body: I've installed Java 8 for development purposes but now I'd like to use Java 7 again. How do I do this? It seems to be insanely difficult. Many thanks in advance. (I've tried using guigarage and that doesn't work)
downvote count: 0
has comment: http://stackoverflow.com/comment/31516901
has answer: http://stackoverflow.com/a/27820023
has comment: http://stackoverflow.com/comment/31511550
has comment: http://stackoverflow.com/comment/31511706
tagged with: java-8
type: Question
has comment: http://stackoverflow.com/comment/31516222
tagged with: java
upvote count: 25
has answer: http://stackoverflow.com/a/23878442
has answer: http://stackoverflow.com/a/20974967
has comment: http://stackoverflow.com/comment/31512129
has comment: http://stackoverflow.com/comment/31512031
possible better answer: http://stackoverflow.com/a/27820023
accepted answer: http://stackoverflow.com/a/21056093
favorite count: 0
has title: Can Java 7 and Java 8 co-exist on OSX
has comment: http://stackoverflow.com/comment/31511640

http://stackoverflow.com/q/21001778
tagged with: game-engine
type: UnansweredQuestion
has title: Vertex world position in glsl, JOGL
tagged with: bump-mapping
has answer: http://stackoverflow.com/a/21001863
tagged with: jogl
type: Question
answer count: 1
score: 0
tagged with: java
has body: so i've been trying to implement bump mapping for some time and i have it working in some way. So it renders the texture and shadowing correct but does not change as the light source moves around I determined that it applies the light source moving around from the source (0,0) and not where the light source is in the world. How do i determine the world position of the fragment in the shader? I am a bit stuck at the moment, any help would be appreciated. --vertex shader void main() { gl_TexCoord[0] = gl_MultiTexCoord0; // Set the position of the current vertex gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex; } --fragment shader uniform sampler2D color_texture; uniform sampler2D normal_texture; uniform vec4 lightColor; uniform vec3 falloff; uniform vec3 lightPos; uniform vec2 resolution; uniform float ambience; //uniform float lightDirection; void main() { // Extract the normal from the normal map vec3 normal = normalize(texture2D(normal_texture, gl_TexCoord[0].st).rgb * 2.0 - 1.0); // Determine where the light is positioned vec3 light_pos = normalize(lightPos); //vec3 light_pos = normalize(vec3(1.0, 1.0, 0.5)); // Calculate the lighting diffuse value, the ambience is the darkness due to no light float diffuse = max(dot(normal, light_pos), 0.0); //direction float lightDir = length(vec3(lightPos.xy - (gl_FragCoord.xy / resolution.xy), lightPos.z)); //calculate attenuation float attenuation = 1.0 / ( falloff.x + (falloff.y*lightDir) + (falloff.z*lightDir*lightDir) ); //calculate the final color vec3 color = diffuse * texture2D(color_texture, gl_TexCoord[0].st).rgb; // Set the output color of our current pixel gl_FragColor = vec4(color, 1.0); } --jogl, java code hooking up the shader int shaderProgram = ShaderControl.enableShader(gl, shaderName); //apply vars int diffuseTextureVariableLocation = gl.getGL2().glGetUniformLocation(shaderProgram, "color_texture"); int normalColorVariableLocation = gl.getGL2().glGetUniformLocation(shaderProgram, "normal_tex…

http://stackoverflow.com/comment/31334767
has text: @Marin that doesn't matter, it tells you it's missing the sources for the standard Scala libraries, but you don't really need those to use Scala in the IDE.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20873254
score: 0

version
tags question: http://stackoverflow.com/q/20923967
tags question: http://stackoverflow.com/q/20872513
tags question: http://stackoverflow.com/q/20956516
tags question: http://stackoverflow.com/q/20937537
type: Tag
tag name: version

http://stackoverflow.com/q/20851563
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/31279363
has comment: http://stackoverflow.com/comment/31279948
type: Question
has comment: http://stackoverflow.com/comment/31279321
has body: I need a placemarker on a static image. Any tutorials to refer? what I have found are usually on google maps instead of static image. I need a placemarker which points to places from a static image.. Thanks. I will need this on an android device
has comment: http://stackoverflow.com/comment/31293535
has comment: http://stackoverflow.com/comment/31279406
has comment: http://stackoverflow.com/comment/31279229
has comment: http://stackoverflow.com/comment/31279281
has comment: http://stackoverflow.com/comment/31279464
has comment: http://stackoverflow.com/comment/31281038
type: UnansweredQuestion
tagged with: android
has title: Android place markers on static image
tagged with: dictionary
answer count: 0

http://stackoverflow.com/comment/31290498
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20857735
has text: Post this in stack exchange Mathematics , You may get better solutions related to maths calculation

http://stackoverflow.com/comment/80421561
comment on: http://stackoverflow.com/a/43455770
score: 0
has text: compiler.xml may be specific to your project. This command targets only *.iml files which are only needed by intellij. You may have to adjust language settings in your maven pom.xml or in your case compiler.xml independent of the IDE.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/79972374
comment on: http://stackoverflow.com/a/20892454
score: 0
type: AnswerComment
has text: I used this in Game Maker Studio 2, but I had to do (360-angle) and then convert degrees to radians, otherwise it rotates in the wrong direction.
type: Comment

http://stackoverflow.com/comment/31444312
score: 1
type: QuestionComment
has text: Do your search and results page have separate forms? Submitting a form only gathers data from inside its ` ` tags, not from other forms on the same page.
comment on: http://stackoverflow.com/q/20938512
type: Comment

http://stackoverflow.com/a/20941510
has body: Synchronize access of getInstance. Class TestSingleton { private static volatile TestSingleton singletonObj = null; private TestSingleton (){ // make constructor private } public static getInstance(){ TestSingleton obj = singletonObj ; if(obj == null) { synchronized(lock) { // while we were waiting for the lock, another obj = instance; // thread may have instantiated the object if(obj == null) { obj = new TestSingleton(); instance = obj ; } } } public doSomeWork(){ // implementation } }
answers question: http://stackoverflow.com/q/20940715
score: 0
type: Answer

http://stackoverflow.com/a/20948050
answers question: http://stackoverflow.com/q/20948014
has body: you should not call directly. Android calls it when you press the Button where do you declare android:onClick property. If you want to call it in any case just pass a null parameter and check against null values
score: 0
has comment: http://stackoverflow.com/comment/31461813
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/20948014

http://stackoverflow.com/q/20959876
has comment: http://stackoverflow.com/comment/31484651
tagged with: java
has comment: http://stackoverflow.com/comment/31485112
downvote count: 2
has answer: http://stackoverflow.com/a/20959903
type: Question
tagged with: android-layout
has comment: http://stackoverflow.com/comment/31484690
has body: I've been trying to get to get this Sudoku Solver to work, the Debugger gives me this as the error. Looking at the error, there is a NullPointerException in my Sudoku class. I don't understand what exactly is wrong with my methods though. UPDATED: 01-06 16:56:25.124: E/AndroidRuntime(12733): FATAL EXCEPTION: main 01-06 16:56:25.124: E/AndroidRuntime(12733): Process: com.nom.sudokuhint, PID: 12733 01-06 16:56:25.124: E/AndroidRuntime(12733): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.nom.sudokuhint/com.nom.sudokuhint.MainActivity}: java.lang.NullPointerException 01-06 16:56:25.124: E/AndroidRuntime(12733): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121) 01-06 16:56:25.124: E/AndroidRuntime(12733): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 01-06 16:56:25.124: E/AndroidRuntime(12733): at android.app.ActivityThread.access$800(ActivityThread.java:135) 01-06 16:56:25.124: E/AndroidRuntime(12733): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 01-06 16:56:25.124: E/AndroidRuntime(12733): at android.os.Handler.dispatchMessage(Handler.java:102) 01-06 16:56:25.124: E/AndroidRuntime(12733): at android.os.Looper.loop(Looper.java:136) 01-06 16:56:25.124: E/AndroidRuntime(12733): at android.app.ActivityThread.main(ActivityThread.java:5017) 01-06 16:56:25.124: E/AndroidRuntime(12733): at java.lang.reflect.Method.invokeNative(Native Method) 01-06 16:56:25.124: E/AndroidRuntime(12733): at java.lang.reflect.Method.invoke(Method.java:515) 01-06 16:56:25.124: E/AndroidRuntime(12733): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 01-06 16:56:25.124: E/AndroidRuntime(12733): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 01-06 16:56:25.124: E/AndroidRuntime(12733): at dalvik.system.NativeStart.main(Native Method) 01-06 16:56:25.124: E/AndroidRuntime(12733): Caused by: java.lang.NullPointerException 01-06 16:56:25…
score: -2
has comment: http://stackoverflow.com/comment/31484707
answer count: 2
tagged with: tablelayout
has answer: http://stackoverflow.com/a/20959905
upvote count: 0
favorite count: 0
has title: Android App Thread Exception null pointer
type: UnansweredQuestion
tagged with: android
tagged with: android-intent

http://stackoverflow.com/comment/31465124
type: QuestionComment
has text: The device i'm connecting is a RFID HID reader. it connects itself to `/dev/input` and i can read it with `cat` on `/dev/input/event0` fine. But if i point my java Scanner to that file it reads nothing. If i swipe the card it writes output to current focus window. I need this to be redirected to java application only
comment on: http://stackoverflow.com/q/20932344
score: 0
type: Comment

http://stackoverflow.com/a/20929778
score: 1
has body: You can change it to System.err.println(" Hello ") it will print in red color but "err" is usually used to print an error message as you may have already guessed. I don't think you can change console font colors and attributes from within the java code. However you can try fiddling around the setting in the BlueJ app and see if you can change it that way. In other words, it depends on the host thats displaying the output.
upvote count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/31427408
has comment: http://stackoverflow.com/comment/31427498
type: Answer
has comment: http://stackoverflow.com/comment/31427570
answers question: http://stackoverflow.com/q/20929749
has comment: http://stackoverflow.com/comment/31427584

http://stackoverflow.com/a/21041502
score: 4
has body: I got answer here Need to set JSON provider in my case it was jackson List&lt;Object&gt; providers = new ArrayList&lt;Object&gt;(); providers.add( new JacksonJaxbJsonProvider() ); WebClient client = WebClient.create("http://localhost:8080/poc_restapi_cxf/api", providers); client = client.accept("application/json") .type("application/json") .path("/order") .query("id", "1"); Order order = client.get(Order.class); System.out.println("Order:" + order.getCustomerName());
answers question: http://stackoverflow.com/q/20948507
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/q/20937880
type: AnsweredQuestion
tagged with: inner-classes
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31443657
upvote count: 8
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/20948818
tagged with: builder-pattern
has answer: http://stackoverflow.com/a/20948818
has body: I have recently learned Joshua Bloch's builder pattern for creating objects with many optional fields. I've been using something like it for years, but never used an inner-class until Bloch's book suggested it to me. I love it. I understand that another thread may alter the bulider's configuration, before it's actually built (with build()), such that it may be necessary to re-validate all values in the constructor of the enclosing class. Below is an example of a builder class that optionally reverifies its data. So my question is this: Assuming this is a robust enough design, when there are defaults for all values--knowing this class is a poor choice for using defaults--and when every set-attempt is validated, is this re-check necessary? Although it may be different, it would never be invalid. Is that correct? (Although this design is manageable, it is certainly complicated by the potential need for re-verification. And, honestly, I never multi-thread, but I don't want to make my library unusable by people that do.) Thank you for any advice. /** <CODE>java ReverifyBuilderInEnclosingCnstrXmpl **/ public class ReverifyBuilderInEnclosingCnstrXmpl { public static final void main(String[] igno_red) { //Don't reverify ReverifyBuilderInEnclosingCnstrXmpl rvbdx = new ReverifyBuilderInEnclosingCnstrXmpl.Cfg(). name("Big Bird").age(6).build(); System.out.println(rvbdx.sName); System.out.println(rvbdx.iAge); //Do reverify rvbdx = new ReverifyBuilderInEnclosingCnstrXmpl.Cfg(). reverifyInEnclosing(). name("Big Bird").age(6).build(); } public final String sName; public final int iAge; /** Create a new <CODE>ReverifyBuilderInEnclosingCnstrXmpl with defaults. **/ public ReverifyBuilderInEnclosingCnstrXmpl() { //Does not reverify. No need. this(new ReverifyBuilderInEnclosingCnstrXmpl.Cfg()); } private ReverifyBuilderInEnclosingCnstrXmpl(ReverifyBuilderInEnclosingCnstrXmpl.Cfg rbdx_c) { sName = rbdx_c.sName; iAge = rbdx_c.iAge; ReverifyBuilderInEnclosingCnstrXmpl.Cfg.zcibValues(rbdx_…
has comment: http://stackoverflow.com/comment/31449070
has title: Making Bloch's builder pattern thread-safe: Rechecking necessary in enclosing constructor if NEVER invalid?
score: 8
favorite count: 0
tagged with: multithreading
has answer: http://stackoverflow.com/a/20940894
accepted answer: http://stackoverflow.com/a/20940894
has comment: http://stackoverflow.com/comment/31443361

http://stackoverflow.com/a/20912449
answers question: http://stackoverflow.com/q/20912405
downvote count: 0
has body: You won't be saving any memory with lazy initialization here. The memory for the code will be reserved whether or not you initialize it eagerly (it's allocated when the class is loaded). Since initializing your loadTask variable won't take long, using lazy initialization doesn't give you an advantage here in any case.
upvote count: 2
type: Answer
score: 2

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/20947596
tags question: http://stackoverflow.com/q/20904191
tags question: http://stackoverflow.com/q/20862335
tags question: http://stackoverflow.com/q/20944273
type: Tag
tags question: http://stackoverflow.com/q/20855376

http://stackoverflow.com/a/20928942
has body: The issue was complex (consisted with a few smaller issues). Dumping request and response frames from both ends as @tomlogic suggested was quite helpful. To resolve these issues I first ensured that hardware part works. XBee explorer has 4 LEDs. One is power and should always glow red when powered. And 3 others, depending on what explorer you have, may be called rx, tx, rssi or din, dout, rssi. When transmitting code runs, we first need to make sure that rx and tx are blinking simultaneously every second. I.e. signal is sent each second. When receiving code runs and calls readPacketUntilAvailable, LEDs on receiving XBee explorer should glow as follows: rssi glows constantly, tx or dout should blink. Now that when we know hardware is fine, we can debug software part. My issue was with receiving code. When we are setting up receiving XBee, we need to make sure we do two things. First, we call xbee.begin(baudRate). And second, we should reset module. reset = 0; wait_ms(100); reset = 1; wait_ms(100); And last, but not least thing, readPacketUntilAvailable method will not reset response. We call this function in a loop. Whatever first response we get will be repeated, no matter what other data is sent by transmitter. First response that receiver got in my case was MODEM_STATUS_RESPONSE (0x8A in HEX). And subsequent packets were not read. readPacket must be called instead, since that method will reset previous response. My receiving code now looks like this: XBee xbee(p28, p27); DigitalOut reset(p11); DigitalOut mbed_led1(LED1); int main() { Serial terminal(USBTX, USBRX); while(!terminal.readable()) { wait_ms(10); } terminal.getc(); mbed_led1 = 1; xbee.begin(9600); reset = 0; wait_ms(100); reset = 1; wait_ms(100); while(1) { terminal.puts("Reading packet...\r\n"); xbee.readPacket(500); XBeeResponse response = xbee.getResponse(); if (response.isAvailable()) { terminal.puts("Packet available\r\n"); XBeeResponse response = xbee.getResponse(); char tmp[20]; sprintf(tmp, "0x%0…
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31489664
has comment: http://stackoverflow.com/comment/31476635
answers question: http://stackoverflow.com/q/20865973
accepted answer of: http://stackoverflow.com/q/20865973
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/20925783
type: AcceptedAnswer
upvote count: 12
has body: Assuming you're looking to have the correct size of the column based on the formula results, just insert the following line right before you do the autoSizeColumn, in this case before your for loop: HSSFFormulaEvaluator.evaluateAllFormulaCells(wb); The reason is autoSizeColumn sizes your cell based on the cached formula evaluated results and if the formula was never evaluated, it would not know what size to set for it. Code: ... row.createCell(3).setCellValue("foo"); HSSFFormulaEvaluator.evaluateAllFormulaCells(wb); for (int i = 0; i &lt; 4; i++) { sheet.autoSizeColumn(i); } ... Output (in OpenOffice)
accepted answer of: http://stackoverflow.com/q/20924299
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20924299
score: 12

http://stackoverflow.com/comment/31428837
type: Comment
type: QuestionComment
has text: Better yet, consider an InsectFarm with a getter called `fly()` that returns a Fly. Should you be able to use an InsectFarm as an Airplane?
comment on: http://stackoverflow.com/q/20924602
score: 0

embedded-tomcat-7
type: Tag
tag name: embedded-tomcat-7
tags question: http://stackoverflow.com/q/20872943

http://stackoverflow.com/q/20938500
tagged with: foreach
has comment: http://stackoverflow.com/comment/31444012
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31444117
downvote count: 0
has body: I have a question connected with my GalaxyInvaders clone. What is the difference between for and foreach iterating through ArrayList? I'm modifying ArrayLists (changing variables / removing some objects) using foreach loops (I'm blocking sections before doing that using Semaphores). Question is, when I use foreach statement, application throws exception. Exception in thread "Thread-39" java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(Unknown Source) at java.util.ArrayList$Itr.next(Unknown Source) at pl.mosek.MyPanel2$ColissionDetector.run(GUI.java:421) at java.lang.Thread.run(Unknown Source) When I use classic for statement, problem magically dissapears. Can somebody explain me why is that? CODE: @Override public void run() { while (true) { if (ship.getBullets().isEmpty() == false &amp;&amp; monsters.isEmpty() == false) { semaphoreLock(semaphoreBullet); for (Bullet i : ship.getBullets()) { if (i.isDestroyed() != true) { semaphoreLock(semaphoreMonster); for (Enemy j : monsters) { if (i.getBounds() .intersects(j.getBounds()) &amp;&amp;j.isDestroyed() != true) { i.setDestroyed(true); i.setVisible(false); j.setDestroyed(true); j.setVisible(false); } } } semaphoreRelease(semaphoreMonster); } semaphoreRelease(semaphoreBullet); } try { Thread.sleep(25); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } If i switch foreach to for statments, everything working correctly.
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31444038
type: Question
tagged with: iterator
linked to: http://stackoverflow.com/q/3184883
answer count: 2
has comment: http://stackoverflow.com/comment/31444052
upvote count: 1
duplicate of: http://stackoverflow.com/q/3184883
has title: Java concurrency (Threads) at ArrayLists. Difference between classic for and foreach
possible better answer: http://stackoverflow.com/a/20938558
favorite count: 0
has answer: http://stackoverflow.com/a/20938558
has comment: http://stackoverflow.com/comment/31444094
has comment: http://stackoverflow.com/comment/31444031
has answer: http://stackoverflow.com/a/20938562
accepted answer: http://stackoverflow.com/a/20938562

http://stackoverflow.com/comment/31330033
has text: I *highly* recommend a beginner's book on Java, or at the very least starting wit the tutorials provided by Oracle.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20878280
score: 0

http://stackoverflow.com/a/20984644
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/31533923
has body: It depends on the physical characteristics of the device on which you run your program, this to be more user friendly use ProgressBar while the content id loading... read this http://developer.android.com/reference/android/widget/ProgressBar.html i hope this is helpful...
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/20984561

http://stackoverflow.com/q/20961820
has comment: http://stackoverflow.com/comment/31491460
has body: I have a servlet which is reading data from a database and populating a list. I want to display this list in a jsp file but I am not managing to display the rows. Could someone indicate what I am doing wrong please? These are the files: ListCars.java (servlet) package servlets; [imports] @WebServlet(name="ListCars", loadOnStartup = 1,urlPatterns={"/ListCars"}) public class ListCars extends HttpServlet { @EJB private CarsFacade carsFacade; protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.getSession(true); response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); List dbData = carsFacade.findAll(); request.setAttribute("data",dbData); } @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); String url = "/index.jsp"; try { request.getRequestDispatcher(url).forward(request, response); } catch (Exception ex) { ex.printStackTrace(); } } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); // use RequestDispatcher to forward request internally String url = "/index.jsp"; try { request.getRequestDispatcher(url).forward(request, response); } catch (Exception ex) { ex.printStackTrace(); } } @Override public String getServletInfo() { return "Short description"; }// </editor-fold> } index.jsp: <%@page import="java.util.List"%> <%@page import="java.util.Iterator"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> Car Hire Login Register Car Hire ID <c:forEach items='${data}' var='CarsAv' varStatus="loop"> ${CarsAv.Brand} </c:forEach> web.xml file: <?xml version="1.0" encoding="UTF-8"?> <web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.or…
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31525305
tagged with: java
tagged with: servlets
has comment: http://stackoverflow.com/comment/31526734
type: Question
has comment: http://stackoverflow.com/comment/31488526
has title: Show servlet data in jsp
tagged with: database
tagged with: jsp
has comment: http://stackoverflow.com/comment/31527871
score: 0
has comment: http://stackoverflow.com/comment/31525608

http://stackoverflow.com/a/21018811
has comment: http://stackoverflow.com/comment/31599049
has comment: http://stackoverflow.com/comment/31593138
type: Answer
has comment: http://stackoverflow.com/comment/31592843
has body: Try with implimentig implicit wait after driver initializes. by adding below line driver.manage().timeouts().implicitlyWait(50, TimeUnit.SECONDS);
answers question: http://stackoverflow.com/q/21018649
score: 0

http://stackoverflow.com/comment/31374798
has text: @Swaraj: There's no databases. I'm having only the UI implementations.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20901145
score: 0

http://stackoverflow.com/comment/31863672
has text: Is there anything I can do about this? I have enough free memory so the OS should not be swapping to disk...
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20949076

http://stackoverflow.com/a/20916351
has comment: http://stackoverflow.com/comment/31401973
accepted answer of: http://stackoverflow.com/q/20916258
has comment: http://stackoverflow.com/comment/31924885
answers question: http://stackoverflow.com/q/20916258
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
has body: It is the Partitioner that decides how to distribute the output of mappers to different reducers. Partitioner controls the partitioning of the keys of the intermediate map-outputs. The key (or a subset of the key) is used to derive the partition, typically by a hash function. The total number of partitions is the same as the number of reduce tasks for the job. Hence this controls which of the m reduce tasks the intermediate key (and hence the record) is sent for reduction.
score: 1

http://stackoverflow.com/a/20925574
accepted answer of: http://stackoverflow.com/q/20925561
type: Answer
answers question: http://stackoverflow.com/q/20925561
has comment: http://stackoverflow.com/comment/31419091
has body: While JEditorPane has no append method, you can certainly add text to its Document via its insertString(...) method, and I suggest that you look into doing this. Edit You ask: it worked it out but it seems it works like setText, all the previous data vanishes.. how do i keep the previous data ? Are you correctly passing in the first parameter, the offset? This should be the length of the current Document.
upvote count: 5
has comment: http://stackoverflow.com/comment/31419072
score: 5
has comment: http://stackoverflow.com/comment/31419021
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/21552812
has comment: http://stackoverflow.com/comment/32760973
downvote count: 0
has comment: http://stackoverflow.com/comment/128598492
upvote count: 137
has comment: http://stackoverflow.com/comment/109143554
has comment: http://stackoverflow.com/comment/32735873
has comment: http://stackoverflow.com/comment/32990681
has body: Contrary to common belief JMX/RMI doesn't need to open all these ports. You can actually force them to be same which will mean that at the end of the day you'll only need to punch one hole in the firewall (if firewall is your concern). Try setting System Properties: com.sun.management.jmxremote.port com.sun.management.jmxremote.rmi.port to the same value!! Explicitly setting these will stop RMI from picking random ports. Setting them to the same value will make sure it opens less ports to listen on. This will work in Java 7 update 25 or later. What is the third port? The third port that you see opened by your application (or the second if you followed my advice above) is used by the Java Attach API. It is what JConsole uses for connecting to "Local Process". The Java Attach API feature is enabled by default since Java 6 regardless of the com.sun.management.jmxremote property. This feature will use a random port (aka an OS ephemeral port) but it really doesn't matter because the feature only allows connections from the host itself. If you really dislike this feature then you can add -XX:+DisableAttachMechanism to the command line to disable the Java Attach API feature. Then you'll no longer see the java process (in this case Tomcat) listening on a random port. How do I make JMX listen on the loopback interface only With a custom made application you would use a RMIServerSocketFactory but this is Tomcat so you would have to do it using Tomcat's JMX Remote Lifecycle Listener. On the other hand it doesn't matter now that you have the com.sun.management.jmxremote.local.only property since Java 7. It makes sure that only connections from the host itself are allowed. Mind you that JMX library doesn't achieve this by binding to loopback interface which would certainly be one way of doing it but also slight inaccurate as a host can potentially have several loopback interfaces. In fact by and large (with the most recent additions to JDK wrt JMX) I would say that Tomcat's JMX …
answers question: http://stackoverflow.com/q/20884353
has comment: http://stackoverflow.com/comment/122310138
has comment: http://stackoverflow.com/comment/104030839
has comment: http://stackoverflow.com/comment/128602028
accepted answer of: http://stackoverflow.com/q/20884353
score: 137
has comment: http://stackoverflow.com/comment/104004976
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/64627598
has comment: http://stackoverflow.com/comment/65844527
has comment: http://stackoverflow.com/comment/102156832
has comment: http://stackoverflow.com/comment/64616925
has comment: http://stackoverflow.com/comment/129478729
type: Answer
has comment: http://stackoverflow.com/comment/32750098
has comment: http://stackoverflow.com/comment/32757865
has comment: http://stackoverflow.com/comment/33810238
has comment: http://stackoverflow.com/comment/128601496

http://stackoverflow.com/q/21018382
type: UnansweredQuestion
has title: Using Stanford CoreNLP - Java heap space
downvote count: 0
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/31592827
type: Question
tagged with: stanford-nlp
has body: I am trying to use the coreference module of the Stanford CoreNLP pipeline, but I end up getting an OutOfMemory error in Java. I already increased the heap size (via Run->Run Configurations->VM Arguments in Eclipse) and set them to -Xmx3g -Xms1g. I even tried -Xmx12g -Xms4g, but that didn't help either. I'm using Eclipse Juno on OS X 10.8.5 with Java 1.6 on a 64-bit machine. Does anyone have an idea what else I could try? I'm using the example code from the website (http://nlp.stanford.edu/software/corenlp.shtml): Properties props = new Properties(); props.put("annotators", "tokenize, ssplit, pos, lemma, ner, parse, dcoref"); StanfordCoreNLP pipeline = new StanfordCoreNLP(props); String text = "Stanford University is located in California. It is a great university"; Annotation document = new Annotation(text); pipeline.annotate(document); List&lt;CoreMap&gt; sentences = document.get(SentencesAnnotation.class); for(CoreMap sentence: sentences) { for (CoreLabel token: sentence.get(TokensAnnotation.class)) { String word = token.get(TextAnnotation.class); String pos = token.get(PartOfSpeechAnnotation.class); String ne = token.get(NamedEntityTagAnnotation.class); } Tree tree = sentence.get(TreeAnnotation.class); SemanticGraph dependencies = sentence.get(CollapsedCCProcessedDependenciesAnnotation.class); } Map&lt;Integer, CorefChain&gt; graph = document.get(CorefChainAnnotation.class); And I get the error: Adding annotator tokenize Adding annotator ssplit Adding annotator pos Reading POS tagger model from edu/stanford/nlp/models/pos-tagger/english-left3words/english-left3words-distsim.tagger ... done [0.9 sec]. Adding annotator lemma Adding annotator ner Loading classifier from edu/stanford/nlp/models/ner/english.all.3class.distsim.crf.ser.gz ... done [3.1 sec]. Initializing JollyDayHoliday for sutime Reading TokensRegex rules from edu/stanford/nlp/models/sutime/defs.sutime.txt Reading TokensRegex rules from edu/stanford/nlp/models/sutime/english.sutime.txt Jan 9, 2014 10:…
has answer: http://stackoverflow.com/a/21022308
has comment: http://stackoverflow.com/comment/31599056
tagged with: eclipse
has comment: http://stackoverflow.com/comment/31597423
upvote count: 7
has comment: http://stackoverflow.com/comment/31593290
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36300410
tagged with: out-of-memory

http://stackoverflow.com/a/77803556
downvote count: 0
answers question: http://stackoverflow.com/q/20959558
type: Answer
score: 1
upvote count: 1
has body: As of Gradle 5.2, the versionMapping block of MavenPublication can be used to achieve this: publishing { publications { mavenJava(MavenPublication) { groupId 'my.group' artifactId 'my-artifact' from components.java versionMapping { allVariants { fromResolutionResult() } } } } } https://docs.gradle.org/5.2/userguide/publishing_maven.html#publishing_maven:resolved_dependencies

http://stackoverflow.com/comment/87394945
score: 0
type: Comment
has text: This answer is too long, not specific.
type: AnswerComment
comment on: http://stackoverflow.com/a/21002625

http://stackoverflow.com/q/20989850
has body: I have a mapreduce job as a 'jar' ,that should be run daily. Also, I need to run this jar from a remote java application. How can I schedule it: i.e, I just want to run job daily from my remote java application. I read about Oozie, but I dont think it is apt here.
favorite count: 0
type: UnansweredQuestion
has title: Running MapReduce job periodically without Oozie?
score: 2
tagged with: job-scheduling
upvote count: 2
tagged with: java
tagged with: mapreduce
has answer: http://stackoverflow.com/a/22987499
type: Question
tagged with: hadoop
has answer: http://stackoverflow.com/a/22982667
has answer: http://stackoverflow.com/a/20990218
linked to: http://stackoverflow.com/q/995944
answer count: 3
downvote count: 0

http://stackoverflow.com/a/20909593
has body: Here is a way to do it without making any changes to the tree node structure or any thing else. Keep a levelcounter = 0 of current level while reading the BFS queue Also keep the nextlevel pointer to node which is first in the next level in the queue. Inital nextlevel = null. When new child is added to queue check if nextlevel pointer is not null , if null then set it to current child node pointer. If nextlevel is equal to pointer of recently deleted child then increment levelcounter and set nextlevel = null The level indicated by levelcounter is your nodes level in tree.
type: Answer
answers question: http://stackoverflow.com/q/20902223
score: 0

http://stackoverflow.com/q/20946991
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I am now using java method com.mongodb.util.JSON.parse(param) to convert my json string to a DBObject.I find that, in most cases , for example , when the key in the json string is simple type like string or int ,it can be used by both JSON.parse() method and terminal. For example: json string:{'times':8} Both JSON.parse({'times':8}) and db.collection.find({'times':8}) in terminal can work correctly. But when I do a query on ISODate or _id,things become different: json string 1 :{'createDate':ISODate('2013-10-21T06:39:16.692Z')} json strign 2: {'createDate':{'$date':'2013-10-21T06:39:16.692Z'}} json string 1 can work correctly in terminal but cannot be parsed by JSON.parse() method. On the contrary , json string 2 can be parsed by JSON.parse() method but cannot be used in terminal. The same thing happened in _id. json string 3:{'_id':ObjectId('1231daf213432414321431')} json string 4:{'_id':{'$oid':'fadf234234sdfadfasdfa12'}} json string 3 can work correctly in terminal but cannot be parsed by JSON.parse() method. On the contrary , json string 4 can be parsed by JSON.parse() method but cannot be used in terminal. I don't know the reason of these differences.
has answer: http://stackoverflow.com/a/20948944
has title: Mongodb- java function com.mongodb.util.JSON.parse()
tagged with: mongodb
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
score: 2
upvote count: 2

http://stackoverflow.com/comment/31304091
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20864440
has text: @user3142972 How do you plan on exiting your `while(true) {}` with no code to exit the loop?
score: 0

http://stackoverflow.com/comment/31590849
has text: You really should do it using longs as Serializable is not good for performance, which is noticeable on older devices. You may also want to look at Joda as it contains lots of useful tools and has a DateTime object that I often find more useful.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21017453
type: Comment

http://stackoverflow.com/q/20941445
has title: two dimensional string[] convert to string and output = matrix
downvote count: 2
has answer: http://stackoverflow.com/a/20941483
type: Question
score: -2
answer count: 2
tagged with: char
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/20941472
has comment: http://stackoverflow.com/comment/31449868
type: UnansweredQuestion
has body: I have written the code: public static void main(String[]args) { Scanner input = new Scanner(System.in); System.out.print("Type your text: "); String text = input.nextLine(); int counter = text.length(); if(text.length()&gt; 16) { System.out.println("Error: input text is greater than 16 characters"); System.exit(0); } else { while(counter &lt; 16) { text = text.concat("x"); counter++; } char[][] k = new char[4][4]; int push = 0; for(int i = 0; i &lt; k.length; i++) { for(int j = 0; j &lt; k[i].length; j++) { k[i][j] = text.charAt(j+ push); System.out.print(k[i][j] + " "); } System.out.println(); push = push + 4; } } } And input is: abcdefghijklm output is: a b c d e f g h i j k l m x x x So all i want is, if i type: abcdefghijklm I want this output: a e i m b f j x c g k x d h l x
tagged with: java

http://stackoverflow.com/a/20944972
has comment: http://stackoverflow.com/comment/31715947
type: Answer
has body: I cant comment to your question, so i will try to answer based on my understanding that you have issues reading/writing the DATE fields in Excel. I think you are missing a check on Date field, excel stores the dates as Numeric Contents internally and while displaying, It displays a formatted date. Also you need to ensure that the column is formatted as DATE column in the sheet you are reading. You need to use below code fragment to read content as DATE. if (cell.getCellType() == HSSFCell.CELL_TYPE_NUMERIC) { // Excel stores the Date as a Numeric Contents. POI provides // a Date utility to check // if a particular cell is formatted as a date. if (DateUtil.isCellDateFormatted(cell)) { Date date = DateUtil.getJavaDate((double) cell .getNumericCellValue()); SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy HH:mm z"); System.out.println("The cell is a Date : " + df.format(date)); } else { // treat the cell as 'double' number System.out.println("The cell is a number : " + cell.getNumericCellValue()); } } For complete code snipper you can refer this link. Please note I have authored the link.
has comment: http://stackoverflow.com/comment/31720396
has comment: http://stackoverflow.com/comment/31719120
answers question: http://stackoverflow.com/q/20944792
score: 0
has comment: http://stackoverflow.com/comment/31720176

http://stackoverflow.com/comment/31516668
comment on: http://stackoverflow.com/a/20955641
type: Comment
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/44723/discussion-between-ghostderfel-and-maciej-szpakowski)
score: 0
type: AnswerComment

http://stackoverflow.com/a/20987754
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/31536742
has comment: http://stackoverflow.com/comment/31536685
has body: The Spring MVC documentation explains this in the Supported method return types section The following are the supported return types: [...] A String value that is interpreted as the logical view name, with the model implicitly determined through command objects and @ModelAttribute annotated reference data accessor methods. Your method returns a String, so its value is therefore interpreted as a view name. You probably have declared an InternalResourceViewResolver in your context which takes the view name and tries to resolve an InternalResourceView. This is done by using HttpServletRequest#getRequestDispatcher() with the view name (prefixed and suffixed as configured). Read the documentation on resolving views.
answers question: http://stackoverflow.com/q/20987720

http://stackoverflow.com/a/20870858
answers question: http://stackoverflow.com/q/20849936
type: Answer
accepted answer of: http://stackoverflow.com/q/20849936
has comment: http://stackoverflow.com/comment/104608280
score: 3
upvote count: 3
has body: You can use UpHandler2's ChannelHandlerContext to retrieve the ChannelPipeline. From here you can retrieve the channel handler context of any channel handler using one of the context(...) methods. Then sendDownstream for Netty 3, or write for Netty 4, will forward to the next downstream handler after the handler to which the context responds. In effect I think you'll need to get the ChannelHandlerContext for DownHandler1 and use that to write your message. Alternatively you can build the netty pipeline such that DownHandler2 is the next down stream handler from UpHandler2. If I've understood your pipeline correctly then something like pipeline.addLast("down3", downhandler3); pipeline.addLast('up1", uphandler1); pipeline.addLast("down2", downhandler2); pipeline.addLast("up2", uphandler2); pipeline.addLast("down1", downhandler1); pipeline.addLast("up3", uphandler3); might work. However this could be quite brittle and also depends on whether your processing logic allows it.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/31322599
has text: ok the server could possibly be rendering different content for different browsers, because when I use the same exact code and replace the PhantomDriver with Firefox every thinks works as expected. How could I verify this though ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20872537
score: 1

http://stackoverflow.com/comment/31497072
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20947154
has text: *"I deleted the java-vm-args part and resigned my all jars and then the security warning is gone."* OK, so even though the (original) question may not have been answered, the problem is solved? (Your reply surprises me, enough so to resume trying to help.)
score: 0

http://stackoverflow.com/comment/117721129
score: 0
has text: seriously @jasmeet? Files don't do anything under the covers except parse the name; some methods you may call on them might be expensive, but the constructor is pretty cheap.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20905506

http://stackoverflow.com/q/20967424
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20967641
type: Question
has comment: http://stackoverflow.com/comment/31509694
has body: I want to access a JAVA function from CFML script: authToken = createobject("java","coldfusion.security.SecurityManager").createAuthToken('admin', 'cfadmin', '12345', false); authToken: #authToken# I got the following error: Object instantiation exception. An exception occurred while instantiating a Java object. The class must not be an interface or an abstract class. If the class has a constructor that accepts an argument, you must call the constructor explicitly using the init(args) method. Error : coldfusion.security.SecurityManager I know is because the arguments passed directly to createAuthToken that I can't do and I should init() it. How can I correctly pass the arguments in this scenario?
answer count: 1
tagged with: coldfusion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31509384
has title: Accessing JAVA classes and functions from CFML - Object instantiation exception
has answer: http://stackoverflow.com/a/20967641

http://stackoverflow.com/a/21059633
upvote count: 4
answers question: http://stackoverflow.com/q/20884521
downvote count: 0
has comment: http://stackoverflow.com/comment/31667690
has body: This is happening due to File System Tunneling in windows. There are options to disable/configure it. You can get more info regarding this from this link support.microsoft.com. Innorder to counteract to this in java way, you can set file created time(file attribute) immediately after creation of file as in the code below. public static void main(String args[]) throws Exception { final String FILE_PATH = "d:\\test.txt"; FileUtils.deleteQuietly(new File(FILE_PATH)); FileWriter fileWriter = new FileWriter(FILE_PATH, false); fileWriter.append(new Date().toString()); fileWriter.close(); setFileCreationTime(FILE_PATH); } public static void setFileCreationTime(String filePath) throws IOException { Path path = Paths.get(filePath); FileTime fileTime = FileTime.fromMillis(System.currentTimeMillis()); /* Changing the Created Time Stamp */ Files.setAttribute(path, "basic:creationTime", fileTime, LinkOption.NOFOLLOW_LINKS); } Hope this helps.
score: 4
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/20884521

http://stackoverflow.com/comment/31542641
score: 0
comment on: http://stackoverflow.com/q/20991205
type: QuestionComment
type: Comment
has text: Did you installed "AWS Toolkit for Eclipse" ?

http://stackoverflow.com/comment/31578871
has text: firefox version which i am using is 26.0
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20999860
type: Comment

http://stackoverflow.com/a/20867930
has body: You're not doing the same thing with BigInteger - you're calling the add method which returns a reference to a new BigInteger, and you're assigning that value back to big. Your Sample.add method changes the existing object instead: public Sample add(int number){ this.number += number; return this; } If you changed it to return a reference to a new object, it would behave like BigInteger: public Sample add(int number){ Sample sample = new Sample(); sample.setNumber(sample.number + number); return sample; } However, your Sample class is fundamentally mutable at the moment, unlike BigInteger. No operations on BigInteger change the state of an existing object; instead, they all create new objects. If you want to replicate that behaviour in Sample, you'd write it something like this: public final class Sample { private final int number; public Sample(int number) { this.number = number; } public int getNumber(){ return number; } public Sample add(int number){ return new Sample(this.number + number); } } It's important to understand that you're never passing objects around in Java - only references which are used to navigate to objects. So for example: StringBuilder a = new StringBuilder(); StringBuilder b = a; b.append("hello"); System.out.println(a); // Prints hello Here there's a single StringBuilder object, but both variables (a and b) have values which refer to the same object. Any changes made via one variable are still visible through the other variable. (See this Stack Overflow answer for more about this.)
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/20867912
answers question: http://stackoverflow.com/q/20867912
score: 5
upvote count: 5

http://stackoverflow.com/q/20984364
tagged with: java
type: UnansweredQuestion
upvote count: 10
has answer: http://stackoverflow.com/a/20984400
tagged with: literals
answer count: 4
has title: Dynamically add 0x prefix to int in Java
has answer: http://stackoverflow.com/a/20984444
downvote count: 0
has body: int i = 16777215; void draw(int color) { } Lets say void draw expects the color to start with the 0x prefix like so draw(0x16777215) If I try this it throws a syntax error draw(0x + i) Invalid hex literal number int i cannot contain the 0x part, it needs to be dynamically added thanks
favorite count: 0
type: Question
score: 10
tagged with: hex
has answer: http://stackoverflow.com/a/20984537
has comment: http://stackoverflow.com/comment/31530627
has answer: http://stackoverflow.com/a/21211294
has comment: http://stackoverflow.com/comment/31530575
linked to: http://stackoverflow.com/q/8633214

http://stackoverflow.com/q/20901599
has answer: http://stackoverflow.com/a/20901661
downvote count: 1
type: Question
has body: I am trying to rebuild the Eclipse console in a JFrame. Now I can't seem to find a way to use Eclipse's Console Font. I know it's called CVS Console Font but I have no idea how to 'reach' it. E.g.: Font consoleFont = new Font(?????); textArea.setFont(consoleFont); Does anybody know how I can load this font? Update: Resolved I think this font is called Consolas. Wikipedia says this about it. This font is also selectable as you can see from Eclipse font selector: Hence I think I found the font I was looking for.
has comment: http://stackoverflow.com/comment/31373034
tagged with: java
score: -1
tagged with: eclipse
answer count: 2
has answer: http://stackoverflow.com/a/55645930
upvote count: 0
has title: Using Eclipse's Console font
tagged with: console
favorite count: 0
accepted answer: http://stackoverflow.com/a/55645930
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20901661

http://stackoverflow.com/q/20927382
tagged with: ads
has comment: http://stackoverflow.com/comment/31422943
favorite count: 0
type: Question
tagged with: android
upvote count: 1
answer count: 1
has title: libGDX with StartApp
has answer: http://stackoverflow.com/a/20927816
tagged with: java
tagged with: libgdx
downvote count: 0
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/31423163
has body: I am using the libGDX framework, and i get this error when i try to pass a class into the initializing statement's application listener: 01-04 15:43:13.046: D/SensorManager(19487): onAccuracyChanged :: accuracy = 3 01-04 15:43:38.032: D/ActivityThread(2757): setTargetHeapUtilization:0.25 01-04 15:43:38.032: D/ActivityThread(2757): setTargetHeapIdealFree:8388608 01-04 15:43:38.032: D/ActivityThread(2757): setTargetHeapConcurrentStart:2097152 01-04 15:43:38.373: W/dalvikvm(2757): threadid=1: thread exiting with uncaught exception (group=0x4159a438) 01-04 15:43:38.383: E/AndroidRuntime(2757): FATAL EXCEPTION: main 01-04 15:43:38.383: E/AndroidRuntime(2757): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.audiack.freetappgame/com.audiack.freetappgame.MainActivity}: java.lang.NullPointerException 01-04 15:43:38.383: E/AndroidRuntime(2757): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110) 01-04 15:43:38.383: E/AndroidRuntime(2757): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135) 01-04 15:43:38.383: E/AndroidRuntime(2757): at android.app.ActivityThread.access$700(ActivityThread.java:143) 01-04 15:43:38.383: E/AndroidRuntime(2757): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1241) 01-04 15:43:38.383: E/AndroidRuntime(2757): at android.os.Handler.dispatchMessage(Handler.java:99) 01-04 15:43:38.383: E/AndroidRuntime(2757): at android.os.Looper.loop(Looper.java:137) 01-04 15:43:38.383: E/AndroidRuntime(2757): at android.app.ActivityThread.main(ActivityThread.java:4950) 01-04 15:43:38.383: E/AndroidRuntime(2757): at java.lang.reflect.Method.invokeNative(Native Method) 01-04 15:43:38.383: E/AndroidRuntime(2757): at java.lang.reflect.Method.invoke(Method.java:511) 01-04 15:43:38.383: E/AndroidRuntime(2757): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1004) 01-04 15:43:38.383: E/AndroidRuntime(2757): at com.android.internal.os.ZygoteInit.main(Zyg…

http://stackoverflow.com/comment/31413929
has text: This doesn't compile.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20922983
score: 0

http://stackoverflow.com/a/21005048
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21004935
downvote count: 0
has body: Exceptions ARE more expensive at run time, so should not be used as a part of "normal" processing. Exceptions are for exceptional circumstances. Anticipated failures should not generate an exception. For example a user providing invalid input (wrong password, invalid zip code, etc.) should not generate an exception. Exceptions are for bugs, and serious unrecoverable system failures. Note that JDBC's use of exceptions is poorly designed (according to the principles I'm suggesting).
type: Answer
has comment: http://stackoverflow.com/comment/31568364

regex
tags question: http://stackoverflow.com/q/20946008
tags question: http://stackoverflow.com/q/20879368
tags question: http://stackoverflow.com/q/20903229
tags question: http://stackoverflow.com/q/20918063
tags question: http://stackoverflow.com/q/20872313
tags question: http://stackoverflow.com/q/20987784
tags question: http://stackoverflow.com/q/20906564
tag name: regex
tags question: http://stackoverflow.com/q/20856590
tags question: http://stackoverflow.com/q/21007926
tags question: http://stackoverflow.com/q/20875853
tags question: http://stackoverflow.com/q/20859278
tags question: http://stackoverflow.com/q/20875078
tags question: http://stackoverflow.com/q/20901692
tags question: http://stackoverflow.com/q/20995523
tags question: http://stackoverflow.com/q/20879823
tags question: http://stackoverflow.com/q/21017942
tags question: http://stackoverflow.com/q/20914975
tags question: http://stackoverflow.com/q/20914494
tags question: http://stackoverflow.com/q/20898983
tags question: http://stackoverflow.com/q/20976930
tags question: http://stackoverflow.com/q/21015379
tags question: http://stackoverflow.com/q/20998204
tags question: http://stackoverflow.com/q/20934885
tags question: http://stackoverflow.com/q/20987466
tags question: http://stackoverflow.com/q/20907243
tags question: http://stackoverflow.com/q/20891170
tags question: http://stackoverflow.com/q/20977361
tags question: http://stackoverflow.com/q/20970627
tags question: http://stackoverflow.com/q/20856213
tags question: http://stackoverflow.com/q/20888571
tags question: http://stackoverflow.com/q/21012485
tags question: http://stackoverflow.com/q/20918076
tags question: http://stackoverflow.com/q/20861426
tags question: http://stackoverflow.com/q/20902342
tags question: http://stackoverflow.com/q/20975009
tags question: http://stackoverflow.com/q/20999985
tags question: http://stackoverflow.com/q/20915469
tags question: http://stackoverflow.com/q/20944724
tags question: http://stackoverflow.com/q/20974425
tags question: http://stackoverflow.com/q/20910832
tags question: http://stackoverflow.com/q/20965445
tags question: http://stackoverflow.com/q/20960386
tags question: http://stackoverflow.com/q/20933454
tags question: http://stackoverflow.com/q/20984269
tags question: http://stackoverflow.com/q/20995400
tags question: http://stackoverflow.com/q/20951938
tags question: http://stackoverflow.com/q/20877781
tags question: http://stackoverflow.com/q/20996965
tags question: http://stackoverflow.com/q/20973045
tags question: http://stackoverflow.com/q/20955951
tags question: http://stackoverflow.com/q/20869779
tags question: http://stackoverflow.com/q/20941650
tags question: http://stackoverflow.com/q/20994322
tags question: http://stackoverflow.com/q/21007411
tags question: http://stackoverflow.com/q/20968700
tags question: http://stackoverflow.com/q/21018502
tags question: http://stackoverflow.com/q/20952787
tags question: http://stackoverflow.com/q/20948201
tags question: http://stackoverflow.com/q/20910952
tags question: http://stackoverflow.com/q/20978941
tags question: http://stackoverflow.com/q/20985381
tags question: http://stackoverflow.com/q/20922777
tags question: http://stackoverflow.com/q/20900142
tags question: http://stackoverflow.com/q/20867693
tags question: http://stackoverflow.com/q/21006147
tags question: http://stackoverflow.com/q/20951710
tags question: http://stackoverflow.com/q/20991653
tags question: http://stackoverflow.com/q/20859008
tags question: http://stackoverflow.com/q/20977488
tags question: http://stackoverflow.com/q/20981506
type: Tag
tags question: http://stackoverflow.com/q/20943080
tags question: http://stackoverflow.com/q/20915479
tags question: http://stackoverflow.com/q/20904922

http://stackoverflow.com/q/21003639
has answer: http://stackoverflow.com/a/21016527
has title: JMeter CA certificate issue
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23194629
upvote count: 2
has body: I installed the JMeter version 2.11. When I add Http(s) test Script Recorder under Work Bench and try to record by clicking start I get an error message. That message is: Root CA Certificate : Apache jmeter TemporaryRootCA created in Jmeter bin directory. I installed the certificate but still I am getting pop up "see installing the JMeter certificate for HTTPS recording pop up. and I am unable to fix this issue. Could you please suggest me how to fix this issue
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/40061190
answer count: 4
score: 2
tagged with: jmeter
tagged with: java
has answer: http://stackoverflow.com/a/37605842
type: Question

http://stackoverflow.com/q/20858982
has title: Jackson field value with default quotation marks
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31293846
possible better answer: http://stackoverflow.com/a/20880882
accepted answer: http://stackoverflow.com/a/20876540
type: Question
has comment: http://stackoverflow.com/comment/31293203
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/31293156
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31293426
tagged with: jackson
has answer: http://stackoverflow.com/a/20876540
has answer: http://stackoverflow.com/a/20880882
has body: Is there some way to tell Jackson to Serialize all numbers with quotation marks? I am working with generated objects from a webservice so I can't add annotations. For example I would like that this field BigDecimal value; gets serialized by default to "value": "0" instead of "value": 0

http://stackoverflow.com/a/20854727
upvote count: 1
downvote count: 0
type: Answer
has body: Your date format should be this in order to parse the String you have given here. static final String DATEFORMAT = "MM/dd/yyyy HH:mm:ss aa";
score: 1
answers question: http://stackoverflow.com/q/20854665

http://stackoverflow.com/a/20990034
type: Answer
has body: NoSuchMethodError: is generally thrown when there is conflict for the methods in included jars or may be due to different version of included dependent jars. Try removing unnecessary jars and if still issue is not resolved check the version of included jars
answers question: http://stackoverflow.com/q/20989132
score: 0

http://stackoverflow.com/q/21012798
has body: I am newbie in android.Following this tutorial except minor change in doInBackground Method.I am getting data from Service This is my implementation: @Override public List&lt;Location&gt; loadInBackground() { long t1 = System.currentTimeMillis(); / we should initialize new arrayList every time this on function call //List&lt;ProposalListItem&gt; proposals = new ArrayList&lt;ProposalListItem&gt;(); List&lt;Location&gt; locations= LocationListService.getInstance().getLocationList(); long t2 = System.currentTimeMillis(); Log.d(TAG, "loaded locations " + locations.size() + " in " + (t2 - t1) + " ms" + "locations" + locations); return locations; } This is the implementation of getLocationList: public List&lt;Location&gt; getLocationList() { MultiValueMap&lt;String, Object&gt; formData = new LinkedMultiValueMap&lt;String, Object&gt;(); //Populate the MultiValueMap being serialized and headers in an HttpEntity object to use for the request HttpEntity&lt;MultiValueMap&lt;String, Object&gt;&gt; requestEntity = new HttpEntity&lt;MultiValueMap&lt;String, Object&gt;&gt;(formData, WorkflowRestService .getInstance().getRequestHeaders()); // Perform the HTTP GET request ResponseEntity&lt;LocationListItemHolder&gt; responseEntity = WorkflowRestService.getInstance().getRestTemplate() .exchange(WorkflowApp.getServicesURL() + "locations/getAllLocations", HttpMethod.POST, requestEntity, LocationListItemHolder.class); Log.i("response Entity",""+responseEntity); // LocationListItemHolder locationInstance = new LocationListItemHolder(); LocationListItemHolder locationInstance = responseEntity.getBody(); if("true".equals(locationInstance.getStatus())) {Log.i("locationInstance.getLocationListItems if ",""+locationInstance.getLocationListItems()); return locationInstance.getLocationListItems(); } else {Log.i("locationInstance.getLocationListItems else",""+locationInstance.getLocationListItems()); return Collections.EMPTY_LIST; } } while this line {Log.i("locationInstance.getLocationListItems…
has comment: http://stackoverflow.com/comment/31585328
score: 0
tagged with: android
has title: Error on Following Tutorial using JAVA in Android?
has comment: http://stackoverflow.com/comment/31583616
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31584149
has comment: http://stackoverflow.com/comment/31584478
tagged with: list
answer count: 0
has comment: http://stackoverflow.com/comment/31584171
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31585885
has comment: http://stackoverflow.com/comment/31582571

http://stackoverflow.com/a/21008142
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/21007383
has body: Rather than autowiring, trying implementing ServletConfigAware. Edit: I couldn't find an example that shows using ServletConfigAware in a real project. Essentially, you'd have a class that implemented this interface to obtain the ServletConfig. You'd create a Spring bean from the class by annotating the class with @Component or declaring a bean in XML. When Spring creates the bean, it would invoke setServletConfig(ServletConfig servletConfig). Once you had an instance of ServletConfig in your bean, you'd do whatever you need with it. Your question was how to obtain the ServletConfig, but I think (correct me if I'm wrong) you are looking to integrate a legacy Servlet into your Spring Web MVC application. ServletWrappingController might be a better choice. I haven't ever used it myself, but it appears to be specifically designed for that purpose.
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31612333

http://stackoverflow.com/a/20980533
has body: I guess Apache commons-codec Hex class contains the methods you want. The actual code for converting chars to digits is: protected static int toDigit(final char ch, final int index) throws DecoderException { final int digit = Character.digit(ch, 16); if (digit == -1) { throw new DecoderException("Illegal hexadecimal character " + ch + " at index " + index); } return digit; } And the property Character.digit('F', 16) == Character.digit('f', 16) holds.
upvote count: 2
accepted answer of: http://stackoverflow.com/q/20980225
has comment: http://stackoverflow.com/comment/104556566
has comment: http://stackoverflow.com/comment/31523164
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20980225
type: Answer
has comment: http://stackoverflow.com/comment/31526059
has comment: http://stackoverflow.com/comment/31523594
score: 2

http://stackoverflow.com/comment/31380587
comment on: http://stackoverflow.com/q/20905634
type: QuestionComment
type: Comment
has text: I can't make out any connection between your code and your goal. Looks like just some random code involving loops and prints. It doesn't even qualify for an "attempt".
score: 3

http://stackoverflow.com/q/20885056
has comment: http://stackoverflow.com/comment/31342082
has comment: http://stackoverflow.com/comment/31352830
has comment: http://stackoverflow.com/comment/31344057
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/31349144
has comment: http://stackoverflow.com/comment/31342483
answer count: 1
tagged with: jsp
tagged with: dao
has body: DAO-object gets from DB only limited count of objects. Only Clear - Build - Deploy can help. I have DB with connected by foreign keys entities. One of them is User. Other one - Book. Those entities are stored in tables Users and Library. In table Users stores 100 rows. In table Library stores 1050 rows. User entity class. public class User { private long id; private String firstName; private String lastName; private String email; private String login; private String password; private Gender gender; private boolean confirmed; private boolean banned; private String registrationDate; private boolean notify; private Role role; @Override public String toString(){ return id + " " + firstName + " " + lastName + " " + email + " " + login + " " + password + " " + gender + " " + confirmed + " " + banned + " " + registrationDate + " " + notify + " " + role; } public List&lt;String&gt; toStringList(){ List&lt;String&gt; result = new ArrayList&lt;String&gt;(); result.add(String.valueOf(id)); result.add(firstName); result.add(lastName); result.add(email); result.add(login); result.add(password); result.add(String.valueOf(gender.toInt())); result.add(confirmed?"1":"0"); result.add(banned?"1":"0"); result.add(registrationDate); result.add(notify?"1":"0"); result.add(String.valueOf(role.getId())); return result; } public User() { } public User(long id) { this.id = id; } public boolean isBanned() { return banned; } public void setBanned(boolean banned) { this.banned = banned; } public boolean isConfirmed() { return confirmed; } public void setConfirmed(boolean confirmed) { this.confirmed = confirmed; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public Gender getGender() { return gender; } public void setGender(Gender gender) { this.gender = gender; } public long getId() { return id; } public void setId…
score: 0
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/31352906
type: UnansweredQuestion
has title: DAO-object gets from DB only limited count of objects
linked to: http://stackoverflow.com/q/4508172
has comment: http://stackoverflow.com/comment/31350867
tagged with: java
has answer: http://stackoverflow.com/a/20892615

http://stackoverflow.com/q/20977403
has answer: http://stackoverflow.com/a/20977496
accepted answer: http://stackoverflow.com/a/20977496
type: AnsweredQuestion
tagged with: java
upvote count: 10
tagged with: event-listener
tagged with: unit-testing
type: Question
score: 10
has body: I need to unit test the functionality of an event listener but I've never done it before and I can't seem to find an example anywhere about it. Does anyone have any suggestions on a good way to go about this?
downvote count: 0
answer count: 1
has title: Unit Testing Event Listeners
favorite count: 0
has comment: http://stackoverflow.com/comment/31521791
has comment: http://stackoverflow.com/comment/31516849

http://stackoverflow.com/comment/31343107
has text: Ah, it appears that the questioner did not understand an underlying fact in Java: When using "==" to compare two objects, you are testing if they are references to the same object. When using "equals()", you are testing if they have the same value. You cannot use "equals" to compare primitives.
type: AnswerComment
type: Comment
score: 3
comment on: http://stackoverflow.com/a/20877115

http://stackoverflow.com/comment/31517815
has text: Yes, this would work, but ints can also be negative.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20977779

keystroke
type: Tag
tags question: http://stackoverflow.com/q/20970733
tag name: keystroke

http://stackoverflow.com/q/20943153
has comment: http://stackoverflow.com/comment/31453094
has comment: http://stackoverflow.com/comment/31453119
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20944157
has comment: http://stackoverflow.com/comment/31453117
has comment: http://stackoverflow.com/comment/31453353
downvote count: 1
type: Question
has title: How to print day of the given date month year?
score: 1
tagged with: java
tagged with: date
has comment: http://stackoverflow.com/comment/31453047
has answer: http://stackoverflow.com/a/20943438
has comment: http://stackoverflow.com/comment/139993347
has body: In this I get leap &amp; ordinary year and month, but I don't know how to get day of the given date month year. And also having one question: 1800 and 1900 are ordinary year but I get these years are leap year. Can you solve this? import java.util.Scanner; class day { public static void main(String arg[]) { int tm, sm, w; int y; int[] m = new int[12]; m[0] = 31; m[1] = 28; m[2] = 31; m[3] = 30; m[4] = 31; m[5] = 30; m[6] = 31; m[7] = 31; m[8] = 30; m[9] = 31; m[10] = 30; m[11] = 31; //{31,28,31,30,31,30,31,31,30,31,30,31}; String[] mo = new String[12]; mo[0] = "January"; mo[1] = "February"; mo[2] = "March"; mo[3] = "April"; mo[4] = "May"; mo[5] = "June"; mo[6] = "July"; mo[7] = "August"; mo[8] = "September"; mo[9] = "October"; mo[10] = "November"; mo[11] = "December"; String[] we = new String[w]; we[0] = "Sunday"; we[1] = "Monday"; we[2] = "Tuesday"; we[3] = "Wednesday"; we[4] = "Thursday"; we[5] = "Friday"; we[6] = "Saturday"; Scanner ip = new Scanner(System.in); System.out.print("\nEnter year "); y = ip.nextInt(); System.out.print("\nEnter month "); sm = ip.nextInt(); if (y % 4 == 0) { m[1] = m[1] + 1; for (tm = 1; tm &lt;= m.length; tm++) { if (tm == sm) { System.out.print("\n" + y + " is a Leap Year\n" + mo[sm - 1] + " month " + "has " + m[sm - 1] + " days\n"); } } } else { for (tm = 1; tm &lt;= 12; tm++) { if (tm == sm) { System.out.print("\n" + y + " is an Ordinary year\n" + mo[sm - 1] + " month " + "has " + m[sm - 1] + " days\n"); } } } } }
favorite count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/31453338
has answer: http://stackoverflow.com/a/20943189

http://stackoverflow.com/q/21007680
has comment: http://stackoverflow.com/comment/31573344
has answer: http://stackoverflow.com/a/21007919
has comment: http://stackoverflow.com/comment/31573334
downvote count: 2
upvote count: 1
possible better answer: http://stackoverflow.com/a/21007740
has answer: http://stackoverflow.com/a/21008010
has body: My code: public class t3 { static int i = 1; public static void main(String[] args) throws InterruptedException { Semaphore sem = new Semaphore(1); sem.release(); System.out.println(i++); //1 then ++ sem.release(); System.out.println(i++); //2 sem.acquire(); System.out.println(i++); //3 sem.acquire(); System.out.println(i++); //4 sem.acquire(); System.out.println(i++); //5 sem.acquire(); System.out.println(i++); //6 sem.acquire(); System.out.println(i++); //7 } } My output: 1 2 3 4 5 Why is not like this:? 1 2 3 4 5 6 7
has title: Semaphore in Java
has answer: http://stackoverflow.com/a/21007740
tagged with: semaphore
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21007919
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/31573559
type: Question
has comment: http://stackoverflow.com/comment/31573359
favorite count: 0
answer count: 3

http://stackoverflow.com/q/20882783
has comment: http://stackoverflow.com/comment/31341615
has comment: http://stackoverflow.com/comment/31338001
has answer: http://stackoverflow.com/a/20882918
has title: Start Java event on date/time based on database row
answer count: 1
downvote count: 0
favorite count: 0
tagged with: listener
upvote count: 6
has body: I'm trying to make a Listener (or something like that?) that will start a specific event when a date field from a database row is the same as the current time. Of course I can trigger every second to check if the date/time is the same as the current, but I think that is quite expansive. There should be a better alternative.. What I trying to do is the following: I have several (for example football) matches scheduled in my database. At the specific time when the match should start, I will start a event in my Java app. This could be 1 or more matches at that time.
has comment: http://stackoverflow.com/comment/31337807
type: UnansweredQuestion
tagged with: java
score: 6
type: Question

http://stackoverflow.com/comment/31402692
has text: hmm, i found the other string that must be a problem.. for instance : ((1+3)5 they're valid.. :/ hmmh.. can i used ur pattern again to solve this one?
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/20912733

http://stackoverflow.com/comment/31395489
has text: Try `if(e==null) ...`
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/20912843

http://stackoverflow.com/comment/31564902
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21003043
has text: Yes. `Thread#stop` is a good example of "something subtly broken about it that makes it not advisable to use". It's interesting they finally removed it though - I didn't know that. It's about time tbh.
type: AnswerComment

http://stackoverflow.com/a/20957959
has comment: http://stackoverflow.com/comment/31480978
answers question: http://stackoverflow.com/q/20957873
has body: Here's what I use to read JSON from a URL: public static String readJsonFromUrl(String url) throws IOException { InputStream is = new URL(url).openStream(); try { BufferedReader rd = new BufferedReader( new InputStreamReader(is, Charset.forName("UTF-8"))); String jsonText = readAll(rd); return jsonText; } finally { is.close(); } return ""; } private static String readAll(Reader rd) throws IOException { StringBuilder sb = new StringBuilder(); int cp; while ((cp = rd.read()) != -1) { sb.append((char) cp); } return sb.toString(); }
score: 0
has comment: http://stackoverflow.com/comment/31481975
type: Answer
has comment: http://stackoverflow.com/comment/31480796

http://stackoverflow.com/a/21016898
accepted answer of: http://stackoverflow.com/q/21014861
type: Answer
has comment: http://stackoverflow.com/comment/32068898
upvote count: 11
answers question: http://stackoverflow.com/q/21014861
has comment: http://stackoverflow.com/comment/32068283
downvote count: 1
has comment: http://stackoverflow.com/comment/31591006
score: 10
has body: First make a SwingWorker class: private class FileLoader extends SwingWorker&lt;String, Void&gt; { private final JFrame frame; private final File file; public SdfLoader(JFrame frame, File file) { frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); this.frame = frame; this.file = file; } @Override public String doInBackground() throws IOException { String result = null; // read file and set result; return result; } @Override public void done() { try { String result = get(); //do stuff } catch (ExecutionException | InterruptedException ex) { // display error JOptionPane.showMessageDialog(SdfViewer.this, ioException.getMessage(), "Error opening file", JOptionPane.ERROR_MESSAGE); } finally { frame.setCursor(Cursor.getDefaultCursor()); } } } Then call it like this: private void loadFileMenuItemActionPerformed(java.awt.event.ActionEvent evt) { int returnVal = fileChoser.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fileChoser.getSelectedFile(); logger.debug("Opening SD-File '{}'.", file.getAbsoluteFile()); FileLoader loader = new FileLoader(this, file); loader.execute(); } } EDIT made by @mKorbel, please apologize me for this hi_jack I can't found my posts with this code here (something happends with underlaing database), use this logics, rest is in my comment here virtual -1k wrong, wrong, wrong, your doInBackground() missing publish()-process(), done() is extremly wrong designed, read comments in answer by @trashgod, if is possible to use Runnable#Thread for FileIO, Socket or any XxxStreams instead of black hole based on Future and SwingWorker please to delete this code in your thread as per edit . import java.awt.*; import java.awt.event.*; import java.text.SimpleDateFormat; import java.util.Random; import javax.swing.*; import javax.swing.UIManager.LookAndFeelInfo; import javax.swing.table.*; public class TableWithTimer implements ActionListener, Runnable { private static final long serialVersionUID = 1L; private JFrame…
type: AcceptedAnswer

http://stackoverflow.com/comment/31276278
comment on: http://stackoverflow.com/q/20849929
score: 0
has text: have you put in a `System.out` in `processUpdateForm` before saving it to make sure the changes from the form are being applied? You can eliminate half of your search right there.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/47566784
type: AnswerComment
has text: In your first approach example, you're storing `ShoppingCartClient ` as an attribute in the HttpSession object, right?
type: Comment
comment on: http://stackoverflow.com/a/21009392
score: 0

http://stackoverflow.com/a/20893389
score: 1
accepted answer of: http://stackoverflow.com/q/20882979
answers question: http://stackoverflow.com/q/20882979
has body: I don't know anything about JavaMaildir, and this may have nothing to do with the error you're getting, but normally Store.getDefaultFolder does not return a folder that you can store messages in. It returns a folder that you can think of as the "root" folder in the folder naming hierarchy. You'll want to create a folder underneath that folder in which to store messages. The "default" folder is not, for example, your "Inbox", where messages are delivered by default.
has comment: http://stackoverflow.com/comment/32560160
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0

http://stackoverflow.com/comment/31527932
type: QuestionComment
has text: just split the string using `string.split(",");`
comment on: http://stackoverflow.com/q/20983008
score: 0
type: Comment

http://stackoverflow.com/a/20924629
downvote count: 0
has body: Java is a strong typed language, so the assignation of an instance to an interface typed variable must be validated at compile time. This can only be done by explicitly declared interface implementations.
score: 5
upvote count: 5
type: Answer
answers question: http://stackoverflow.com/q/20924602

http://stackoverflow.com/comment/31592534
score: 0
comment on: http://stackoverflow.com/q/21018502
has text: [Use a HTML parser instead](http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags?answertab=oldest#tab-top)
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31544029
score: 0
comment on: http://stackoverflow.com/a/20990906
type: AnswerComment
has text: super(cause); here am getting exception.
type: Comment

http://stackoverflow.com/a/20994493
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20994417
type: Answer
has comment: http://stackoverflow.com/comment/31548563
score: 1
has body: All your code is performing some processing during an event handling. In Java this is a problem, the GUI only gets drawn once all the event handling is processed. Besides that, it would be great to see the code for your JFrame, it probably does not add the Label before calling pack()
upvote count: 1
accepted answer of: http://stackoverflow.com/q/20994417

http://stackoverflow.com/comment/37865456
type: AnswerComment
comment on: http://stackoverflow.com/a/22683874
score: 0
type: Comment
has text: First, WTF is an offensive phrase, please don't use vulgar and/or obscene wording/acronyms on StackOverflow. Secondly, posting a non-working solution is *not* being helpful; to paraphrase Yoda - "*don't try* to be helpful; either *be helpful*, or *don't try*". Third thing, "setup.exe" is not a synonym for anything - either be precise and specify the filename in question or say, e.g., "setup exe", "setup executable" etc.

http://stackoverflow.com/a/20915289
answers question: http://stackoverflow.com/q/20914501
has comment: http://stackoverflow.com/comment/31401372
score: 0
type: AcceptedAnswer
has body: As far as I can tell, you are committing a double-fencepost error here: int L = Thetas.length + 1; L now equals 1 more than the number of elements in the matrix... for (int i = 2; i &lt;= L; i++) ...and you are now looping with Thetas.get(i - 1) all the way up to an index that is 2 greater than the highest index available from Thetas.get(int). Remember, Thetas.get(int) directly accesses the internal array that stores this matrix's data. This can only accept indices from 0 to Thetas.length - 1. So when you call Thetas.get(-1) you will always get an error because -1 is not a valid array index; when you get to the end of the loop and call Thetas.get(i - 1), you will get an error again because there is no element at that location. You are also initializing your output matrix with DoubleMatrix z = new DoubleMatrix();, which returns a 0x0 empty matrix with no elements. That's not what you want either. Try to make sure you know which indices your data is in, then rewrite it when you know how to reference the data you are using.
accepted answer of: http://stackoverflow.com/q/20914501
type: Answer

http://stackoverflow.com/q/20914834
has answer: http://stackoverflow.com/a/20914910
has title: How to tell if a JFrame window has already been opened?
has answer: http://stackoverflow.com/a/20942996
linked to: http://stackoverflow.com/q/9554636
upvote count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/20914864
tagged with: jframe
tagged with: singleton
has body: I have a JFrame with a Button that opens a different JFrame. But I want the button to only open the second frame once. Problem is, every time I click it I get a new instance of the frame. This must be a very common problem, since I'm following a book on how to create this GUI. I find it odd that the author didn't mention this "feature". So how do I keep my button from opening multiple copies of the new frame?
answer count: 4
tagged with: netbeans
has comment: http://stackoverflow.com/comment/31402011
type: UnansweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20914889
tagged with: swing
type: Question

http://stackoverflow.com/q/20872753
type: Question
has comment: http://stackoverflow.com/comment/31319858
has answer: http://stackoverflow.com/a/20872787
has answer: http://stackoverflow.com/a/20872830
answer count: 2
tagged with: base-conversion
has title: Double to base 2 conversion (is there a simple way?)
downvote count: 0
favorite count: 0
has body: Hi and thanks for helping, (Working with Java) I've looked around a bit for converting a Double to base 2 (still in double) but I could not find a simple way. I read that given how Doubles were coded the methods like Double.doubleToRawLongBits() can give Base 2 but with a different interpretation. For converting int it pretty simple with the method: Integer.toString(x, 2) I was wondering if someone knew a simple way to convert a Double to it's base 2 correspondant as a Double? If I have a Double = 0.25 after the conversion I would like to see a double = 0.01. Thanks
type: UnansweredQuestion
tagged with: double
score: 3
upvote count: 3
tagged with: java

http://stackoverflow.com/q/20901097
has comment: http://stackoverflow.com/comment/31372155
score: 0
has title: Fundamental C++ aspects to consider moving from java
has answer: http://stackoverflow.com/a/20901190
answer count: 1
has comment: http://stackoverflow.com/comment/31372236
has body: I want to learn C++, I already program in Java. What are the aspects of C++ for which Java programmer should keep an eye on. (I moving from java to C++ for game programming.)
tagged with: java
type: UnansweredQuestion
type: Question
tagged with: c++

google-glass
tags question: http://stackoverflow.com/q/21001156
tag name: google-glass
type: Tag
tags question: http://stackoverflow.com/q/20949392

http://stackoverflow.com/comment/48692361
comment on: http://stackoverflow.com/a/20971293
type: AnswerComment
type: Comment
has text: Just to share my experience. Recently, I encountered this situation when trying to reuse one product feature from another product. I need to extend a concrete class from the reused product and there are two types of methods: one that isn't related with product reusing the component and one that needs implementation specific in reusing product. Thus an abstract class that provide implementation for first type of methods and abstract for second type of methods make sense from design perspective. Note that this is just first step to converge our components, thus it is likely to change.
score: 2

gradle
tags question: http://stackoverflow.com/q/20982533
tags question: http://stackoverflow.com/q/21002517
tags question: http://stackoverflow.com/q/20853094
tags question: http://stackoverflow.com/q/20931337
tags question: http://stackoverflow.com/q/20885387
tags question: http://stackoverflow.com/q/20855212
tags question: http://stackoverflow.com/q/20884862
tags question: http://stackoverflow.com/q/21005535
type: Tag
tags question: http://stackoverflow.com/q/20872410
tags question: http://stackoverflow.com/q/20959558
tags question: http://stackoverflow.com/q/20918436
tags question: http://stackoverflow.com/q/20997394
tags question: http://stackoverflow.com/q/20899620
tags question: http://stackoverflow.com/q/21001232
tags question: http://stackoverflow.com/q/21005205
tags question: http://stackoverflow.com/q/21015353
tags question: http://stackoverflow.com/q/20904063
tag name: gradle
tags question: http://stackoverflow.com/q/20990077
tags question: http://stackoverflow.com/q/20986528
tags question: http://stackoverflow.com/q/20973365
tags question: http://stackoverflow.com/q/20992555
tags question: http://stackoverflow.com/q/21009125
tags question: http://stackoverflow.com/q/20991281
tags question: http://stackoverflow.com/q/20988598

http://stackoverflow.com/comment/31343356
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20885596
has text: The program is a library database application. The 'Initiate' button is supposed to ask the user questions that then fill a row in the table. I need to ask 7 questions for 7 columns but so far everytime I do more than 2, the code stops working
score: 0

http://stackoverflow.com/comment/31309004
has text: yes. the edited version is working
comment on: http://stackoverflow.com/a/20867060
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/20876330
type: Answer
downvote count: 0
score: 1
has body: You can use Jersey - RESTful Web Services in Java. Download Jersey. Client client = Client.create(); String auth = new String(Base64.encode("UserName:Password")); String url = "https://maxcvservices.dnb.com/rest/Authentication"; WebResource webResource = client .resource(url); ClientResponse response = webResource.header("Authorization", "Basic " + auth).type(MediaType.APPLICATION_JSON_TYPE).accept("application/json").get(ClientResponse.class); if (response.getStatus() != 200) { throw new RuntimeException("Failed : HTTP error code : " + response.getStatus()); } String output = response.getEntity(String.class); System.out.println(output); Change Username and Password.
upvote count: 1
answers question: http://stackoverflow.com/q/20874896

http://stackoverflow.com/comment/31458915
comment on: http://stackoverflow.com/a/20946612
type: AnswerComment
score: 0
type: Comment
has text: Name also is not important. For example I created file Example.java and replaced class inside with 'ExampleNew' or whatever you want, and it also works. ;)

http://stackoverflow.com/q/20967220
answer count: 1
has title: Is it necessary/important to set a classpath in the RMI registry?
favorite count: 0
tagged with: registry
upvote count: 4
type: AnsweredQuestion
downvote count: 0
tagged with: rmi
tagged with: java
has comment: http://stackoverflow.com/comment/31498061
tagged with: classpath
accepted answer: http://stackoverflow.com/a/20967734
type: Question
score: 4
has answer: http://stackoverflow.com/a/20967734
linked to: http://stackoverflow.com/q/9440619
has body: Is it necessary or important to set a class path in the registry for RMI to work correctly?
has comment: http://stackoverflow.com/comment/31498005

http://stackoverflow.com/comment/31303650
type: Comment
type: QuestionComment
score: 5
comment on: http://stackoverflow.com/q/20864211
has text: Your code works fine. What is your question?

http://stackoverflow.com/comment/31466132
has text: int always holds a valid value, your application interprets it whatever it wants/needs, so there's no real equivalent for `null`. `i++` is ok on 0, -1... `o.someThing()` is not when `o` is null. There's a deep (conceptual and practical) difference! It reminds me of the "third state" of the three-state logic, but the analogy isn't perfect of course.
comment on: http://stackoverflow.com/a/20950148
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31554397
has text: After merging adjacent rectangles, you no longer have simple rectangles. Consider a set of squares arranged like the pixels in an enlarged number `6`. I don't think it is trivial to detect if a nested shape exists inside the closed off section of the 6, as opposed to other areas within the convex set which would be a second shape.
comment on: http://stackoverflow.com/a/20997413
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31514101
has text: @AdamDyga -- It doesn't solve it directly. My post is similar to suggesting a design pattern that might be helpful (notice the code a posted is a semi-standard decorator).
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20975560

http://stackoverflow.com/comment/31380618
score: 0
type: AnswerComment
type: Comment
has text: @MoctarHaiz ... you sent me a link to an image, I have no idea what this is suppose to mean. Google image search has many images if thats what your looking for ...
comment on: http://stackoverflow.com/a/20905535

http://stackoverflow.com/comment/31494479
type: QuestionComment
has text: FYI: We're working on a java client :)
comment on: http://stackoverflow.com/q/20890674
score: 0
type: Comment

event-handling
tag name: event-handling
tags question: http://stackoverflow.com/q/21007061
tags question: http://stackoverflow.com/q/20987744
type: Tag
tags question: http://stackoverflow.com/q/20957585

http://stackoverflow.com/comment/31488224
type: QuestionComment
comment on: http://stackoverflow.com/q/20961593
has text: Yeah, but they each get a local private copy......I thought
score: 0
type: Comment

http://stackoverflow.com/a/21587311
upvote count: 2
downvote count: 1
answers question: http://stackoverflow.com/q/20897672
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/32612201
has body: I had the same error by using http://download.eclipse.org/webtools/updates as repository but it did work by using: http://download.eclipse.org/webtools/repository/juno/

http://stackoverflow.com/a/20921852
answers question: http://stackoverflow.com/q/20905870
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20905870
type: Answer
has comment: http://stackoverflow.com/comment/31413278
has body: Your name query("Cardbox.findByUser") should be like below. Currently you are using another object in where condition instead of a field. SELECT c FROM cardbox c WHERE c.user.username = :user Here c.user represents the Entity Webappuser which has the field username.

http://stackoverflow.com/q/20938673
has body: These two classes are described in depth in the javdocs but in short: it is meant to calculate the CO2 emissions from electricity use. However I am returning an error when attempting to compile that reads as follows: non-static method calcAverageBill(java.util.ArrayList&lt;java.lang.Double&gt;) cannot be referenced from a static context. I'm not certain what the issue is, could anybody help? public class CO2fromElectricity { private double monthBillAverage; private double monthPriceAverage; private double annualCO2emission; private double emissionFactor; private double months; CO2fromElectricity() { } public double calcAverageBill(ArrayList&lt;Double&gt; monthlyBill) { monthBillAverage = 0; for(double billToken : monthlyBill) { monthBillAverage += billToken; } return monthBillAverage / monthlyBill.size(); } public double calcAveragePrice(ArrayList&lt;Double&gt; monthlyPrice) { monthPriceAverage = 0; for(double billToken : monthlyPrice) { monthPriceAverage += billToken; } return monthPriceAverage / monthlyPrice.size(); } public double calcElectricityCO2(double avgBill, double avgPrice) { emissionFactor = 1.37; months = 12; return annualCO2emission = avgBill / avgPrice * emissionFactor * months; } } public class CO2fromElectricityTester { public static void main(String[] args) { ArrayList&lt;Double&gt; monthlyBill = new ArrayList&lt;Double&gt;(); ArrayList&lt;Double&gt; monthlyPrice = new ArrayList&lt;Double&gt;(); double averageMonthlyBill, averageMonthlyPrice, annualCO2emission; double monthlyBillToken1[] = {192.14, 210.42, 231.25, 186.13}, monthlyPriceToken1[] = {.07, .06, .08, .06}; for(int index = 0; index &lt; monthlyBillToken1.length; index++) { monthlyBill.add(monthlyBillToken1[index]); monthlyPrice.add(monthlyPriceToken1[index]); } ArrayList&lt;CO2FootprintV1&gt; electricCO2outputput = new ArrayList&lt;CO2FootprintV1&gt;(); averageMonthlyBill = CO2fromElectricity.calcAverageBill(monthlyBill); averageMonthlyPrice = CO2fromElectricity.calcAveragePrice(monthlyPr…
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31444514
has comment: http://stackoverflow.com/comment/31453182
accepted answer: http://stackoverflow.com/a/20938700
type: AnsweredQuestion
upvote count: 3
has comment: http://stackoverflow.com/comment/31446125
tagged with: java
has comment: http://stackoverflow.com/comment/31446146
type: Question
has title: Compilation error when attempting to call methods which define a variable from another class
has comment: http://stackoverflow.com/comment/31453251
downvote count: 0
tagged with: static
has answer: http://stackoverflow.com/a/20938700
score: 3

http://stackoverflow.com/q/20882264
answer count: 2
has comment: http://stackoverflow.com/comment/31337039
has answer: http://stackoverflow.com/a/20882828
tagged with: oracle-database
tagged with: sql
has answer: http://stackoverflow.com/a/20882425
type: UnansweredQuestion
tagged with: triggers
score: 0
tagged with: java
has title: OracleDB : trigger on table for checking self-cycle / loops
has body: I have this table "function" with a fk to itself (1:N) and I need to check if rows have some bad loops. My idea is to create a trigger something like this: create or replace trigger FNZ_CHECK_PARENT after insert or update on FUNZIONE For Each Row Declare cnt number; Begin Select CONNECT_BY_ISCYCLE "is_cycle" Into cnt From Funzione Where Fnz_Parent Is Not Null Connect By Nocycle Prior fnz_id = fnz_parent; if cnt &gt; 0 Then Raise_Application_Error(-20000, 'this is not allowed'); end if; End; but it doesn't with this error: Errore SQL: ORA-04091: La tabella ACCERTA.FUNZIONE è in fase di modifica, il trigger/funzione non può leggerla ORA-06512: a "ACCERTA.FNZ_CHECK_PARENT", line 4 ORA-04088: errore durante esecuzione del trigger 'ACCERTA.FNZ_CHECK_PARENT' 04091. 00000 - "table %s.%s is mutating, trigger/function may not see it" *Cause: A trigger (or a user defined plsql function that is referenced in this statement) attempted to look at (or modify) a table that was in the middle of being modified by the statement which fired it. *Action: Rewrite the trigger (or function) so it does not read that table. Any suggestions?
type: Question

http://stackoverflow.com/comment/31398810
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20914224
has text: By the way, learn to use sets and maps rather than searching arrays. Much more efficient.

http://stackoverflow.com/comment/31330682
has text: answer the second question _"Or did I understand that incorrectly?"_ and this will be perfect
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20878735
score: 1

http://stackoverflow.com/comment/31391568
has text: Visitor pattern. Or take a `Function` that does the processing.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20911038
type: QuestionComment

http://stackoverflow.com/a/20970068
has comment: http://stackoverflow.com/comment/31505221
upvote count: 2
type: AcceptedAnswer
has body: Your version of Apache Commons Digester is incorrect. Review all dependencies of JasperReport.
has comment: http://stackoverflow.com/comment/31507411
accepted answer of: http://stackoverflow.com/q/20969956
type: Answer
answers question: http://stackoverflow.com/q/20969956
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31506081

http://stackoverflow.com/q/20977286
favorite count: 0
type: UnansweredQuestion
has title: JTextField to display string from another class
has comment: http://stackoverflow.com/comment/31517512
has comment: http://stackoverflow.com/comment/31517467
tagged with: swing
tagged with: jtextfield
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/20977514
score: -1
has body: I have a minor issue: My first class which for example prints out a string called "average". The string average says "hello". for example: package downloadpage; public class DownLoadPage { public void main(String[] args) throws IOException { string average; average = "hello"; System.out.print(average); My second class app.java which displays a text field. package downloadpage; public class app { private JFrame frame; JTextField textField1; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { app window = new app(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public app() { initialize(); } /** * * Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 450, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); textField1 = new JTextField(); frame.getContentPane().add(textField1, BorderLayout.NORTH); textField1.setColumns(10); } } How would can I get it when I run app.java to have textField1 to display data from "string average" in downloadpage.java? Any help would be greatly appreciated. Also, when I run app.java how do I set it to run downloadpage.java first to get the information for average? This way when app.java runs its able to have the proper data as the data is only generated once downloadpage.java runs?
downvote count: 2
upvote count: 1
tagged with: user-interface
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/31528995

http://stackoverflow.com/q/20982624
downvote count: 1
has comment: http://stackoverflow.com/comment/31528229
favorite count: 0
has answer: http://stackoverflow.com/a/20982888
accepted answer: http://stackoverflow.com/a/20982888
linked to: http://stackoverflow.com/q/9091208
has comment: http://stackoverflow.com/comment/31527152
linked to: http://stackoverflow.com/q/13540613
tagged with: tablecelleditor
has comment: http://stackoverflow.com/comment/31551271
tagged with: swing
upvote count: 4
has answer: http://stackoverflow.com/a/20982872
type: AnsweredQuestion
score: 3
linked to: http://stackoverflow.com/q/17281735
has title: how to detect enter pressed while jtable cell is being edited?
has answer: http://stackoverflow.com/a/20983692
tagged with: java
tagged with: keylistener
has body: I have a keylistener on jtable so that when someone presses enter some calculations happen. However, this only happens if the person is not editing. I would like to apply this action when a person finishes editing a cell and is pressing enter to finish and close the editing. I cannot figure this out, anyone ever did this or know how to? Basically, now for the action to be done, people must press enter twice, one to end the editing and another for the action that I want to happen, I would like to make it needed only once, while editing. Thank you
type: Question
has comment: http://stackoverflow.com/comment/31527827
has comment: http://stackoverflow.com/comment/31558292
has comment: http://stackoverflow.com/comment/31552020
tagged with: jtable
answer count: 3
has comment: http://stackoverflow.com/comment/31569270
possible better answer: http://stackoverflow.com/a/20983692

http://stackoverflow.com/a/20984444
upvote count: 19
has comment: http://stackoverflow.com/comment/31938590
has body: 0x1234 is just another way of writing an integer value. For instance, 0xff and 255 are exactly the same thing. draw(0x16777215) and draw(376926741) are identical calls. At the bytecode level, there's not any difference. The only difference is to how it appears to a human reading the code; sometimes it's easier to think in terms of bytes, which are easily expressed in hex. If a number starts with 0x, it means the rest of the digits are interpreted as hex. Instead of 0x16777215, I'm guessing you wanted 16777215 (without the 0x), which is also 0xFFFFFF. The Oracle tutorial on primitive datatypes has a bit more information (and more authority than I do :) ). To demonstrate that it's all the same under the hood, you can look at some disassembled code. Consider this class: public class Hexes { public static int alpha = 0x16777215; public static int beta = 376926741; } Running javap -c Hexes after compiling Hexes.java will show you what's happening under the hood: Compiled from "Hexes.java" public class Hexes { public static int alpha; public static int beta; public Hexes(); Code: 0: aload_0 1: invokespecial #1 // Method java/lang/Object."&lt;init&gt;":()V 4: return static {}; Code: 0: ldc #2 // int 376926741 2: putstatic #3 // Field alpha:I 5: ldc #2 // int 376926741 7: putstatic #4 // Field beta:I 10: return } The block labeled static {} is the class' static initializer, where alpha and beta are set. Note that the two fields (alpha and beta) are both assigned the same int value. If you were to write a short program to print the values out, you'd see the same value for each: public class HexesPrinter { public static void main(String[] args) { System.out.println(Hexes.alpha); System.out.println(Hexes.beta); } } Output: 376926741 376926741
has comment: http://stackoverflow.com/comment/31925107
score: 19
downvote count: 0
answers question: http://stackoverflow.com/q/20984364
type: Answer

http://stackoverflow.com/comment/31318011
has text: `System.out.println(url);` gave me `null`
comment on: http://stackoverflow.com/q/20871795
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20985305
type: Question
has comment: http://stackoverflow.com/comment/31532377
has comment: http://stackoverflow.com/comment/31532583
has comment: http://stackoverflow.com/comment/31532695
score: 0
has answer: http://stackoverflow.com/a/20985656
answer count: 2
tagged with: user-interface
has comment: http://stackoverflow.com/comment/31532753
possible better answer: http://stackoverflow.com/a/20985351
tagged with: awt
favorite count: 0
has answer: http://stackoverflow.com/a/20985351
has comment: http://stackoverflow.com/comment/31532352
has body: I'm trying to use JSlider for the first time and I tried consulting How to Use Sliders to learn the basics. But when I try to make the ticks appear like this: sliderInterior = new JSlider(JSlider.HORIZONTAL,-100,100,0); sliderInterior.setMinorTickSpacing(5); sliderInterior.setMajorTickSpacing(10); sliderInterior.setPaintTicks(true); The ticks just don't appear. What's the problem? EDIT Did a SSCCE as requested. The problem remains, a JSlider with no ticks at all. /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package Interface; import javax.swing.JOptionPane; import javax.swing.JSlider; public class JSliderTicks extends javax.swing.JDialog { public JSliderTicks(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); slider = new JSlider(JSlider.HORIZONTAL,0,10,5); slider.setMinorTickSpacing(1); slider.setMajorTickSpacing(2); slider.setPaintTicks(true); JOptionPane.showMessageDialog(null, slider); setVisible(true); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { slider = new javax.swing.JSlider(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(85, 85, 85) .addComponent(slider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(115, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(117, 117, 117) .addComponent(slider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)…
accepted answer: http://stackoverflow.com/a/20985656
has comment: http://stackoverflow.com/comment/31532629
type: AnsweredQuestion
tagged with: jslider
tagged with: java
upvote count: 1
tagged with: swing
downvote count: 1
has title: JSlider problems with ticks

http://stackoverflow.com/comment/31422126
comment on: http://stackoverflow.com/a/20927139
type: AnswerComment
has text: I have made a small update; now I get 0. I changed code above.
score: 0
type: Comment

http://stackoverflow.com/a/20990684
score: 1
upvote count: 1
has body: javac HelloWorld.java is ok But then use java HelloWorld `
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20990644

http://stackoverflow.com/q/21014213
has comment: http://stackoverflow.com/comment/31585241
tagged with: layout-manager
score: 1
has title: How to open one JInternalFrame over another in JDesktopPane?
tagged with: jinternalframe
favorite count: 0
has comment: http://stackoverflow.com/comment/31585075
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21016137
tagged with: java
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/31584914
type: Question
tagged with: miglayout
has body: In my application, I am trying to open one JInternalFrame over another JInternalFrame in single JDesktopPane that implements MigLayout but it is displaying second internal frame beside first internal frame. Where am I going wrong? Code //MainClass.java import java.awt.BorderLayout; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import net.miginfocom.swing.MigLayout; import javax.swing.JMenuBar; import javax.swing.JMenu; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JMenuItem; import javax.swing.JDesktopPane; import java.awt.Color; @SuppressWarnings("serial") public class MainClass extends JFrame { private JPanel contentPane; JDesktopPane desktopMain = new JDesktopPane(); /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { MainClass frame = new MainClass(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public MainClass() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(0, 0, 1368, 766); JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); JMenu mnJinternalframe = new JMenu("Click Here"); menuBar.add(mnJinternalframe); JMenuItem mntmOpenInternalFrame = new JMenuItem("Open Internal Frame"); mntmOpenInternalFrame.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JInternalFrame1 frame = new JInternalFrame1(desktopMain .getPreferredSize()); frame.setVisible(true); desktopMain.add(frame); } }); mnJinternalframe.add(mntmOpenInternalFrame); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); desktopMain.setBackground(Color.WHITE); contentPane.add(desktopMain, BorderLayout.CENTER); desktopMain.setLayout(new MigLayout("", "[0px:1366px:1366px,grow,shrink 50,fill]…
accepted answer: http://stackoverflow.com/a/21016137
has comment: http://stackoverflow.com/comment/31585084
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31585849

http://stackoverflow.com/a/20854758
has comment: http://stackoverflow.com/comment/31285647
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/20854665
has body: Change your dateformat like this. String DATEFORMAT = "MM/dd/yyyy HH:mm:ss aa";
downvote count: 0

http://stackoverflow.com/q/20909180
favorite count: 0
has title: Where are the OpenCMIS unit tests referred to in the documentation?
possible better answer: http://stackoverflow.com/a/20920977
type: AnsweredQuestion
tagged with: opencmis
tagged with: java
has answer: http://stackoverflow.com/a/20920977
tagged with: unit-testing
type: Question
has body: I'm implementing CMIS support for my client's document database using OpenCMIS. I've been following the guide here for creating the server. This has mostly gone well, but when I got to the section "testing the server" I couldn't find the jUnit tests they're referring to - the classes where not in any of the packages one was told to import. When looking through the Javadocs they weren't documented there either. Am I simply looking in the wrong place or is that guide out of date?
has answer: http://stackoverflow.com/a/20916077
accepted answer: http://stackoverflow.com/a/20916077
score: 0
answer count: 2
upvote count: 1
downvote count: 1
tagged with: documentation

http://stackoverflow.com/q/20919993
has comment: http://stackoverflow.com/comment/31731661
tagged with: polygon
answer count: 1
has comment: http://stackoverflow.com/comment/31795619
has comment: http://stackoverflow.com/comment/31731081
favorite count: 0
has title: Java libGDX - merge polygons
tagged with: merge
type: AnsweredQuestion
upvote count: 2
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21022568
downvote count: 1
has comment: http://stackoverflow.com/comment/31631238
type: Question
accepted answer: http://stackoverflow.com/a/21022568
has body: I'm working at a underwater game, where there are some ruins, made out of blocks. Currently, I am checking for collision with the submarine's polygon and each block of the ruin, with a function that returns the vertices of a rectangle that I made. public static float[] rectangleToVertices(float x, float y, float width, float height) { float[] result = new float[8]; result[0] = x; result[1] = y; result[2] = x + width; result[3] = y; result[4] = x + width; result[5] = y + height; result[6] = x; result[7] = y + height; return result; } I don't think that is very efficient, some of the ruins got over 10 blocks, and I don't want to check for 10 times a collision of a single object. Is there a way to merge more polygons into one? This picture can explain better: There red area is the polygon.

http://stackoverflow.com/q/21008837
tagged with: methods
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/31577222
has title: Ecplise View flow of running program
has answer: http://stackoverflow.com/a/21009860
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31576555
tagged with: hierarchy
type: UnansweredQuestion
tagged with: call
score: 1
tagged with: java
has body: I'm currently writing a pretty large program that calls the same methods from different places. Now I would really like to see how the program goes from one method to another as it is running. Like a live view that shows when what method is opened (and why?). Call Hierarchy doesn't suit my needs at this point. Is there a way?
upvote count: 1

http://stackoverflow.com/comment/31379654
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20905147
has text: @DakshShah follow the step as I have mentioned for eclipse
type: AnswerComment

http://stackoverflow.com/comment/31479612
comment on: http://stackoverflow.com/q/20957441
score: 0
type: Comment
type: QuestionComment
has text: What IDE are you using? Most will create the jar for you. Any `.java` file will need to be compiled after being edited. I do not think there is a way to have them compiled at runtime.

http://stackoverflow.com/q/21003943
tagged with: classpath
tagged with: jakarta-ee
tagged with: java
has comment: http://stackoverflow.com/comment/31566686
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31616334
has title: Tomcat 7.0.47 will not launch
has comment: http://stackoverflow.com/comment/31566317
answer count: 0
tagged with: tomcat
has comment: http://stackoverflow.com/comment/31610486
has comment: http://stackoverflow.com/comment/31614115
type: Question
has comment: http://stackoverflow.com/comment/31614326
tagged with: liferay-6
has comment: http://stackoverflow.com/comment/31610408
has body: java.lang.ClassNotFoundException: org.apache.catalina.core.AccessLogAdapter at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) at org.apache.catalina.security.SecurityClassLoad.loadCorePackage(SecurityClassLoad.java:56) at org.apache.catalina.security.SecurityClassLoad.securityClassLoad(SecurityClassLoad.java:40) at org.apache.catalina.startup.Bootstrap.init(Bootstrap.java:231) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:426) I don't understand why tomcat will not launch. I'm still configuring it, but I have catalina.jar inside $TOMCAT_HOME/lib. What am I doing wrong here? Edit: Sorry, forgot to mention I am running on RHL UPDATE: Okay so after fiddling with catalina.properties and catalina.sh for the past few days, I think I may have discovered the source of the issue. I think my class path is set up correctly, so I went through and double checked the libraries that they were pointed towards and I saw that the catalina.jar file was corrupted. I changed it out and now I'm getting the following message as opposed to the one above: catalina at org.apache.catalina.security.SecurityClassLoad.securityClassLoad(SecurityClassLoad.java:40) at org.apache.catalina.startup.Bootstrap.init(Bootstrap.java:231) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:426) Caused by: java.lang.ClassNotFoundException: javax.servlet.AsyncContext at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) ... 15 more This class also resides within the catalina.jar file. What is the deal here!…
score: 0
has comment: http://stackoverflow.com/comment/31565707

http://stackoverflow.com/comment/31563247
type: AnswerComment
type: Comment
has text: public void setNumber(View view){ mAcu1TV.setText(mAcu1ET.getText().toString); } I'm guessing it would be something like that EDIT: Sorry I couldn't set the code type text
comment on: http://stackoverflow.com/a/21002575
score: 0

http://stackoverflow.com/a/26551646
has comment: http://stackoverflow.com/comment/75613954
has body: I recommend you to enable tracing and logging, see here how: And then run the application from command line. javaws -verbose AppName.jnlp Then you could check for clues in log and trace files stored in this path \Documents and Settings\&lt;USERNAME&gt;\Application Data\Sun\Java\Deployment\log img source: http://www.cisco.com/c/en/us/support/docs/security/hostscan/117097-trouble-java7-00.html
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/20967995
downvote count: 0
type: Answer

http://stackoverflow.com/comment/31441584
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/20935638
has text: But the drawback in mbroli is that, that right now it just shows us1 not us2 and us3 and it is also not able to speak out anything. but i can make that work(it once worked yesterday but i have reinstalled; but i think i can make that work) but the point is that what i want is that like in the sample program it should say that text "Hello wor...." in a nice (us1) voice directly and not open a separate window for user to enter the text.. :(
type: Comment

http://stackoverflow.com/a/20916742
answers question: http://stackoverflow.com/q/20916686
score: 3
downvote count: 0
upvote count: 3
has body: It's O(n), regardless of what type of tree you have, since you're visiting every single node to establish the maximum depth. The only more efficient way is to have extra information about the tree stored somewhere. If it's balanced, you know the maximum height based on the number of nodes. Alternatively, you can cache the information. Have two extra variables depth and dirty and initially set dirty to true: When a caller requests the depth and dirty is true, call your function to work it out but the store that into depth and set dirty to false. When a caller requests the depth and dirty is false, just return depth. Whenever the structure of the tree is changed (insert or delete node), set dirty to true.
type: Answer
has comment: http://stackoverflow.com/comment/31402729

http://stackoverflow.com/a/20993217
has comment: http://stackoverflow.com/comment/31545893
accepted answer of: http://stackoverflow.com/q/20993033
answers question: http://stackoverflow.com/q/20993033
upvote count: 1
type: AcceptedAnswer
has body: Make method as static and call it with class name public static ArrayList&lt;String&gt; getImages() { String path = android.os.Environment.getExternalStorageDirectory() + "/Pictures/SanPics2/"; File mainfolder = new File(path); ArrayList&lt;String&gt; files = new ArrayList&lt;String&gt;(); if(mainfolder.listFiles() == null) return null; for(File f : mainfolder.listFiles()) { if(f.getName().contains(".jpg")) { files.add(f.getAbsolutePath()); } } return files; } And now call as ArrayList&lt;String&gt; image_items = ItemsAdapter.getImages(); Better use is, to move this method into same Activity class ItemsActivity (if there is no other classes call this method). So put this code into ItemsActivity without making static, like private ArrayList&lt;String&gt; getImages() {....} // Same as you posted into question, but public changed to private. And call this method into same Activity ItemsActivity as mAdapter = new ItemsAdapter(this,R.layout.item, getImages());
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/31371331
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20899266
has text: @ Raghunandan .... i resolved manifest part .... [+1] for example .... my result set is not proper .... :( ok thanks for this guidance
type: Comment

http://stackoverflow.com/comment/31306668
type: AnswerComment
type: Comment
has text: All I am trying to do is add a picture to a jframe D:
comment on: http://stackoverflow.com/a/20865849
score: 0

http://stackoverflow.com/q/20903726
has comment: http://stackoverflow.com/comment/31377320
possible better answer: http://stackoverflow.com/a/20903909
score: 0
has answer: http://stackoverflow.com/a/20903909
tagged with: android
has title: Need help in my memory game
linked to: http://stackoverflow.com/q/85190
accepted answer: http://stackoverflow.com/a/20904317
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20904317
tagged with: loops
type: Question
answer count: 2
tagged with: handler
has body: I am currently trying to write a memory game where there are 4 boxes and among the 4 boxes there will be 4 which are selected randomly. Then the users have to memorize them and input the 4 boxes in correct order. However I am currently facing a problem. It seems like handler only allows final variable. This is my code: private OnClickListener click1 = new OnClickListener() { @Override public void onClick(View v) { final ImageButton[] all= {btn1, btn2, btn3, btn4}; for (int a=0;a&lt;4;a++) { handler1.postDelayed(new Runnable() { //start delay a @Override public void run() { //actions start btn5 = all[random.nextInt(all.length)]; btn5.setBackgroundColor(Color.RED); handler1.postDelayed(new Runnable() { //start delay b @Override public void run() { btn5.setBackgroundResource(R.drawable.btn_default_holo_dark); }}, 500); //end delay b //action end }}, 1000*a ); //end delay a } } }; I try to put 4 variable inside to store the data of the btn5 but it doesn't work and it shows an error as a must be final. btn5 = all[random.nextInt(all.length)]; if (a==0) {ans1 = btn5;} //error else if (a==1) {ans2 = btn5;} //error else if (a==2) {ans3 = btn5;} //error else if (a==3) {ans4 = btn5;} //error btn5.setBackgroundColor(Color.RED); Is there any method to allow my if else statement? or is there any other method to allow me to store btn5 data in order?
tagged with: variables

http://stackoverflow.com/q/20863585
has answer: http://stackoverflow.com/a/20868503
tagged with: jframe
has title: How to size the swing app such that the borderline of the JFrame always touches the taskbar?
has answer: http://stackoverflow.com/a/20868470
has comment: http://stackoverflow.com/comment/31311852
upvote count: 3
tagged with: java
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/31302537
tagged with: swing
duplicate of: http://stackoverflow.com/q/14882417
has comment: http://stackoverflow.com/comment/31311193
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31302908
has comment: http://stackoverflow.com/comment/31311106
has body: I am trying to prevent my app from resizing and have done the following (based on valuable suggestions from stackoverflow): MyFrame frame = new MyFrame("LabelTest"); frame.setExtendedState(JFrame.MAXIMIZED_BOTH); frame.setVisible(true); frame.setResizable(false); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); This works fine...but once I click on the title bar the application becomes : and is no longer resizable. How does one disable action on title bar? I have the done the following to stretch out my application : class SwingApplication { public static void main(String args[]) { MyFrame frame = new MyFrame("LabelTest"); final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); frame.setExtendedState(JFrame.MAXIMIZED_BOTH); frame.setSize(screenSize); frame.setVisible(true); // FIRST visible = true frame.setResizable(false); // THEN resizable = false frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } Output 1 : But once i minimize and restore the application ,it takes up the entire screen.Any fix to make the application appear as in Output 1? After I minimize and restore ,Output 2 :
has comment: http://stackoverflow.com/comment/31302462
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31311480
has comment: http://stackoverflow.com/comment/31302659
type: Question

http://stackoverflow.com/comment/31398087
score: 0
type: AnswerComment
has text: Also, you could use `evil-goto-definition` without evil (just don't enable `evil-mode` and you should be fine), I've just tested it. But you still have a massive library lying around doing practically nothing. If that fine with you then you have a solution!
type: Comment
comment on: http://stackoverflow.com/a/20913196

http://stackoverflow.com/comment/31583616
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21012798
has text: What is on line 4 of LocationListLoader.java?
score: 0

http://stackoverflow.com/a/20950576
upvote count: 2
has body: An http error 415 means that content of request is not in the appropriate format. Spring MVC '@RequestBody' expect a json body (with a Content-Type equal to 'application/json') and you explicitly set your Content-Type to undefined. The solution is to set your content-type to 'application/json' in your post request or to remove @RequestBody annotation. It seems that you try to upload files, the easier would be to remove @RequestBody annotation.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20950346
type: Answer
answers question: http://stackoverflow.com/q/20950346
score: 2

http://stackoverflow.com/q/20859379
type: AnsweredQuestion
upvote count: 19
has title: Cannot import javax.ejb.* packages
tagged with: java
tagged with: eclipse
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/20859558
tagged with: ejb
downvote count: 0
possible better answer: http://stackoverflow.com/a/20859558
has body: I am having trouble in building an EJB session bean. The following packages cannot be found: import javax.ejb.LocalBean; import javax.ejb.Stateful; import javax.ejb.TransactionManagement; import javax.ejb.TransactionManagementType; Some solutions implied adding the libraries j2ee.jar and javaee.jar to the java build path. I am using jdk-7u75-windows-x64 and java_ee_sdk-7-windows-ml and cannot find any of these libraries at the given location($JAVA_HOME\lib). I am using eclipse(kepler) on a Windows 7 x64 machine
favorite count: 0
has answer: http://stackoverflow.com/a/20860867
accepted answer: http://stackoverflow.com/a/20860867
score: 19
tagged with: jakarta-ee

http://stackoverflow.com/comment/31509611
type: Comment
comment on: http://stackoverflow.com/a/20960592
score: 0
type: AnswerComment
has text: @Kambiz If you can add some sample strings to your post with expected output I can better help. Note that it may be due to the incorrect slashes in your pattern from your comment above. They should be backslashes (``\``) not forward slashes (`/`).

http://stackoverflow.com/q/21006651
possible better answer: http://stackoverflow.com/a/21006681
linked to: http://stackoverflow.com/q/94361
has answer: http://stackoverflow.com/a/21006687
has answer: http://stackoverflow.com/a/21006686
linked to: http://stackoverflow.com/q/10244785
downvote count: 0
has title: how overriding works in the following code?
has answer: http://stackoverflow.com/a/21006742
favorite count: 0
answer count: 5
has comment: http://stackoverflow.com/comment/31571191
has answer: http://stackoverflow.com/a/21006712
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21006681
has body: consider the following code in java: public class Superclass { public void printMethod() { System.out.println("Printed in Superclass."); } } Here is a subclass, called Subclass, that overrides printMethod(): public class Subclass extends Superclass { // overrides printMethod in Superclass public void printMethod() { super.printMethod(); System.out.println("Printed in Subclass"); } public static void main(String[] args) { Subclass s = new Subclass(); s.printMethod(); } } The output obtained is the following: Printed in Superclass Printed in Subclass If the subclass is overriding why is superclass println still displaying on screen? It is not suppose only to display the content of the method on the subclass? Why is super not being invoked in the following code if the method is overriding? @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; }
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/21006742
upvote count: 1
type: Question

http://stackoverflow.com/comment/40188983
type: QuestionComment
comment on: http://stackoverflow.com/q/20940132
score: 0
has text: Did my answer help? If yes, please mark it so the topic can be considered closed. If not, please provide some feedback, or an answer of your own.
type: Comment

http://stackoverflow.com/comment/31319742
comment on: http://stackoverflow.com/a/20872651
type: AnswerComment
score: 0
type: Comment
has text: That's a layout file. You should read about XML layout inflation. http://www.jayway.com/2009/03/26/layout-resources-in-android/

http://stackoverflow.com/q/20986525
upvote count: 1
tagged with: slider
has answer: http://stackoverflow.com/a/20986619
accepted answer: http://stackoverflow.com/a/20986619
linked to: http://stackoverflow.com/q/1896030
favorite count: 0
has body: I've looked on google &amp; on every page it's all 'Javascript Sliders'. The only link I could find was Image slider &amp; am curious if there is a newer and/or better way of doing this beings that was asked 4 years ago. If anyone has some tips or knows anything about this thanks.
downvote count: 0
linked to: http://stackoverflow.com/q/9543970
linked to: http://stackoverflow.com/q/13460705
tagged with: swing
type: AnsweredQuestion
score: 1
tagged with: java
has title: Java Image slider?
tagged with: image
type: Question
answer count: 1

http://stackoverflow.com/q/20975534
type: Question
has body: I am using this code of the simulated annealing algorithm in order to solve the traveling salesmen problem. The number of cities is relatively small, i.e. around 30-40. The problem is that at the 1000th iteration I receive the OutOfMemory error message (INSIDE THE FUNCTION "GO"). Why does this happen? How to tackle this issue? package tsptw.logic; import java.util.ArrayList; import java.util.Random; import tsptw.logic.objects.Point; import tsptw.logic.objects.Solution; public class SimulatedAnnealing { private static final double COOLING_ALPHA = 0.95; private static Random rand = new Random(); private static int i = 0; public static Solution solve(Point start, ArrayList&lt;Point&gt; points) { Solution sol = Solution.randomSolution(start, points); double t = initialTemperature(sol, 1000); int frozen = 0; System.out.println("-- Simulated annealing started with initial temperature " + t + " --"); return go(sol, t, frozen); } private static Solution go(Solution solution, double t, int frozen) { if (frozen &gt;= 3) { return solution; } i++; Solution bestSol = solution; System.out.println(i + ": " + solution.fitness() + " " + solution.time() + " " + solution.penalty() + " " + t); ArrayList&lt;Solution&gt; nHood = solution.nHood(); int attempts = 0; int accepted = 0; while (!(attempts == 2 * nHood.size() || accepted == nHood.size())) { Solution sol = nHood.get(rand.nextInt(nHood.size())); attempts++; double deltaF = sol.fitness() - bestSol.fitness(); if (deltaF &lt; 0 || Math.exp(-deltaF / t) &gt; Math.random()) { accepted++; bestSol = sol; nHood = sol.nHood(); } } frozen = accepted == 0 ? frozen + 1 : 0; double newT = coolingSchedule(t); return go(bestSol, newT, frozen); } private static double initialTemperature(Solution solution, double t) { ArrayList&lt;Solution&gt; nHood = solution.nHood(); int accepted = 0; int attempts = nHood.size(); for (Solution sol : nHood) { double deltaF = sol.fitness() - solution.fitness(); if (deltaF &lt; 0 || Math.exp(-deltaF / t) &gt; Math…
tagged with: java
answer count: 6
tagged with: eclipse
tagged with: simulated-annealing
has answer: http://stackoverflow.com/a/20975748
linked to: http://stackoverflow.com/q/1565388
has answer: http://stackoverflow.com/a/20975915
has answer: http://stackoverflow.com/a/20975750
has title: OutOfMemory issue with simulated annealing code
downvote count: 0
has answer: http://stackoverflow.com/a/20975599
favorite count: 0
tagged with: out-of-memory
linked to: http://stackoverflow.com/q/15061364
type: UnansweredQuestion
score: 1
has answer: http://stackoverflow.com/a/20975681
has answer: http://stackoverflow.com/a/20975627
has comment: http://stackoverflow.com/comment/31513311
upvote count: 1

http://stackoverflow.com/a/20912333
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Untested but semi-informed speculation here… It's possible that the document this value came from has since been deleted. Lucene deletions and document updates mark old versions of a document as deleted (or tombstoned) without actually rewriting any of the data on the disk. So an earlier document inserted that term into your index's term dictionary, then was probably updated or deleted. So the term is still in the dictionary, but there are zero current documents which contain it. Issuing an optimize or a commit with expungeDeletes=true should get rid of the extraneous terms.
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/20912225
answers question: http://stackoverflow.com/q/20912225

http://stackoverflow.com/a/20915419
answers question: http://stackoverflow.com/q/20915372
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31400240
type: Answer
upvote count: 3
score: 3
has body: Wether I should create those objects by implementing read/writeObject methods First off, to have entities that you are serializing manage their own threads is the first red flag. Entities that are serialized should most likely be data passing objects only. Business logic and certainly thread tasks should live elsewhere. Having the readObject() method magically fork threads just gives me the willies even thinking about it. I would have the class that is reading these deserialize them and then register them with some sort of entity/task manager. Then the manager would manage the thread pools (think ExecutorService) that run the tasks the entities need to operate appropriately. Entities, especially serialized ones, should not do that on their own. run the both factory methods when I want to create them from scratch and use only the transient factory method for the case I read them from a serialized stream? If you need to precisely manage these objects then you could have the entity manager do the actual construction and task forking I guess. Or just have a register() method there so whenever someone constructs one or deserializes one of these, they register it.
accepted answer of: http://stackoverflow.com/q/20915372

http://stackoverflow.com/q/20868590
answer count: 3
has answer: http://stackoverflow.com/a/20868663
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31311448
has title: How can I stop eclipse to modify .classpath automatically
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/7186676
upvote count: 1
has answer: http://stackoverflow.com/a/20868636
type: Question
has body: I check out a java project from svn repository include .classpath and .project files. And I import these codes into eclipse. But the eclipse will modify the content of .classpath file. How can I stop eclipse to do this? just write off build automatically option?
has answer: http://stackoverflow.com/a/34489049
score: 1
tagged with: java
tagged with: eclipse
tagged with: classpath

http://stackoverflow.com/q/20916333
has body: How do I remove the first digit of an integer? My input is an integer (for example i = 123456789). I then want to remove the first digit, so that i equals 23456789.
has answer: http://stackoverflow.com/a/20916477
linked to: http://stackoverflow.com/q/2051817
answer count: 7
has title: Remove digits from a number in Java
favorite count: 0
has answer: http://stackoverflow.com/a/20916448
score: 9
has answer: http://stackoverflow.com/a/20916509
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20917412
has answer: http://stackoverflow.com/a/20916344
tagged with: integer
tagged with: digit
has comment: http://stackoverflow.com/comment/31402121
downvote count: 1
has answer: http://stackoverflow.com/a/20916521
type: Question
tagged with: java
upvote count: 10
has answer: http://stackoverflow.com/a/20916369

http://stackoverflow.com/comment/31710285
has text: Not yet have idea now.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20945395

http://stackoverflow.com/a/20969665
answers question: http://stackoverflow.com/q/20969292
has comment: http://stackoverflow.com/comment/31502675
accepted answer of: http://stackoverflow.com/q/20969292
type: AcceptedAnswer
downvote count: 0
has body: By digging through sources you can find that this constructor uses Well19937c random generator, which doesn't look thread-safe by itself at the first glance. You can make it thread safe, by explicitly setting the number generator to SynchronizedRandomGenerator which wraps any other random number generator (like Well19937c or Mersenne Twister). Note that by synchronizing access to random number generator with SynchronizedRandomGenerator you'll lose all potential performance benefits and the 'parallel' version will be probably slower than a sequential one because of the synchronization. On the other hand, re-initializing the random distribution on every iteration in parallel will probably re-seed the PRNG multiple times with similar values based on current time, so your results will be skewed. A very general rule of the thumb (and if I'm wrong here, please correct me) is that 99% of the time, unless explicitly stated otherwise, you should probably stick to sequential execution when doing anything that relies on random number generation, as usually PRNGs will store state that might get corrupted when calling them from multiple threads. And unless you're doing expensive computations afterwards, the synchronization (in case of thread-safe stateful PRNGs) will be a bottleneck.
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/q/20946311
tagged with: derby
has answer: http://stackoverflow.com/a/50189965
type: Question
has comment: http://stackoverflow.com/comment/31490419
has body: I have a editing routine that will allow me to create, edit, and save records for a particular database. In this routine, I have a jlable that I use to display an image (imageIcon) that upon initial creation or record editing of each record is loaded from a disk file. Works with no probs. I need to take that imageIcon not the disk file, (along with all associated data for that particular record) and store it in an embedded database (blob type for the image). Database is already created, initialized, and working except for the image storage. After the image is stored, when each record is accessed, the jlable will display the image stored in the database. The original disk file (JPG, PNG, ect) will NOT be available to load. After initial creation of the record(s), the only time that a disk file would be used will be if the user wishes to change the image to a different one. simply - two routines: 1. take an imageIcon, save it to a database blob. 2. Retrieve database blob and display it to the imageIcon.
answer count: 1
has comment: http://stackoverflow.com/comment/31469308
has title: Retrieve and update java derby database blog item
score: 0
has comment: http://stackoverflow.com/comment/31520930
type: UnansweredQuestion
tagged with: blob
tagged with: java
tagged with: database

http://stackoverflow.com/comment/31366501
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20897907
has text: Its not a `ClassNotFoundException`, but an `SQLException`. Please provide the full stacktrace.
score: 0

embedded-resource
tags question: http://stackoverflow.com/q/20863564
tags question: http://stackoverflow.com/q/20872771
tags question: http://stackoverflow.com/q/20995005
tags question: http://stackoverflow.com/q/20962186
tags question: http://stackoverflow.com/q/20916698
tags question: http://stackoverflow.com/q/20865824
tags question: http://stackoverflow.com/q/20873026
tags question: http://stackoverflow.com/q/20880587
tags question: http://stackoverflow.com/q/20977064
type: Tag
tags question: http://stackoverflow.com/q/20884464
tags question: http://stackoverflow.com/q/20886361
tags question: http://stackoverflow.com/q/20976801
tags question: http://stackoverflow.com/q/20853675
tags question: http://stackoverflow.com/q/20876861
tag name: embedded-resource

http://stackoverflow.com/q/20897020
has answer: http://stackoverflow.com/a/49216577
favorite count: 0
has answer: http://stackoverflow.com/a/20897177
answer count: 5
has answer: http://stackoverflow.com/a/21082741
has comment: http://stackoverflow.com/comment/31396098
has comment: http://stackoverflow.com/comment/31534581
linked to: http://stackoverflow.com/q/20877086
possible better answer: http://stackoverflow.com/a/20897061
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31619073
has answer: http://stackoverflow.com/a/20897061
has comment: http://stackoverflow.com/comment/31365009
tagged with: java
has answer: http://stackoverflow.com/a/20948389
upvote count: 88
tagged with: caching
downvote count: 1
has comment: http://stackoverflow.com/comment/31569845
has comment: http://stackoverflow.com/comment/31365045
type: Question
score: 87
has title: Why Integer class caching values in the range -128 to 127?
has body: Regarding my previous Question, Why do == comparisons with Integer.valueOf(String) give different results for 127 and 128? , we know that Integer class has a cache which stores values between -128 and 127. Just wondering, why between -128 and 127? Integer.valueOf() documentation stated that it is "caching frequently requested values" . But are values between -128 and 127 frequently requested for real? I thought frequently requested values were very subjective. Is there any possible reason behind this? The documentation also stated: "[...] and may cache other values outside of this range." How can this be achieved?
has comment: http://stackoverflow.com/comment/31452162
accepted answer: http://stackoverflow.com/a/20948389

http://stackoverflow.com/q/20875535
type: AnsweredQuestion
has body: Trying to install phonegap on Linux Mint. The following is occuring: psukardi@psukardi-XPS-M1530 ~/Development/my-app $ phonegap run android [phonegap] detecting Android SDK environment... [phonegap] using the local environment [phonegap] adding the Android platform... [error] An error occured during creation of android sub-project. /home/psukardi/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:126 throw e; ^ Error: An error occurred while listing Android targets at /home/psukardi/.cordova/lib/android/cordova/3.3.0/bin/lib/check_reqs.js:87:29 at _rejected (/home/psukardi/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:808:24) at /home/psukardi/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:834:30 at Promise.when (/home/psukardi/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:1079:31) at Promise.promise.promiseDispatch (/home/psukardi/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:752:41) at /home/psukardi/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:574:44 at flush (/home/psukardi/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:108:17) at process._tickCallback (node.js:415:13) psukardi@psukardi-XPS-M1530 ~/Development/my-app $ Thoughts?
has answer: http://stackoverflow.com/a/21343693
tagged with: java
linked to: http://stackoverflow.com/q/20576704
type: Question
has title: An error occured during creation of android sub-project
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
duplicate of: http://stackoverflow.com/q/20576704
tagged with: cordova
score: 1
accepted answer: http://stackoverflow.com/a/21343693
upvote count: 1

http://stackoverflow.com/comment/31313252
type: Comment
has text: I cannot use HashSet, also its very good to know. its an excersize from the University. Just wondering If I done it right and its O(logN) complexity/
comment on: http://stackoverflow.com/a/20869514
score: 0
type: AnswerComment

http://stackoverflow.com/a/20957584
downvote count: 0
answers question: http://stackoverflow.com/q/20957487
type: Answer
has body: Your generic definition isn't correct. You're trying to set the boundaries to &lt;T extends Iterable&lt;T&gt;&gt; but the generic parameter (Integer) is not the T. You can get it working by introducing a separate generic parameter: one to indicate the collection and one to indicate the collection's values. Sidenote: You don't need T[] at all. You just want T. public class Main { public static void main(String[] args) { ArrayList&lt;Integer&gt; l = new ArrayList&lt;&gt;(); l.add(1); l.add(5); l.add(3); l.add(2); print(l); } public static &lt;S, T extends Iterable&lt;S&gt;&gt; void print(T list){ for (Object element : list){ System.out.println(element); } } } Output 1 5 3 2
score: 4
upvote count: 4

http://stackoverflow.com/comment/31322668
has text: Hello, do you have any idea why this doesn't work in Java. I already double escaped the . character
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20872313

http://stackoverflow.com/q/20904562
favorite count: 0
tagged with: soap
tagged with: spring
score: 2
downvote count: 0
type: UnansweredQuestion
tagged with: opencms
tagged with: web-services
has body: I am new to OpenCms and I am doing some POC on it.I have googled a lot but I didn't find anything regarding web services integration with opencms. I want to know how we can integrate Web services with openCms.
has answer: http://stackoverflow.com/a/23908679
tagged with: java
type: Question
upvote count: 2
has title: Web Services integration with opencms
answer count: 1

http://stackoverflow.com/a/20916068
type: Answer
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/20884823
has body: Provide a row id, override Button.ClickListener, and use the id in the click listener. Object rowId = new Object(); Button button = new Button("Delete"); button.addClickListener(new RowDeleteListener(rowId)); //populate cells in the row, add the button &amp; whatever table.addItem(row, rowId); public class RowDeleteListener implements Button.ClickListener { Object rowId; public RowDeleteListener(Object rowId) { this.rowId = rowId; } public void buttonClick(ClickEvent event) { table.removeItem(rowId); } } Or André Schild’s solution, which is to use setData(rowId) on the button. Button button = new Button("Delete"); button.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { table.removeItem(getData()); } }); //Populate row stuff. button.setData(table.addItem(row, null)); I like the first solution slightly better because it's more obvious what's going on, and also because the button has the correct row id before it gets added to the table instead of after. Or, if you feel like creating something obnoxious: you could use the Button object as the id for the row. Button button = new Button("Delete"); button.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { table.removeItem(this); } }); //populate row stuff, including adding the button to the row. table.addItem(row, button); I didn't test or compile any of these so... you know...

http://stackoverflow.com/comment/31289862
score: 0
comment on: http://stackoverflow.com/q/20857460
has text: yes i am adding textview dynamically to the table layout
type: QuestionComment
type: Comment

http://stackoverflow.com/a/21001400
type: Answer
answers question: http://stackoverflow.com/q/21001072
has body: Set a BreakPoint in the first source code line of your getHowManyNodes() method, start your program in debug mode and try to figure out where the error comes from by using the short cut keys (Eclipse) F5 -> StepInto and F6 -> StepOver. Your source provided looks fine and shouldn't cause any problems. By debugging your application via Eclipse or any other IDE, you should easily find such errors.
score: 0

http://stackoverflow.com/q/20987481
has body: My project doesn't reference the groovy-all-1.8.3.jar, and the jar is not in the maven dependency tree and .classpath file. When the project is imported to Eclipse, it notices that the groovy-all-1.8.3.jar is referenced. How can the jar be referenced?
tagged with: java
tagged with: eclipse
tagged with: classpath
type: Question
has title: Why the Groovy jar be referenced in Eclipse?
score: 0
has answer: http://stackoverflow.com/a/20987524
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/a/20988276
has body: You can use 32-bit JDK on 64-bit Operating System, but you can't use 64-bit JDK on 32-bit Operating System
type: Answer
answers question: http://stackoverflow.com/q/20988244
score: 0

http://stackoverflow.com/q/20968173
tagged with: jpa
answer count: 0
downvote count: 0
has title: Mapping to a composite unique (not primary) key in Hibernate
linked to: http://stackoverflow.com/q/11206000
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/31535309
has comment: http://stackoverflow.com/comment/31501426
has body: I have two classes - USER and ROLE. There are corresponding tables in the database, and a table called USER_ROLE that links the two. USER has a primary key on column "id", and a composite unique key on columns "realm" and "realm_user_id". ROLE has a primary key on column "role_id" USER_ROLE has 3 columns - role_id, realm, realm_user_id. role_id references role_id in the ROLE table, and (realm,realm_user_id) reference the composite key in USER. I don't have access to the DB, so I can't update the schema. There is a many-to-many relationship between users and roles. I want to be able to call getRoles() on User, and getUsers() on Role. class User: @Entity @Table(name="USER") public class User { ..other fields.. @ManyToMany(fetch = FetchType.LAZY, targetEntity=Role.class) @JoinTable(name = "USER_ROLE", joinColumns = { @JoinColumn(name = "realm", nullable = false, updatable = false), @JoinColumn(name = "realm_user_id", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "role_id", nullable = false, updatable = false) }) private Set&lt;Role&gt; roles; Class Role: @ManyToMany(fetch = FetchType.LAZY, cascade={CascadeType.PERSIST,CascadeType.MERGE}, targetEntity=User.class ) @JoinTable(name = "USER_ROLE", joinColumns = { @JoinColumn(name = "role_id", nullable = false, updatable = false) }, inverseJoinColumns={ @JoinColumn(name="realm",nullable=false, updatable=false), @JoinColumn(name="realm_user_id",nullable=false, updatable=false) }) private Set&lt;User&gt; users; I'm getting the following error: A Foreign key refering User from Role has the wrong number of column. should be 1 I tried creating a separate class containing realm and realm_user_id, referenced in the @IdClass annotation, but that failed as User already has a primary key on id. I tried using the mappedBy annotation, but that didn't work either.
upvote count: 2
tagged with: spring
has comment: http://stackoverflow.com/comment/31511827
tagged with: java
tagged with: hibernate
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31504352
score: 2

http://stackoverflow.com/q/20952058
tagged with: java
tagged with: jpanel
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31469151
has body: Is it possible to get the parent JFrame object from JPanel class?? Actually I am trying to make a GUI using NetBeans.The GUI has a Frame and Two panels. 1) Login Panel (having two text field and button) 2) Second Panel When JFrame loaded, I add LoginPanel in it initially. public ParentJFrame() { //in constructor initComponents(); this.setLayout(new BorderLayout()); this.setBounds(300,300, 300, 300); this.getContentPane().add(new LoginPanel()); } After click on button (of LoginPanel) , I am trying to remove LoginPanel from JFrame and adding SecondPanel. Now I am removing LoginPanel and adding SecondPanel in LoginPanel class where I can access the username , password fields but here I am unable to get the JFrame object from which I have to remove this component. If I try this in ParentJFrameClass then it is not possible for me to access username , password field's value. (As this is the structure provided by netbeans) So what Should I do now? What would be the solution in this case I hope I have explained the problem in detail but in case if anything is not clear please let me know Experts Please help
has comment: http://stackoverflow.com/comment/31469465
answer count: 1
tagged with: netbeans-7
type: Question
has comment: http://stackoverflow.com/comment/31469193
has comment: http://stackoverflow.com/comment/31469128
has answer: http://stackoverflow.com/a/20952760
tagged with: jframe
has comment: http://stackoverflow.com/comment/31469251
score: 0
has title: Get Parent Frame object from JPanel object
tagged with: swing

http://stackoverflow.com/a/21006349
type: Answer
score: 0
has body: Pseudocode: Map jsonMain = JSONParser.parse(myJSONSourceString); Map numberedEntry = (Map)(jsonMain.get("3203008")); List entries = (List)(numberedEntry.get("entries")); for (int i = 0; i &lt; entries.size(); i++) { Map theEntry = (Map)(entries.get(0)); String queueType = (String)(theEntry.get("queueType")); String playerOrTeamName = (String)(theEntry.get("playerOrTeamName")); if (queueType.equals("RANKED_SOLO_5x5") &amp;&amp; (playerOrTeamName.equals("Invicterr")) { Number leaguePoints = (Number)(theEntry.get("leaguePoints")); int leaguePointsValue = leaguePoints.intValue(); String tier = (String)(theEntry.get("tier")); String rank = (String)(theEntry.get("rank")); // Do something with the values break; } } The precise types and method names (and whether casting is needed) will depend on which JSON kit you use.
answers question: http://stackoverflow.com/q/21004824

http://stackoverflow.com/a/21271658
score: 0
has body: You must either set a preferred size on the frame first or change the grow and fill. pack() only works if you are packing after formdebugpanel loaded its components.
answers question: http://stackoverflow.com/q/20866756
type: Answer

http://stackoverflow.com/q/20860330
has answer: http://stackoverflow.com/a/20860417
accepted answer: http://stackoverflow.com/a/20860350
type: AnsweredQuestion
has body: First I am really sorry if there is already an answer out there but I have tried them and they do not work. I am converting a EditText to an int then adding 1 and displaying it. I know that it is the conversion which is causing the app to crash because I have tried displaying it just as a String without changing it and it works fine and the EditText has the number attribute. Any help would be appreciated. import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.app.Activity; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final EditText age; Button accept; final TextView ageTest; age = (EditText) findViewById(R.id.ageEdit); accept = (Button) findViewById(R.id.button1); ageTest = (TextView) findViewById(R.id.ageTest); accept.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub int ageInt = Integer.valueOf(age.getText().toString()); ageInt++; ageTest.setText(ageInt); } }); } }
possible better answer: http://stackoverflow.com/a/20860417
downvote count: 1
type: Question
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/20860350
tagged with: int
answer count: 2
has title: Crash when converting String to Int Android
upvote count: 0
tagged with: string
favorite count: 0
tagged with: android

http://stackoverflow.com/comment/31411753
comment on: http://stackoverflow.com/a/20921601
has text: @RossDrew Originally I had said that his edit would still give him the wrong output, but I was mistaken on that point.
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/31457752
comment on: http://stackoverflow.com/a/20945765
has text: You should probably look at the comments above because someone's already linked to the Wikipedia article on selection algorithms and it tells you about a O(N) selection algorithm.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/25065510
answers question: http://stackoverflow.com/q/20989044
score: 0
type: Answer
has body: I ran in to the same problem. To fix this, you will need to edit the cobertura-merge.bat in a text editor. The last line looks something like this: java -cp "%COBERTURA_HOME%cobertura.jar;%COBERTURA_HOME%lib\asm-3.3.1.jar;..... The jar file names in this command most likely do not match the jar file names in your cobertura_home\lib. Example: In the command above, from the batch file, it references 'cobertura.jar' If you look in the lib folder, the actual name of the file is 'cobertura-2.0.3.jar The same goes for the other jar files. So you will have to change the bat file, or the file names, to make them match.

http://stackoverflow.com/comment/31537413
type: Comment
has text: It worked, thanks. As I reveice a list of entities instead of a list of ids, is there any way to perform the same operation without having to generate the list of ids?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/20985128

http://stackoverflow.com/a/29444211
has body: You need to set your jre class path.
answers question: http://stackoverflow.com/q/20891089
score: 0
type: Answer

http://stackoverflow.com/q/20864211
has comment: http://stackoverflow.com/comment/31303668
has comment: http://stackoverflow.com/comment/31316292
type: Question
has comment: http://stackoverflow.com/comment/31303702
has comment: http://stackoverflow.com/comment/31314551
has comment: http://stackoverflow.com/comment/31303662
has answer: http://stackoverflow.com/a/20864253
has comment: http://stackoverflow.com/comment/31303687
has comment: http://stackoverflow.com/comment/31303675
has answer: http://stackoverflow.com/a/20864250
favorite count: 0
has body: I am "playing around" with Java, watching tutorials and trying to get the hang of it. For this question, I'm trying to figure out how I can take a variable from another class and use it in my main one, without making the initial variable public. Here is the code: I am trying to get int x equal to 5 (as seen in the setNum() method), but when it prints it gives me 0. Main Class: package getVarTest; public class Main { public static void main (String[]args){ Vars varsObject = new Vars(); int x = varsObject.getNum(); System.out.println(x); } } Variable Class: package getVarTest; public class Vars { private int num; public void setNum(int x){ this.num = 5; } public int getNum(){ return num; } } So, as you can see I am trying to take the private int num and make the int x in the main class equal to it.
has comment: http://stackoverflow.com/comment/31303650
has comment: http://stackoverflow.com/comment/31303659
has comment: http://stackoverflow.com/comment/31303669
has answer: http://stackoverflow.com/a/20864242
score: 0
has comment: http://stackoverflow.com/comment/31317400
accepted answer: http://stackoverflow.com/a/20864250
upvote count: 1
possible better answer: http://stackoverflow.com/a/20864234
has title: How do I get some variable from another class in Java?
downvote count: 1
has answer: http://stackoverflow.com/a/20864234
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20864441
tagged with: java
has answer: http://stackoverflow.com/a/20864236
answer count: 6

http://stackoverflow.com/q/21013286
upvote count: 0
has comment: http://stackoverflow.com/comment/31583435
has comment: http://stackoverflow.com/comment/31605215
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31583460
linked to: http://stackoverflow.com/q/1195206
has answer: http://stackoverflow.com/a/21015007
has comment: http://stackoverflow.com/comment/31583442
type: AnsweredQuestion
tagged with: netbeans
has comment: http://stackoverflow.com/comment/31605369
has body: I am so used to C++ &amp; C# where I can type bool. In Java, I am required to type boolean. Also, it requires me to type String with uppercase 'S'. I would love to be able to create project wide aliases for these variable types to enable me to create variables by typing bool and string. Do you have any ideas?
downvote count: 1
has comment: http://stackoverflow.com/comment/31605121
type: Question
has comment: http://stackoverflow.com/comment/31586736
has comment: http://stackoverflow.com/comment/31605721
tagged with: java
accepted answer: http://stackoverflow.com/a/21015007
score: -1
has comment: http://stackoverflow.com/comment/31583860
has title: How can I change variable type names in Java using NetBeans?

http://stackoverflow.com/comment/31690516
comment on: http://stackoverflow.com/q/21015677
has text: @Sergiu Dumitriu thanks for youresponse,it is a set. Also I tried with $sorter.sort() function as well can you tell where i went wrong
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31513713
comment on: http://stackoverflow.com/a/20975560
type: Comment
score: 0
type: AnswerComment
has text: He is asking how to write to a *single* log file (from multiple threads), and you are showing how to write to *multiple* log files. Not to mention the other questions and the fact, that using *any* existing logging facility and properly configured handlers/appenders is much better solution that using own custom `OutputStreams`.

http://stackoverflow.com/q/20896177
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/20896204
type: Question
tagged with: java
has title: Can not resolve symbol, abstract class factory
answer count: 2
has body: I'm new to Java and I'm following along with Test Driven Development by Example. In chapter 8 we're exacting subclasses franc and dollar into Money. I've created the factory methods for franc and dollar like so but when I attempt to run the test I get "can not resolve symbol dollar" (or franc) for test lines: Money five= new Money.dollar(5); Money four= new Money.franc(5); I've started over from scratch twice and tried googling it, but I'm not sure what I'm missing. Money class: public abstract class Money { abstract Money times(int multiplier); protected int amount; static Money dollar(int amount){ return new Dollar(amount); } static Money franc(int amount){ return new Franc(amount); } public boolean equals(Object object){ Money money = (Money) object; return amount == money.amount &amp;&amp; getClass().equals(money.getClass()); } } Franc (Dollar is the same): public class Franc extends Money { Franc(int amount){ this.amount = amount; } Money times(int multiplier){ return new Franc(amount * multiplier); } } Test: import org.junit.Test; import static org.junit.Assert.*; public class MoneyTest { @org.junit.Test public void testMultplication(){ Money five= new Money.dollar(5); assertEquals(new Dollar(10), five.times(2)); assertEquals(new Dollar(15), five.times(3)); Money four= new Money.franc(5); assertEquals(new Franc(10), four.times(2)); assertEquals(new Franc(15), four.times(3)); } }
upvote count: 1
downvote count: 0
possible better answer: http://stackoverflow.com/a/20896204
has answer: http://stackoverflow.com/a/20896188
favorite count: 0
accepted answer: http://stackoverflow.com/a/20896188
linked to: http://stackoverflow.com/q/1484445

http://stackoverflow.com/q/20973961
score: 2
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/20974620
has title: Shared JPA persistence.xml among several projects
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/31510275
type: AnsweredQuestion
tagged with: java
tagged with: persistence.xml
type: Question
tagged with: jpa
has comment: http://stackoverflow.com/comment/31511312
has answer: http://stackoverflow.com/a/20974620
has body: I have several small java projects that access to same DB. Is it possible to have one persistence.xml file, which is somewhere on the file system (not included in any jars, wars, ears, etc.) and it is still visible to the projects? The reason is that there is a requirement that the persistence.xml has to be easily replaceable and configurable and the configuration has to be done on one place for all projects.

http://stackoverflow.com/comment/31521700
has text: @PeterLawrey yeah actually this system is running more than a decade (since late 90s). Now its client base has increased manifold and the system shows errors as a result. Why we cannot change the production environment is - It will take a long time to approve as many parties approval needed, and they are not actually willing to make any change.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20968468

http://stackoverflow.com/a/20880637
type: Answer
has body: Yes, because the House class HAS-A Dog and Dog IS-A (extends) Animal.....
answers question: http://stackoverflow.com/q/20880166
score: 0

http://stackoverflow.com/a/20919498
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: That line of code is outside the method - so it's render that's not being found. Additionally, you have a spurious ; in your for loop declaration: for (int y = 0; y&lt;render.height; y++); ^--- You don't want this! It's not clear why you've got quite so many braces, but I suspect you actually want: // Note: I've changed the name of the third parameter from xoffset to yOffset public void draw(Render render, int xOffset, int yOffset) { for (int y = 0; y &lt; render.height; y++) { int yPix = height + yOffset; pixels[xPix + yPix * width] = Render.pixels[x + y * render.width]; } } It's not clear where you expect xPix to come from either - did you mean to use xOffset?
accepted answer of: http://stackoverflow.com/q/20919424
answers question: http://stackoverflow.com/q/20919424

http://stackoverflow.com/comment/31539743
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20989719
has text: Why don't you look at the source code if `TimeZone.getDefault`? You can find it in `src.zip` in your JDK installation directory.

http://stackoverflow.com/comment/31427097
type: QuestionComment
has text: Yes, because I will be reading text files and writing text files. So with my updated code, (ArrayIndexOutOfBoundsException in use), It works great using the args, "ciphers.txt plain.txt" and runs fine. :)
score: 1
comment on: http://stackoverflow.com/q/20929621
type: Comment

http://stackoverflow.com/q/20936439
tagged with: google-drive-api
tagged with: android
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31490509
has answer: http://stackoverflow.com/a/20967676
has title: Uploading google drive is giving exception
type: Question
has answer: http://stackoverflow.com/a/20987067
answer count: 2
possible better answer: http://stackoverflow.com/a/20967676
has body: 01-05 22:14:54.106: W/System.err(5907): com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAuthIOException 01-05 22:14:54.106: W/System.err(5907): at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential$RequestHandler.intercept(GoogleAccountCredential.java:224) 01-05 22:14:54.106: W/System.err(5907): at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:836) 01-05 22:14:54.106: W/System.err(5907): at com.google.api.client.googleapis.media.MediaHttpUploader.executeCurrentRequest(MediaHttpUploader.java:456) 01-05 22:14:54.106: W/System.err(5907): at com.google.api.client.googleapis.media.MediaHttpUploader.executeCurrentRequestWithBackOffAndGZip(MediaHttpUploader.java:478) 01-05 22:14:54.106: W/System.err(5907): at com.google.api.client.googleapis.media.MediaHttpUploader.executeUploadInitiation(MediaHttpUploader.java:428) 01-05 22:14:54.106: W/System.err(5907): at com.google.api.client.googleapis.media.MediaHttpUploader.upload(MediaHttpUploader.java:326) 01-05 22:14:54.106: W/System.err(5907): at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:420) 01-05 22:14:54.106: W/System.err(5907): at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:345) 01-05 22:14:54.106: W/System.err(5907): at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:463) 01-05 22:14:54.106: W/System.err(5907): at com.example.driveproj040114.MainActivity$1.run(MainActivity.java:100) 01-05 22:14:54.106: W/System.err(5907): at java.lang.Thread.run(Thread.java:841) 01-05 22:14:54.106: W/System.err(5907): Caused by: com.google.android.gms.auth.GoogleAuthException: Unknown 01-05 22:14:54.106: W/System.err(5907): at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source) 01-05 22:14:54.106: W/System.err(5907): at com.google.android.gms.a…
accepted answer: http://stackoverflow.com/a/20987067

http://stackoverflow.com/comment/31417785
type: Comment
type: QuestionComment
has text: The JSON is invalid and your code snippet wouldn't even compile. Please post a [SSCCE](http://sscce.org) that demonstrates the problem you are having.
score: 0
comment on: http://stackoverflow.com/q/20924965

http://stackoverflow.com/comment/31510685
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20973786
has text: @ElliottFrisch Works perfectly! Thanks a lot. You should post it as an answer so that I can accept the answer.

http://stackoverflow.com/a/20962124
downvote count: 0
score: 22
type: AcceptedAnswer
has body: You need to have the EclipseLink jars (2.4.0 or newer) on your class path, and a jaxb.properties file in the same package as the classes used to bootstrap theJAXBContext with the following entry: javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory Below is a link to an example on GitHub that you can run to see everything working: https://github.com/bdoughan/blog20110819
has comment: http://stackoverflow.com/comment/53813111
accepted answer of: http://stackoverflow.com/q/20962053
type: Answer
answers question: http://stackoverflow.com/q/20962053
has comment: http://stackoverflow.com/comment/31491722
upvote count: 22
has comment: http://stackoverflow.com/comment/47178804
has comment: http://stackoverflow.com/comment/52326597

http://stackoverflow.com/comment/31476084
has text: @brano I put the error on the Question!
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/20955488

http://stackoverflow.com/q/20864199
has answer: http://stackoverflow.com/a/20864243
tagged with: this
has title: this in equals method
type: Question
favorite count: 0
has answer: http://stackoverflow.com/a/20864225
has comment: http://stackoverflow.com/comment/31303636
has comment: http://stackoverflow.com/comment/31303627
tagged with: equals
upvote count: 3
score: 0
has comment: http://stackoverflow.com/comment/31303664
possible better answer: http://stackoverflow.com/a/20864209
has body: I am looking at the equals method, and I see this and I don't understand what it means...I do understand them when I see it in constructors and some methods but its not clear to me when they are in equals method something like this: (obj == this) ...what does this mean here ? where does it come from ? I understand when it says something like this.name = name; from a method like this @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj == null || obj.getClass() != this.getClass()) { return false; } sorry it might be a duplicate but I couldnt find anything...
has answer: http://stackoverflow.com/a/20864209
tagged with: java
downvote count: 3
accepted answer: http://stackoverflow.com/a/20864225
has answer: http://stackoverflow.com/a/20864249
answer count: 4
type: AnsweredQuestion

http://stackoverflow.com/a/20958573
upvote count: 1
answers question: http://stackoverflow.com/q/20958360
has comment: http://stackoverflow.com/comment/31530668
has comment: http://stackoverflow.com/comment/31482770
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31498718
has body: How about choosing the image from the most central item? Since k-means partitions around centroids, you can treat the instance closest to the centroid to be the best representative in your data. (If you would use this in the clustering, you would get k-medoids). Since k-means can degenerate badly, you may want to check that the cluster elements are nearer to the cluster center than distance between two cluster centers is. If cluster centers are closer to each other than your data, your k-means result has degenerated.
score: 1

http://stackoverflow.com/comment/31320319
type: QuestionComment
comment on: http://stackoverflow.com/q/20873026
score: 0
has text: What is the structure of the project?
type: Comment

http://stackoverflow.com/q/20961923
has comment: http://stackoverflow.com/comment/31488691
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/20962338
downvote count: 0
type: UnansweredQuestion
has title: Java generics - Map with generic type as key
has answer: http://stackoverflow.com/a/20962184
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/31489187
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/31488730
has comment: http://stackoverflow.com/comment/31488644
has comment: http://stackoverflow.com/comment/31488836
has comment: http://stackoverflow.com/comment/31488689
has answer: http://stackoverflow.com/a/20962711
has answer: http://stackoverflow.com/a/21000269
has body: I have following maps. Both maps hold instance of ClassA/ClassB and instance of CellProcessor as value. Map&lt;ClassA, CellProcessor&gt; classAProcessors; Map&lt;ClassB, CellProcessor&gt; classBProcessors; I want to create a map which will store above maps as value and with key as class type of ClassA/ClassB so that when I do map.get(ClassA.class) it returns me Map&lt;ClassA, CellProcessor&gt; classAProcessors I wrote this method to create final map but it does not seem to be working. public static &lt;T&gt; Map&lt;Class&lt;T&gt;, Map&lt;T, CellProcessor&gt;&gt; getOutputProcessors(){ Map&lt;ClassA, CellProcessor&gt; classAProcessors = getOutputCellProcessorsForClassA(); Map&lt;Class&lt;T&gt;, Map&lt;T, CellProcessor&gt;&gt; processors = Maps.newLinkedHashMap(); processors.put(ClassA.class, classAProcessors ); //error here return processors; } Compiler error: The method put(Class&lt;T&gt;, Map&lt;T,CellProcessor&gt;) in the type Map&lt;Class&lt;T&gt;,Map&lt;T,CellProcessor&gt;&gt; is not applicable for the arguments (Class&lt;ClassA&gt;, Map&lt;ClassA,CellProcessor&gt;) Could someone help me in understanding what's wrong here. Thanks
has comment: http://stackoverflow.com/comment/31489594
has comment: http://stackoverflow.com/comment/31488662
tagged with: generics

http://stackoverflow.com/a/20924882
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/31417604
has comment: http://stackoverflow.com/comment/31417568
has comment: http://stackoverflow.com/comment/31417627
downvote count: 0
has body: Your SPResolver class is a @Service with default singleton scope. As such, it will be initialized at startup. Your User bean is request scope so a new instance can be created for each request. However, at startup, there is no such request and therefore a User bean cannot be injected, because it does not exist. That may not be the root cause here. It seems more likely that you're not scanning the right configs, but you will get the above problem eventually.
answers question: http://stackoverflow.com/q/20924824

http://stackoverflow.com/comment/31499676
type: AnswerComment
type: Comment
has text: replace `String result = null;` with `StringBuilder result = new StringBuilder();` and replace `result = st3` with the code I suggested in my post. Lastly, replace `i.putExtra("result", result);` with `i.putExtra("result", result.toString());`
comment on: http://stackoverflow.com/a/20967944
score: 0

http://stackoverflow.com/a/44870143
has body: If you're not interested in the type of the class being modelled by the Class object, an alternative to suppressing or ignoring the warnings is to use the &lt;?&gt; notation as follows: Class&lt;?&gt;.
has comment: http://stackoverflow.com/comment/84971132
downvote count: 1
answers question: http://stackoverflow.com/q/20949686
upvote count: 0
score: -1
type: Answer

http://stackoverflow.com/comment/31327208
score: 0
type: QuestionComment
has text: http://www.javalobby.org/java/forums/t19468.html
type: Comment
comment on: http://stackoverflow.com/q/20876684

http://stackoverflow.com/q/20914548
has body: I'm using this code to upload an image from my android app to the user's google drive account. But how can I modify the code to upload the image to folder named "myFolder"? meaning to that folder is exist and if not - create such folder and then upload the image there.
tagged with: java
has answer: http://stackoverflow.com/a/20917799
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/20917799
has title: how to upload an image from my android app to a specific folder on google drive
tagged with: android
tagged with: google-drive-api
type: AnsweredQuestion
type: Question

http://stackoverflow.com/comment/31439207
score: 0
has text: The code matters. Post the code. And the stack trace of the exception. But be aware that you can't write to a file inside a jar file.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20936174

http://stackoverflow.com/comment/31299087
score: 3
comment on: http://stackoverflow.com/q/20861984
has text: You could also simply expose the constants as `public` rather than `private` to avoid repetition.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31385734
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20907455
type: Comment
has text: The second code snipped should work - it will find the occurrences in the input string and for each encounter it will give your the `Pass|Fail` and also strip out the entire section.

http://stackoverflow.com/q/20877706
tagged with: http://stackoverflow.com/tag/json
type: Question
has comment: http://stackoverflow.com/comment/31329007
has body: I am using apache camel for rest service calls from spring Now we need to send the json request in our body to be passed in GZIP using apache camel. I tried by adding CONTENT_ENCODING as gzip, but it does not work. Please see the code public void process(Exchange exchange) { exchange.setPattern(ExchangePattern.InOut); exchange.setProperty(Exchange.CHARSET_NAME, "UTF-8"); Message inMessage = exchange.getIn(); inMessage.setHeader(ACCEPT_HEADER, "application/json"); inMessage.setHeader(CONTENT_TYPE, "application/json"); inMessage.setHeader(Constants.ACCEPT_ENCODING, Constants.ACCEPT_ENCODING_TYPE); inMessage.setHeader(Exchange.CONTENT_ENCODING, "gzip"); inMessage.setBody(body); In the camelContext.xml, we have defined <from uri="direct:setUpload" /> cxfrs://{{uploadSample.url}}?throwExceptionOnFailure=false <unmarshal ref="sampleParser" /> Do we need to set any other things to gzip the body JSON request Please help how to correct this Regards Hari
tagged with: apache-camel
has comment: http://stackoverflow.com/comment/31366944
upvote count: 2
has title: Gzip apache camel request for rest
tagged with: apache
answer count: 1
has comment: http://stackoverflow.com/comment/31338748
has comment: http://stackoverflow.com/comment/31331000
favorite count: 0
tagged with: rest
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/10784422
has answer: http://stackoverflow.com/a/46170303
score: 2
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/31533813
has text: Have you tried to go step-by-step under debugger and examine all the intermediate values.
type: Comment
comment on: http://stackoverflow.com/q/20984515
score: 0
type: QuestionComment

exec-maven-plugin
tags question: http://stackoverflow.com/q/20949618
type: Tag
tag name: exec-maven-plugin

http://stackoverflow.com/q/20913400
type: Question
has body: I am trying to populate a Spinner with a JSON object that I am pulling from a restful API. But I cannot figure out how to get Adapter working for the spinner. I have tried getActivity() and I've tried the this keyword. Neither one has worked and I can't find anything on Google where people are trying to update the spinner in this context. Here is the code I am using. http://pastebin.com/bQWDHekB. When I just getActivity() it says, The method getActivity() is undefined for the type new Runnable(){} but when I use this is says The constructor ArrayAdapter&lt;String&gt;(new Runnable(){}, int, String[]) is undefined -- EDIT -- As per Maartens' answer, I found that using MainActivity.this worked better than getApplicationContext(). When you use getApplicationContext() it tends to use a different style and made my spinner have white text on a white background. Hopefully this helps someone else who had the same troubles as me.
score: 0
answer count: 1
tagged with: spinner
has comment: http://stackoverflow.com/comment/31473103
has title: The method getActivity() is undefined for the type new Runnable(){}
tagged with: android
has comment: http://stackoverflow.com/comment/31396453
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20913453
accepted answer: http://stackoverflow.com/a/20913453

http://stackoverflow.com/q/20925253
has comment: http://stackoverflow.com/comment/31418577
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/28058258
possible better answer: http://stackoverflow.com/a/27647165
tagged with: java
has comment: http://stackoverflow.com/comment/53916080
type: Question
has title: Android Studio failed to load JVM on Mac OSX (Mavericks)
downvote count: 0
answer count: 6
has answer: http://stackoverflow.com/a/20928290
has answer: http://stackoverflow.com/a/28255792
has answer: http://stackoverflow.com/a/27502664
tagged with: macos
score: 30
favorite count: 0
linked to: http://stackoverflow.com/q/7669899
upvote count: 30
has answer: http://stackoverflow.com/a/28182401
linked to: http://stackoverflow.com/q/27369269
has answer: http://stackoverflow.com/a/27647165
has body: I am trying to setup Android Studio on my Mac. It is running OSX 10.9.1 Mavericks. I have installed the latest JDK (at the time of writing 1.7 update 45), and I installed Android Studio. I use Java 7 because I have some Java applications I have to run and they require 1.7. I have not installed Java 1.6, because it is ancient and old. Launching Android Studio from any launcher does literally nothing. Activity Manager never shows it running. I do not want to install Java 1.6. I did some work and tried to run the executable via command line through the package contents, and for both executables, I get these messages: I am unsure what I am supposed to do to fix this error. I'm not very adept on a Mac (still somewhat new to it, and its confusing to do power user stuff on this) so if anyone can help me figure it out that'd be great. I'm on the 2013 Macbook Air with plenty of resources for this to run. Update: This also applies to Yosemite, El Capitan, and all the other versions of OSX that can run Android Studio.
accepted answer: http://stackoverflow.com/a/20928290
tagged with: android-studio

http://stackoverflow.com/a/20899222
upvote count: 1
answers question: http://stackoverflow.com/q/20899117
type: Answer
downvote count: 0
score: 1
has body: You can use VisualVM or jconsole.

http://stackoverflow.com/q/20870649
tagged with: android
has comment: http://stackoverflow.com/comment/31316235
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31316614
type: Question
has title: java.lang.NullPointerException at com.a.a.k.f(Unknown Source)
score: 0
has comment: http://stackoverflow.com/comment/31315760
has body: I ahve some apps with tasget sdk version 18 (android 4.3). I have 4.3 SDK installed in eclipse. And it works fine on my Nexus 4 with custom 4.3 rom. But when I try to install it on my Nexus 4 with custom 4.4 rom, I get force close with this erron in my google play console: java.lang.NullPointerException at com.a.a.k.f(Unknown Source) at com.a.a.d.run(Unknown Source) at java.lang.Thread.run(Thread.java:841) I have some intro screen with Enter button to go to my main activity. When I click this button I get this force close. IS this because of the 4.4 rom, and my 4.3 target sdk version?
has comment: http://stackoverflow.com/comment/31316414
type: UnansweredQuestion

http://stackoverflow.com/q/20891176
has comment: http://stackoverflow.com/comment/31354387
has answer: http://stackoverflow.com/a/20891548
tagged with: sequences
has answer: http://stackoverflow.com/a/20891628
has comment: http://stackoverflow.com/comment/31354214
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31380779
possible better answer: http://stackoverflow.com/a/20891836
has comment: http://stackoverflow.com/comment/31354750
has comment: http://stackoverflow.com/comment/31354076
tagged with: java
has answer: http://stackoverflow.com/a/20891807
has answer: http://stackoverflow.com/a/20891836
tagged with: thread-safety
has title: Does AtomicInteger really produce atomic integer?
accepted answer: http://stackoverflow.com/a/20891548
type: Question
has comment: http://stackoverflow.com/comment/31365041
has body: I googled for AtomicInteger and I saw someone said we can use AtomicInteger(AtomicLong) for memory sequencer (http://www.cs.hut.fi/u/tlilja/multicore/slides/java_multicore.pdf). Here is my test: public class TestAtomicInteger { public static void main(String[] args) { final AtomicInteger sequencer = new AtomicInteger(1); final Set&lt;Integer&gt; integers = new HashSet&lt;&gt;(); //final Set&lt;Integer&gt; integers = new ConcurrentSkipListSet&lt;&gt;(); final Runnable task = new Runnable() { @Override public void run() { int next = sequencer.getAndIncrement(); integers.add(next); System.out.println(integers.size()); } }; for (int i = 0; i &lt; 1000; i++) { Thread t = new Thread(task); t.start(); } } } After run this code for many times I found that sometime total of atomic output is not 1000. It means there is DUPLICATE return of getAndIncrement method. Anyone explain why? Thanks. *NOTE: In run function. If I use System.out.println(next); Sometime I see some missing sequencers too. * SAMPLE OUTPUT 1: 1 6 8 5 2 10 3 4 12 11 9 14 15 7 13 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 42 41 43 45 44 47 49 46 48 52 52 50 53 55 54 58 56 57 59 60 61 62 63 64 65 67 68 69 66 70 71 72 73 74 75 76 77 78 80 81 79 82 83 84 85 86 87 88 89 90 91 92 93 94 95 97 96 98 99 104 103 106 102 109 100 101 108 107 111 105 112 114 110 117 116 119 115 120 113 118 121 122 126 125 124 123 127 128 130 131 129 132 133 134 135 136 137 138 139 140 141 142 144 145 143 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 170 169 171 172 173 174 175 176 177 178 179 180 181 182 186 188 189 185 190 184 191 192 183 187 193 194 196 197 198 199 195 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 216 217 219 215 218 220 232 231 230 229 228 227 226 225 224 223 221 222 233 234 235 237 239 240 236 238 241 243 242 245 244 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 2…
has comment: http://stackoverflow.com/comment/31354000
answer count: 6
tagged with: atomicinteger
has comment: http://stackoverflow.com/comment/31354111
score: 0
has answer: http://stackoverflow.com/a/20891419
has answer: http://stackoverflow.com/a/20893281
has comment: http://stackoverflow.com/comment/31354559

http://stackoverflow.com/q/20904607
tagged with: java
has answer: http://stackoverflow.com/a/20948436
score: 0
answer count: 2
has body: I need to print a report through Java only if the sql used by the jrxml has some data in it. In order to do this, I need to hit database twice, First time to check if the sql has any records and second time to print the report. By doing this, its taking twice the time than usual. Is there any way by which I can check if its having the data and print it for the first time itself?
has title: Print jrxml report only if the sql used by jrxml has data in it
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/67195838
has comment: http://stackoverflow.com/comment/31379511
type: Question
tagged with: jasper-reports
linked to: http://stackoverflow.com/q/13456114

http://stackoverflow.com/a/20885592
answers question: http://stackoverflow.com/q/20885134
has comment: http://stackoverflow.com/comment/31353386
has comment: http://stackoverflow.com/comment/31344197
type: Answer
has comment: http://stackoverflow.com/comment/31344439
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31342921
has comment: http://stackoverflow.com/comment/31355895
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20885134
has body: The reason is probably that your datagram packets are too small, which causes you to send a whole bunch of packages that creates a lot of overhead. This might result in a huge packet loss rate and make them arrive in the wrong order. So, make your buffer size bigger: byte tempBuffer[] = new byte[8192] ; And this comes from the DatagramSocket.receive() JavaDoc: This method blocks until a datagram is received. The length field of the datagram packet object contains the length of the received message. If the message is longer than the packet's length, the message is truncated. This might be a problem as well. Try to use the same size for both sending and receiving packets. byte soundpacket[] = new byte[8192]; Also, do not continiously open and close the AudioLine to the speakers. Do also not continuously create DatagramSockets. Create one, and keep it.

http://stackoverflow.com/comment/31449572
type: Comment
type: QuestionComment
has text: I'm not entirely sure what you mean, but I put: System.out.println(tracksFolder.listFiles().toString()); and it gave me [Ljava.io.File;@d8f459 which is one line only.
score: 0
comment on: http://stackoverflow.com/q/20941185

http://stackoverflow.com/comment/31293089
comment on: http://stackoverflow.com/q/20858992
type: Comment
type: QuestionComment
score: 0
has text: You put it inside the `if` block, like any other block, e.g., another `if`.

http://stackoverflow.com/a/20887310
type: Answer
has body: Try selecting the table in PDF with your mouse and see if the table is there and still it is invisible. If it is there, go to the file menu and do print as pdf.
score: 0
answers question: http://stackoverflow.com/q/20886375

http://stackoverflow.com/a/20904602
has comment: http://stackoverflow.com/comment/31382628
score: 0
answers question: http://stackoverflow.com/q/20893619
has comment: http://stackoverflow.com/comment/31387114
has body: If there is some problem with workspace which seems impossible to be found, its good to start fresh. Close eclipse Delete .metadata folder Restart eclipse Open workspace in same folder. Delete gwt-cache files in gwt projects Clean all projects This should hopefully solve the problem. Good luck.
type: Answer

http://stackoverflow.com/q/20925517
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31419265
has comment: http://stackoverflow.com/comment/31419218
has title: Form submit after ajax call
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31419000
answer count: 0
tagged with: ajax
type: Question
tagged with: spring
tagged with: spring-mvc
has body: I have a JSP page and I want to work just on the main content of the page, so when I click on some item of menu, it refreshes the main content of the page. My main page: Cartes objet de recours My ajax call: function formAjax() { $.ajax({ url : 'form1', success : function(responce) { $('#page_gestion').html(responce); } }); } My controller: @RequestMapping(value="/form1") public String form1(Map<String, Object> model, HttpServletRequest request, HttpServletResponse responce, ModelMap modelmap) { model.put("lostcard", new Lostcard()); return "form/form1" ; } My JSP page, if we can say so, that loads the main content of the main page: <%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%> <form:form method="POST" modelAttribute="lostcard" action="enregistrerLostCard" id="formCard_Lost"> [...] </form:form> At this point everything is ok, but when I submit my form I get this error: java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'lostcard' available as request attribute

http://stackoverflow.com/comment/31443292
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20937969
has text: @user3104437 `if(uid == F[0])` don't compare String values using `==`. Use `equals()`.
score: 0

http://stackoverflow.com/a/20853241
score: 5
answers question: http://stackoverflow.com/q/20853198
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20853198
type: Answer
has body: You need to use equals() method from the String class. When you use == you are comparing the reference variable of two objects (which is not same in your code) +----------+ +----------+ | | What you need | | | " " &lt;-------to compare-----------&gt; "a" | | | | | | | | | +----------+ +----------+ ^ ^ | | + What you + rtnstring &lt;------+ erroneously +----&gt; msg compare
upvote count: 5

http://stackoverflow.com/a/20932800
has body: My suggestion: ByteBuffer class of the nio package http://docs.oracle.com/javase/6/docs/api/java/nio/ByteBuffer.html here an example byte[] myByte = {1,1,1,1,1}; //5bytes ByteBuffer buffer = ByteBuffer.allocate( 256 ); buffer.put(myByte); System.out.println(buffer.capacity()); // it return 256 System.out.println(buffer.position()); // it return 5 buffer.put(myByte); System.out.println(buffer.position()); // it return 10 System.out.println(buffer.remaining()); // it return 256 - 10 buffer.rewind(); System.out.println(buffer.position()); // it return 0
type: Answer
score: 0
answers question: http://stackoverflow.com/q/20932619

http://stackoverflow.com/q/20876028
score: 4
has comment: http://stackoverflow.com/comment/32084576
upvote count: 4
answer count: 1
downvote count: 0
favorite count: 0
tagged with: exception
tagged with: android
has body: I have the following method that raise exception: @ApiMethod(name = "login") public Profile getLogin(User user) throws UnauthorizedException { if (user == null){ throw new UnauthorizedException("missing user"); } ... } How to catch the error in android client AsyncTask? protected Profile doInBackground(Void... unused) { Profile profile = null; try { profile = service.login().execute(); } catch (Exception e) { Log.d("exception", e.getMessage(), e); } return profile; } The above didn't catch the UnauthorizedException.
tagged with: google-cloud-endpoints
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23784572
has title: Google Cloud Endpoints Custom Exception

http://stackoverflow.com/a/20988837
type: Answer
has comment: http://stackoverflow.com/comment/31538500
answers question: http://stackoverflow.com/q/20986116
has body: If I understand you correct then It may be a solution. Create all your contents that you want to display in a div tag of other page. In a different page Call that JSP in that div using following tag &lt;%@ include file="yourPage.jsp"%&gt; Links of those menus create them in yourPage.jsp use above Tag wherever you want to include this page. This solution is not from Struts2 if you want in struts2 refer this Struts2 Tile Tutorial Create Whatever the stuff that you want in that red color div create as a seperate JSP file and include that JSP File for example Your main jsp page--- main.jsp &lt;body&gt; &lt;div id="someDiv"&gt; &lt;/div&gt; &lt;div id="yourredDiv"&gt; //here you include that jSP page. &lt;%@ include file="path/yourPage.jsp"%&gt; &lt;/div&gt; &lt;/body&gt; Now in yourpage.jsp you create the html components whatever you want.
has comment: http://stackoverflow.com/comment/31579566
has comment: http://stackoverflow.com/comment/31587759
score: 0
has comment: http://stackoverflow.com/comment/31538445

http://stackoverflow.com/q/20850335
score: 10
answer count: 2
has comment: http://stackoverflow.com/comment/31672758
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has body: I have the following Java file: class Outer { class Inner { public int foo; } class InnerChild extends Inner {} } I compiled then disassembled the file using this command: javac test.java &amp;&amp; javap -p -c Outer Outer.Inner Outer.InnerChild This is the output: Compiled from "test.java" class Outer { Outer(); Code: 0: aload_0 1: invokespecial #1 // Method java/lang/Object."&lt;init&gt;":()V 4: return } Compiled from "test.java" class Outer$Inner { public int foo; final Outer this$0; Outer$Inner(Outer); Code: 0: aload_0 1: aload_1 2: putfield #1 // Field this$0:LOuter; 5: aload_0 6: invokespecial #2 // Method java/lang/Object."&lt;init&gt;":()V 9: return } Compiled from "test.java" class Outer$InnerChild extends Outer$Inner { final Outer this$0; Outer$InnerChild(Outer); Code: 0: aload_0 1: aload_1 2: putfield #1 // Field this$0:LOuter; 5: aload_0 6: aload_1 7: invokespecial #2 // Method Outer$Inner."&lt;init&gt;":(LOuter;)V 10: return } The first inner class has its this$0 field, pointing to the instance of Outer. That's fine. The second inner class, which extends the first, has a duplicate field of the same name, which it initializes before calling the super class's constructor with the same value. The purpose of the int foo field above is just to confirm that inherited fields from the superclass do not show up in the javap output of a child class's dissassembly. The first this$0 field is not private, so InnerChild should be able to use it. The extra field just seems to waste memory. (I first discovered it using a memory analysis tool.) What is its purpose and is there a way I can get rid of it?
has title: Why do extensions of inner classes get duplicate outer class references?
tagged with: inner-classes
tagged with: java
upvote count: 10
has comment: http://stackoverflow.com/comment/31278280
type: Question
has answer: http://stackoverflow.com/a/20851183
has answer: http://stackoverflow.com/a/20909748

http://stackoverflow.com/q/20970397
has answer: http://stackoverflow.com/a/21686619
tagged with: eclipse-rcp
answer count: 1
tagged with: eclipse-plugin
favorite count: 0
has title: How to make a popup menu contribution on the editor to appear only when Package Explorer view is active
has body: I have this question about how to add a popup menu contribution on the editor but only when the Package Explorer view is active. I tried with "locationURI="popup:org.eclipse.ui.popup.any"" but it apears on the editor no mater the view.
accepted answer: http://stackoverflow.com/a/21686619
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: eclipse
type: Question
downvote count: 0

http://stackoverflow.com/q/20900706
has comment: http://stackoverflow.com/comment/31405173
type: Question
upvote count: 2
answer count: 1
has answer: http://stackoverflow.com/a/20900862
has comment: http://stackoverflow.com/comment/31371427
favorite count: 0
has body: I have created a java application in which i am using MySQL server. When I run project then three process start mysqld.exe java.exe FirstApplication.exe I run MySQL server externally by executing mysqld process. But I want to merge process mysqld.exe in FirstApplication.exe process means when this FirstApplication.exe process starts then automatically internally mysqld.exe process should be start(run as one process). I want only 2 process in task manager java.exe FirstApplication.exe I do not know is this possible or not? Please Suggest any answer.
downvote count: 0
type: UnansweredQuestion
tagged with: process
score: 2
has title: how to run process within process?
linked to: http://stackoverflow.com/q/3393397
tagged with: java
tagged with: mysql

http://stackoverflow.com/q/20945371
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/31456737
has answer: http://stackoverflow.com/a/20945419
accepted answer: http://stackoverflow.com/a/20945419
possible better answer: http://stackoverflow.com/a/20945406
has answer: http://stackoverflow.com/a/20945406
type: Question
score: -2
tagged with: java
has body: I have an issue with string array where's the program takes the use names the put it in the screen. I did some coding and creating 2D games and android app but the fact I never used array for saving scores or something and now I'm stuck and need to learn it and code below think of it as we are putting degrees for collage students put the error that the array is making an error and I can't figure it out why the full code below: public static void main(String[] args) { // TODO Auto-generated method stub Chatlength = new String[10]; for(i =0; i &lt;= Chatlength.length ; i++){ Scanner s = new Scanner(System.in); String ss = s.nextLine(); Chatlength[i] = ss; } while(true){ if(i &gt; Chatlength.length){ int ints = 0; while(ints &lt;10){ System.out.println("Name "+ints+": "+Chatlength[ints]); ints++; } } } It gives me and error with Chatlength[i] = ss;.
has answer: http://stackoverflow.com/a/20945420
downvote count: 2
has title: Array error with string
tagged with: arrays
has answer: http://stackoverflow.com/a/20945495
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/20945438

http://stackoverflow.com/q/20957536
has answer: http://stackoverflow.com/a/20957841
has comment: http://stackoverflow.com/comment/31480223
has answer: http://stackoverflow.com/a/20957789
has comment: http://stackoverflow.com/comment/31479664
has comment: http://stackoverflow.com/comment/31479735
has comment: http://stackoverflow.com/comment/31479885
has comment: http://stackoverflow.com/comment/31479605
has comment: http://stackoverflow.com/comment/31480153
has comment: http://stackoverflow.com/comment/31479547
tagged with: io
downvote count: 0
has comment: http://stackoverflow.com/comment/31480183
has comment: http://stackoverflow.com/comment/31480317
favorite count: 0
has comment: http://stackoverflow.com/comment/31479966
has comment: http://stackoverflow.com/comment/31479937
has comment: http://stackoverflow.com/comment/31479835
has comment: http://stackoverflow.com/comment/31479887
has comment: http://stackoverflow.com/comment/31480009
has comment: http://stackoverflow.com/comment/31481405
has answer: http://stackoverflow.com/a/20957735
tagged with: exception
has title: Why am I throwing a NullPointerException
score: 6
has comment: http://stackoverflow.com/comment/31479791
upvote count: 6
answer count: 4
has answer: http://stackoverflow.com/a/20957886
has comment: http://stackoverflow.com/comment/31479652
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31479717
tagged with: java
has comment: http://stackoverflow.com/comment/31480242
type: Question
accepted answer: http://stackoverflow.com/a/20957735
possible better answer: http://stackoverflow.com/a/20957841
has comment: http://stackoverflow.com/comment/31479824
has body: So it's winter break for colleges, and I'm trying to stay sharp on my coding, so I'm just writing code for programs and algorithms we only talked about but never coded in class. Anyway, one I'm working on today is a program where you give the computer a scrambled word, and it outputs all the words (from the EnglishWordList file we are given) that can be made from those letters. Anyway, here is the code I have so far for it: import java.io.*; import java.util.*; public class ProdFinder { private HashMap&lt;Character, Integer&gt; prodFinder = new HashMap&lt;Character, Integer&gt;(); private HashMap&lt;Integer, LinkedList&lt;String&gt;&gt; findWord = new HashMap&lt;Integer, LinkedList&lt;String&gt;&gt;(); private static final char[] letters = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r', 's','t','u','v','w','x','y','z'}; private static final int[] primes = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101}; public ProdFinder() throws FileNotFoundException { for (int i = 0; i &lt; letters.length; i++) { prodFinder.put(letters[i], primes[i]); } Scanner sc = new Scanner(new File("EnglishWordList.txt")); while (sc.hasNextLine()) { String str = sc.nextLine(); int strProd = findProduct(str); if (findWord.containsKey(strProd)) { LinkedList&lt;String&gt; wordList = findWord.get(strProd); wordList.add(str); findWord.put(strProd, wordList); } else { LinkedList&lt;String&gt; wordList = new LinkedList&lt;String&gt;(); wordList.add(str); findWord.put(strProd, wordList); } } sc.close(); } public int findProduct(String x) { int product = 1; char[] str = x.toCharArray(); for (Character val: str) { product = product*prodFinder.get(val); } return product; } public void descramble(String x) { int prod = findProduct(x); if (findWord.containsKey(prod)) { System.out.println("The words that can be formed from the letters in " + x + " are: " + findWord.get(prod)); } else { System.out.println("No words can be formed from the letters in " + …

http://stackoverflow.com/q/20870879
has answer: http://stackoverflow.com/a/20870910
type: Question
has answer: http://stackoverflow.com/a/20870953
upvote count: 15
has answer: http://stackoverflow.com/a/23847169
score: 15
has comment: http://stackoverflow.com/comment/31317213
has comment: http://stackoverflow.com/comment/31316072
has answer: http://stackoverflow.com/a/20870912
has answer: http://stackoverflow.com/a/42049966
has body: I am new to java, i know set is not allowed duplicate value but i don't know why set is not allowed duplicate value, Actually i am doing practically, Declared one set and add duplicate value but no kind of error is occurring, no compile time error, no run time. why?
has answer: http://stackoverflow.com/a/20870894
has answer: http://stackoverflow.com/a/41255758
has comment: http://stackoverflow.com/comment/31316126
downvote count: 0
answer count: 10
has answer: http://stackoverflow.com/a/20870908
accepted answer: http://stackoverflow.com/a/20870908
has answer: http://stackoverflow.com/a/49816862
favorite count: 0
has comment: http://stackoverflow.com/comment/31316116
possible better answer: http://stackoverflow.com/a/23847169
has comment: http://stackoverflow.com/comment/31316575
has title: Why set is not allowed duplicate value, which kind of mechanism used behind them?
has comment: http://stackoverflow.com/comment/31317822
has comment: http://stackoverflow.com/comment/31316275
has answer: http://stackoverflow.com/a/45278634
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/31359865
type: QuestionComment
comment on: http://stackoverflow.com/q/20893974
score: 0
type: Comment
has text: so this mean i have 120mb allocated memory where there is only 15 mb used in it? does this means memory leaks the allocated space? or it is normal to have this? I am just amazed how this simple app can consume up to 400mb!!

http://stackoverflow.com/q/20950346
answer count: 3
tagged with: http-post
has title: AngularJS + Spring: 415 unsupported media type
upvote count: 1
tagged with: multipartform-data
favorite count: 0
tagged with: angularjs
accepted answer: http://stackoverflow.com/a/20950576
has answer: http://stackoverflow.com/a/63283092
tagged with: spring
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/20950576
score: 1
tagged with: java
has body: http post is getting error while uploading multipart data var formData = new FormData(); formData.append("startDate",$("#startDate").val()); formData.append("File1",$("input[name='file']")[0].files[0]); formData.append("File2",$("input[name='file2']")[0].files[0]); $http.post("sampleurl",formData, { headers : 'Content-Type' : undefined}, transformRequest : angular.identity }).then(function(data){ alert(data); }); } my server side code is @RequestMapping(value = "sampleurl", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON) public @ResponseBody Response createSomething( @RequestBody Request request, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) { // code here } what went wrong here, i am stucked to find the solution, please help me to find the solution
type: Question
has answer: http://stackoverflow.com/a/20950593
possible better answer: http://stackoverflow.com/a/20950593

http://stackoverflow.com/comment/31326238
score: 0
type: Comment
has text: How can i make swing components as static?
type: AnswerComment
comment on: http://stackoverflow.com/a/20876133

http://stackoverflow.com/comment/31433797
type: AnswerComment
score: 0
type: Comment
has text: Yes, but putting it in onDismissListener will still cause the operations to execute on the UI thread. Depending on how long those operations are, it can still noticeably freeze up your UI.
comment on: http://stackoverflow.com/a/20933310

http://stackoverflow.com/comment/31496592
comment on: http://stackoverflow.com/a/20958663
score: 0
type: AnswerComment
has text: The code example you provided looks great! I would change one thing, though - execute the killer threads in a separate executor service. That's because if you fix the number of threads in pool and all threads are consumed by long-running tasks, the killer threads get IMHO never executed. Thanks very much!
type: Comment

http://stackoverflow.com/a/21015973
type: AcceptedAnswer
downvote count: 0
has body: Ok. This worked for me: MultiValueMap&lt;String, String&gt; parameters = new LinkedMultiValueMap&lt;String, String&gt;(); parameters.set("q", FQL_GET_FRIENDS); Map&lt;String, Object&gt; resultSet = (Map&lt;String, Object&gt;) facebookTemplate .fetchObject("fql", Map.class, parameters);
type: Answer
answers question: http://stackoverflow.com/q/20968402
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/20968402

http://stackoverflow.com/comment/31334380
type: Comment
score: 0
comment on: http://stackoverflow.com/a/20880695
has text: So, if we test our app very very hardly. then no Alpha and/or beta test require. ok?
type: AnswerComment

http://stackoverflow.com/a/20987524
score: 0
has comment: http://stackoverflow.com/comment/31545477
has comment: http://stackoverflow.com/comment/31536467
type: Answer
has comment: http://stackoverflow.com/comment/31536252
has comment: http://stackoverflow.com/comment/31536169
has comment: http://stackoverflow.com/comment/31536213
has comment: http://stackoverflow.com/comment/31536365
has body: In the Maven Project put the following dependency in pom.xml org.codehaus.groovy groovy-all 1.8.3 And run mvn clean install , It solves your problem.
answers question: http://stackoverflow.com/q/20987481

http://stackoverflow.com/q/21007064
linked to: http://stackoverflow.com/q/4330936
type: Question
has comment: http://stackoverflow.com/comment/31572503
linked to: http://stackoverflow.com/q/2011664
has answer: http://stackoverflow.com/a/21007475
has answer: http://stackoverflow.com/a/21007264
has answer: http://stackoverflow.com/a/21007290
has title: Creating .exe files from .java or maybe it is not the way to go?
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/31572043
has comment: http://stackoverflow.com/comment/31572258
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31572036
has comment: http://stackoverflow.com/comment/31572057
has comment: http://stackoverflow.com/comment/31578356
downvote count: 1
has answer: http://stackoverflow.com/a/21009792
has comment: http://stackoverflow.com/comment/31577186
has body: As a comp-sci student, I've been making programs mainly in Java and all i have done is make .java files and submit them to instructors to get marks. I am wondering how to go from .java file into .exe files that i see in my computers. I looked up on Google and this site, what they say doesn't really make sense because they say the only appropriate way is to create .jar files which requires Java environment installed in others computers and I haven't seen any .jar files in my life. Also, they say using softwares like launch4j kills the true purpose of Java and might cause errors. I am confused. Maybe Java is not a language for making .exe files? then what language is? How can I make .exe files and what is the most common way of doing it among the professional programmers? Note: by the .exe file I don't mean installation files, I mean just the program itself like starcraft2.exe, utorrent.exe, calculator.exe , etc.
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/147181

http://stackoverflow.com/a/20996246
has body: At this time, the New Relic Java agent only notices external calls made with the following methods: HttpURLConnection CommonsHttp Jets3t S3 AsyncHttpClient The Play WS API is not among those and, at this time, there is no way to for the user to do anything to modify the behavior. I would recommend contacting New Relic tech support with a feature request to add external call support for Play's WS API.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20968456
answers question: http://stackoverflow.com/q/20968456
has comment: http://stackoverflow.com/comment/31551206
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33241861
type: Answer
score: 4
has comment: http://stackoverflow.com/comment/33479638
has comment: http://stackoverflow.com/comment/31551821
upvote count: 4

http://stackoverflow.com/q/20938698
answer count: 1
has comment: http://stackoverflow.com/comment/31445736
downvote count: 0
tagged with: jsp
type: Question
has answer: http://stackoverflow.com/a/20940681
favorite count: 0
score: 4
tagged with: el
accepted answer: http://stackoverflow.com/a/20940681
has title: How to set a cookie value within JSP using an EL expression?
linked to: http://stackoverflow.com/q/10293825
tagged with: taglib
tagged with: cookies
tagged with: java
has body: I'm trying to set a cookie value within a JSP without using Java code directly. I know I could do it by creating a custom tag lib for that, but I wanted to keep it simple so I'm trying to do that the same way I access cookies: with EL expressions. I know I can read the value of a cookie using JSP EL with the expression ${cookie['cookieName'].value}, but how can I set a particular value to that cookie using EL? I found solutions using java code in the JSP, but I want to avoid that. So far I found ways to set variables using the c:set tag, but that doesn't accept expressions as the 'var' parameter so I can't do something like: &lt;c:set var="${cookie['cookieName'].value}" value="123" /&gt; I think the way to go is , but I don't know what expression to use for the var part of it, or how to write it so I can set the cookie value instead of just a variable. Any help is appreciated!
upvote count: 4
type: AnsweredQuestion

http://stackoverflow.com/comment/31443144
has text: Thanks Sean..Actually i want to modify the path info of a received request. After modifying the path info of the request i have to call an actionservlet.post operation. Is there any example resource available for modifying request path info.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20937980

http://stackoverflow.com/comment/31402954
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/20916867
type: Comment
has text: And please switch to using a real IDE that will automatically fix this for you.

http://stackoverflow.com/a/20992717
has body: The problem is Your doing String Deobf2 = Deobf.toString();//this does not give the location of the file use file.getAbsolutePath(); in your case Deobf.getAbsolutePath(); instead. Check http://www.mkyong.com/java/how-to-get-the-filepath-of-a-file-in-java/ if you want to get the path only till the parent directory check this How to get absolute path of directory of a file?
type: Answer
answers question: http://stackoverflow.com/q/20991860
score: 0

http://stackoverflow.com/a/21652255
downvote count: 0
has body: This code takes String elements, but can me modified to work for integers: import java.util.*; /** * Write a description of class GeneratePermutations here. * * @author Kushtrim * @version 1.01 */ public class GeneratePermutations { public static void main(String args[]) { GeneratePermutations g = new GeneratePermutations(); String[] elements = {"a","b","c",}; ArrayList&lt;String&gt; permutations = g.generatePermutations(elements); for ( String s : permutations) { System.out.println(s); } //System.out.println(permutations.get(999999)); } private ArrayList&lt;String&gt; generatePermutations( String[] elements ) { ArrayList&lt;String&gt; permutations = new ArrayList&lt;String&gt;(); if ( elements.length == 2 ) { String x1 = elements[0] + elements[1]; String x2 = elements[1] + elements[0]; permutations.add(x1); permutations.add(x2); } else { for ( int i = 0 ; i &lt; elements.length ; i++) { String[] elements2 = new String[elements.length -1]; int kalo = 0; for( int j =0 ; j&lt; elements2.length ; j++ ) { if( i == j) { kalo = 1; } elements2[j] = elements[j+kalo]; } ArrayList&lt;String&gt; k2 = generatePermutations(elements2); for( String x : k2 ) { String s = elements[i]+x; permutations.add(s); } } } return permutations; } }
upvote count: 2
answers question: http://stackoverflow.com/q/20906214
type: Answer
score: 2

http://stackoverflow.com/comment/31531322
score: 2
type: Comment
type: QuestionComment
has text: @Arioch'The - the AndroidAPI.* units are for the Java API layer; in contrast, the native code (essentially Linux) API header translations are under the Posix.* unit scope like they are for OS X and iOS. That said, I agree with your main point - calling a native code .so via a Java wrapper seems a bit bizarre. Arnold - have you tried just declaring the C imports directly? The syntax is exactly the same as declaring a Windows DLL import unit.
comment on: http://stackoverflow.com/q/20982789

http://stackoverflow.com/comment/31588198
has text: Why are you running `home.jsp` directly? Try running with just `localhost:9090/MyProject/home`
comment on: http://stackoverflow.com/q/21016151
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20853991
type: UnansweredQuestion
tagged with: soap
downvote count: 0
score: 1
tagged with: java
has body: I just start learning JSP and I need to send a soap message, I created the message as string . I just want to send it to a url, I can't find any simple example, I created a jsp page and a class like this : <%@ page contentType="text/html;charset=windows-1252"%> <% String file=request.getParameter("file"); %> <jsp:useBean id="soap" class="omnix.jo.soap.soap" /> default <%=file%> I am using a Bean to get my class, I found this class on the internet: package omnix.jo.soap; import javax.xml.soap.MessageFactory; import javax.xml.soap.SOAPBody; import javax.xml.soap.SOAPConnection; import javax.xml.soap.SOAPConnectionFactory; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPMessage; import javax.xml.soap.SOAPPart; import javax.xml.transform.Source; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.stream.StreamResult; /** * SOAP Client Implementation using SAAJ Api. */ public class soap { /** * Method used to create the SOAP Request */ private static SOAPMessage createSOAPRequest() throws Exception { MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage soapMessage = messageFactory.createMessage(); SOAPPart soapPart = soapMessage.getSOAPPart(); /* Construct SOAP Request Message: <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:sam="http://samples.axis2.techdive.in"> <soap:Header/> <soap:Body> <sam:getStudentName> <sam:rollNumber>3</sam:rollNumber> </sam:getStudentName> </soap:Body> </soap:Envelope> */ // SOAP Envelope SOAPEnvelope envelope = soapPart.getEnvelope(); envelope.addNamespaceDeclaration("sam", "http://samples.axis2.techdive.in"); // SOAP Body SOAPBody soapBody = envelope.getBody(); SOAPElement soapBodyElem = soapBody.addChildElement("getStudentName", "sam"); SOAPElement soapBodyElem1 = soapBodyElem.addChildElement("rollNumber", "sam"); soapBodyElem1.addTextNode("3"); soapMessage.saveChanges(); // Check the …
type: Question
has answer: http://stackoverflow.com/a/20855418
tagged with: jsp
has title: Send Soap Envelop Using Jsp
upvote count: 1
answer count: 1
favorite count: 0

split
tags question: http://stackoverflow.com/q/20926561
tag name: split
tags question: http://stackoverflow.com/q/21015939
tags question: http://stackoverflow.com/q/20915469
tags question: http://stackoverflow.com/q/20999861
tags question: http://stackoverflow.com/q/20934388
tags question: http://stackoverflow.com/q/20938957
tags question: http://stackoverflow.com/q/21010951
type: Tag
tags question: http://stackoverflow.com/q/20979985
tags question: http://stackoverflow.com/q/20933211

http://stackoverflow.com/comment/31328405
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20877075
has text: ya thats how im using it, correct? except im using app.(some function) instead of app[somefunction](); i didnt know you could use it that way. The variable is still undefined in the property app.bluetooth property array

http://stackoverflow.com/a/44780454
type: Answer
answers question: http://stackoverflow.com/q/20950086
upvote count: 2
has body: It is possible to suppress finalization on certain objects. It does not require bytecode manipulation as one commenter noted. The procedure is described here and source code is provided. The class java.lang.ref.Finalizer is responsible for maintaining a list of objects that have not yet been finalized. To suppress finalization of your objects of interest, it suffices to use reflection APIs to acquire a lock on the field lock, iterate over the linked list unfinalized that the Finalizer class maintains, and remove your object from this list. I've tried this method to safely instantiate custom-serialized objects while bypassing constructor invocation, and avoiding problems when the finalizer would be invoked with normal GC. Before applying this method my JVM would break with hard faults in the finalizer thread; since applying this method the faults do not occur.
score: 2
downvote count: 0

int
tags question: http://stackoverflow.com/q/20959246
tags question: http://stackoverflow.com/q/21007404
tags question: http://stackoverflow.com/q/20960194
tags question: http://stackoverflow.com/q/20982283
tags question: http://stackoverflow.com/q/20852412
type: Tag
tags question: http://stackoverflow.com/q/20960078
tags question: http://stackoverflow.com/q/20903991
tags question: http://stackoverflow.com/q/20950105
tags question: http://stackoverflow.com/q/20892232
tag name: int
tags question: http://stackoverflow.com/q/20860330
tags question: http://stackoverflow.com/q/20934831
tags question: http://stackoverflow.com/q/20937225

http://stackoverflow.com/q/20857495
accepted answer: http://stackoverflow.com/a/20857560
possible better answer: http://stackoverflow.com/a/20857585
has title: Unix commands in java
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
downvote count: 0
has body: I'm trying to execute unix commands in java, like system("ls"); in C. I tried this but it doesn't print anithing: Process p=Runtime.getRuntime().exec("ls"); OutputStream in=p.getOutputStream(); PrintStream print = new PrintStream(in); print.println("String"); Any ideas?
linked to: http://stackoverflow.com/q/3403226
has comment: http://stackoverflow.com/comment/31289988
has answer: http://stackoverflow.com/a/20857560
tagged with: terminal
answer count: 3
has answer: http://stackoverflow.com/a/20857672
tagged with: shell
tagged with: unix
favorite count: 0
has answer: http://stackoverflow.com/a/20857585
upvote count: 1

http://stackoverflow.com/comment/31294281
type: AnswerComment
has text: If that is the case, I'd try to read the processes output in an asynchronous way.
type: Comment
comment on: http://stackoverflow.com/a/20858364
score: 0

http://stackoverflow.com/comment/31391335
has text: I just edited my post, feel free to edit if you still find any misleading words.
type: Comment
comment on: http://stackoverflow.com/a/20909747
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31423181
comment on: http://stackoverflow.com/q/20927650
has text: @user2496329 hope you are not talking about accepted one if you can have values larger than max int/long
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20968776
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31501210
has comment: http://stackoverflow.com/comment/31502100
has comment: http://stackoverflow.com/comment/31500859
has title: Android Service with Timer Task
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/49550547
has body: I have created an android service that will access the web service and trigger data to send sms every minute. public class SmsService extends Service { String TAG="W2S"; private Timer timer; @Override public int onStartCommand(Intent intent, int flags, int startId) { //TODO do something useful timer = new Timer("Timer Task"); timer.schedule(updateTask,0, Constants.TIME_INT); return Service.START_STICKY; } public SmsService() { // TODO Auto-generated constructor stub } @Override public IBinder onBind(Intent arg0) { // TODO Auto-generated method stub return null; } private TimerTask updateTask = new TimerTask() { @Override public void run() { //Log.e(TAG, "Timer task doing work------------------------------------------"); try { CheckWeb(); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }; public void CheckWeb() throws ClientProtocolException, IOException, JSONException { String response = ""; HttpPost httppost = new HttpPost(Constants.SMS_URL); HttpClient httpclient = new DefaultHttpClient(); List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(1); nameValuePairs.add(new BasicNameValuePair("merchant", Constants.MERCHANT)); nameValuePairs.add(new BasicNameValuePair("password", Constants.PASSWORD)); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); // Execute HTTP Post Request ResponseHandler&lt;String&gt; responseHandler = new BasicResponseHandler(); response = httpclient.execute(httppost, responseHandler); if(isNetworkAvailable(getApplicationContext())){ String str=response.toString().trim(); Log.e(TAG, str); if(!str.equals("null")){ JSONObject jObject=new JSONObject(str); JSONArray jArray = jObject.getJSONArray("msgs"); Sms sms =new Sms(); for (int i=0; i &lt; jArray.length(); i++) { try { JSONObject oneObject = jArra…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31502446
tagged with: android
linked to: http://stackoverflow.com/q/20945517
answer count: 0

http://stackoverflow.com/a/20989758
has comment: http://stackoverflow.com/comment/31539917
has comment: http://stackoverflow.com/comment/31539985
has body: Another solution (than using comparable) You can use instanceof operator in java . Example : public &lt;T&gt; List&lt;T&gt; sortMyList(List&lt;T&gt; list){ Collections.sort(list, new Comparator&lt;T&gt;() { public int compare(T o1, T o2) { if(o1 instanceof Employee &amp;&amp; o2 instanceof Employee) return o2.getId().compareTo(o1.getId()); else if(o1 instanceof Buildings &amp;&amp; o2 instanceof Buildings) return o2.getNumOfEmployees().compareTo(o1.getNumOfEmployees()); } }); }
downvote count: 1
has comment: http://stackoverflow.com/comment/31539814
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/20989644
score: -1

openal
type: Tag
tags question: http://stackoverflow.com/q/21010430
tag name: openal

http://stackoverflow.com/comment/31393313
score: 0
type: AnswerComment
has text: I added your suggested code. I just need to figure out how to paste it as its too long for a comment field in stackoverflow.
comment on: http://stackoverflow.com/a/20911191
type: Comment

http://stackoverflow.com/q/20997968
tagged with: fault
has answer: http://stackoverflow.com/a/21004516
has answer: http://stackoverflow.com/a/20999903
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31554454
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31554376
tagged with: bluetooth
answer count: 2
has body: could anyone help my with my app code. I tryied to make an application that could send data (number or letter) to arduino through bluetooth. This is how my JAVA code look: package com.example.btprojektas; import android.app.Activity; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothSocket; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.Toast; import java.io.IOException; import java.io.OutputStream; import java.util.Set; import java.util.UUID; public class MainActivity extends Activity{ private static final String TAG = "btprojektas"; Button btnON, btnOFF; BluetoothAdapter bluetoothAdapter = null; BluetoothDevice device = null; OutputStream outputStream = null; BluetoothSocket socket = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); btnON = (Button) findViewById(R.id.btnON); btnOFF = (Button) findViewById(R.id.btnOFF); if(!bluetoothAdapter.isEnabled()){ Intent enableBluetooth = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivityForResult(enableBluetooth, 0); } loadPairedDevice(); connectBT(); btnON.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { sendData("0"); Toast.makeText(getBaseContext(), "Turn on LED", Toast.LENGTH_SHORT).show(); } }); btnOFF.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { sendData("1"); Toast.makeText(getBaseContext(), "Turn off LED", Toast.LENGTH_SHORT).show(); } }); } private void connectBT() { if (device != null) { UUID uuid = UUID.fromString("00001101-0000-1000-8000-00805f9b34fb"); //Standard SerialPortService ID try { socket = device.createRfcommSocketToServiceRecord(uuid); socket.connect(); outputStream = socket.getOutputStream(); } ca…
downvote count: 0
has comment: http://stackoverflow.com/comment/31554398
score: 1
favorite count: 0
has title: Application stopped unexpectedly: Fatal Exception
tagged with: android

http://stackoverflow.com/comment/31282286
has text: @chrylis I think most of us agree with that. but i'm getting angry to see _"for string comparision, use equals(), equalsIgnoreCase()"_ kind of answers :-/
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/20853198

http://stackoverflow.com/comment/31419497
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20923537
score: 1
has text: Please post comments if you have any questions., yes I'm have one - happy new year 2014, all the best ...

http://stackoverflow.com/q/20988136
has answer: http://stackoverflow.com/a/20988530
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31537420
upvote count: 1
downvote count: 1
tagged with: java
tagged with: eclipse
type: Question
has title: Stop Words removal from TextView
score: 0
has body: I have a TextView which contains a processed text, so that it will be in lower case and doesn't have punctuations. Now I want to remove the stop words (these stop words are in my language which I already define). After that, I want to send the result to another TextView. This my code public void onClick(View v) { // TODO Auto-generated method stub if (v.getId() == R.id.button6) { Intent i2 = new Intent(this, PreposisiRemoval.class); String test = ((TextView) findViewById(R.id.textView7)).getText() .toString(); String[] preposisi = { "akibat", "atas", "bagai", "bagi", "berkat", "dalam", "dari", "demi", "dengan", "di", "hingga", "karena", "ke", "kecuali", "lewat", "oleh", "pada", "sampai", "sejak", "seperti", "tanpa", "tentang", "untuk" }; StringBuilder result = new StringBuilder(); Scanner fip1 = new Scanner(test); while (fip1.hasNext()) { int flag = 1; String s1 = fip1.next(); for (int i = 0; i &lt; preposisi.length; i++) { if (s1.equals(preposisi[i])) { flag = 0; } if (flag != 0) { System.out.println(s1); result.append(s1); } i2.putExtra("result2", result.toString()); startActivity(i2); } } } } After I pressed button6, I did not get any results. Where is the part of my coding that is wrong? This code is in another Activity which will receive the processed text. protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_preposisi_removal); Intent intent = getIntent(); String result = intent.getStringExtra("result2"); TextView tv = (TextView) findViewById(R.id.textView8); tv.setMovementMethod(new ScrollingMovementMethod()); tv.setText(result); tv.setTextSize(12); }
answer count: 1
favorite count: 0
tagged with: android

http://stackoverflow.com/q/20853477
has comment: http://stackoverflow.com/comment/31282500
type: Question
tagged with: stringbuilder
has answer: http://stackoverflow.com/a/20853557
has comment: http://stackoverflow.com/comment/31282553
has comment: http://stackoverflow.com/comment/31282508
answer count: 6
upvote count: 2
has comment: http://stackoverflow.com/comment/31282659
favorite count: 0
has answer: http://stackoverflow.com/a/20853565
possible better answer: http://stackoverflow.com/a/20853557
has title: Getting String from StringBuilder
has answer: http://stackoverflow.com/a/20853559
has comment: http://stackoverflow.com/comment/31282541
has answer: http://stackoverflow.com/a/20853570
score: 2
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/20853564
tagged with: java
has answer: http://stackoverflow.com/a/20853587
has comment: http://stackoverflow.com/comment/31282575
has body: I was working with StringBuilder to eliminate some unnecessary chars, I got some strange result. String value = "1.045,00"; StringBuilder sanitized = new StringBuilder(); boolean decimalSeparatorFound = false; char[] chars = value.toCharArray(); for (int i = chars.length-1; i &gt;= 0; i--) { if (chars[i] == ',' || chars[i] == '.') { if (decimalSeparatorFound) continue; // skip this char decimalSeparatorFound = true; sanitized.append('.'); } else { sanitized.append(chars[i]); } } here I will get 00.5401 as a result in sanitized but when I was converting it to string like String s = sanitized.reverse.toString(); and It is expected to print the value of s as 1045.00 but it get printed as 00.5401. then I tried it as StringBuilder sb = sanitized.reverse(); String s1 = sb.toString(); now this time it got printed correctly. here my question why the StringBuilder is behaving this way? Isn't it performing reverse operation while assigning the value to String s?
accepted answer: http://stackoverflow.com/a/20853587

http://stackoverflow.com/comment/31575342
score: 0
type: Comment
type: QuestionComment
has text: It only prints out the exception if you a) catch it and print it out or b) don't catch and the default handler prints it out.
comment on: http://stackoverflow.com/q/21008696

http://stackoverflow.com/a/20985246
upvote count: 4
has comment: http://stackoverflow.com/comment/31532184
answers question: http://stackoverflow.com/q/20985215
downvote count: 0
has body: Create a class level attribute along the lines of: boolean buttonHasFiredOnce = false; In the action performed method, put code like: if (!buttonHasFiredOnce) { doFirstMethod(); buttonHasFiredOnce = true; } else { doSecondMethod(); }
score: 4
type: Answer

http://stackoverflow.com/q/20939805
answer count: 2
downvote count: 4
upvote count: 0
has answer: http://stackoverflow.com/a/20939907
tagged with: file-io
has answer: http://stackoverflow.com/a/20939856
favorite count: 0
type: UnansweredQuestion
has title: How do i put these letter grades into a new file instead of putting it on the console?
score: -4
has body: This code creates a file with students and their scores. I have calculated their letter grade but it goes on the console. How can i get their letter grades into a new file? Also how can i print on the console the averages for each test/quiz because right now I have them all in a for loop. import java.io.*; import java.util.InputMismatchException; import java.lang.*; import java.util.*; public class ReadFile { private Scanner x; public void openFile(){ try{ x = new Scanner (new File ("grades.txt")); } catch(Exception e){ System.out.println("could not find file"); }} public void createFile()throws IOException { try{ File file = new File("grades.txt"); Scanner s = new Scanner(file); while(s.hasNext()){ { String [] split = s.nextLine().split(", "); String fname = split[0]; Double q1 = Double.parseDouble (split[1]); Double q2 = Double.parseDouble (split[2]); Double q3 = Double.parseDouble (split[3]); Double q4 = Double.parseDouble (split[4]); Double proji = Double.parseDouble (split[5]); Double projii = Double.parseDouble (split[6]); Double projiii = Double.parseDouble (split[7]); double studentgrade = (q1 *0.1) + (q2 *0.1) +(q3 *0.1) + (q4 *0.1) +(proji*0.15) + (projii * 0.2) + (projiii *0.25); if(studentgrade&gt;90) System.out.printf("%s got an A\n", fname); else if(studentgrade&gt;80) System.out.printf("%s got a B\n", fname); else if(studentgrade&gt;70) System.out.printf("%s got a C\n", fname); else if(studentgrade&gt;60) System.out.printf("%s got a D\n", fname); else if(studentgrade&gt;50) System.out.printf("%s got a F\n", fname); }}}catch(Exception e){ e.printStackTrace(); } } public void closeFile(){ x.close(); } }
tagged with: java
has comment: http://stackoverflow.com/comment/31446654
tagged with: file
type: Question

http://stackoverflow.com/q/20857142
tagged with: android
favorite count: 0
has answer: http://stackoverflow.com/a/20857202
possible better answer: http://stackoverflow.com/a/20857195
score: 0
has title: Object is not getting removed properly from Array list
has answer: http://stackoverflow.com/a/20857216
has answer: http://stackoverflow.com/a/20857195
upvote count: 1
downvote count: 1
has body: ICheckBoxClick icheckBoxClick = new ICheckBoxClick() { @Override public void onCheckCliked(boolean isChecked,String pkgName,int pos) { String packageName = cat_name+","+pkgName; AppModel appmodel = new AppModel(); appmodel.pkgName = packageName; appmodel.dbId = 0; if( isChecked ) { selected.add(appmodel); } else{ selected.remove(appmodel); } } }; appsGrid.setAdapter(new AllAppsSelectionAdapter(actityCtx,icheckBoxClick)); Button addItems = (Button) dialog.findViewById(R.id.add_applications); addItems.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { iAddSubItemsClick.addClicked( selected ); dialog.dismiss(); } }); what is wrong in above code ? Based on isChecked am adding and removing objects into and from respectively to arrayList. But on clicking on OK button am still able to see objects present in it.seems like object is not getting removed properly.
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31289274
accepted answer: http://stackoverflow.com/a/20857202
type: Question
has comment: http://stackoverflow.com/comment/31289288
tagged with: arrays
answer count: 3
has comment: http://stackoverflow.com/comment/31289246

http://stackoverflow.com/comment/31597406
type: AnswerComment
has text: Thank you for the response. Would number 4 be most reliably achieved through HTML5 geolocation within a webview? I've never used GPS in an app before; how quick and how accurate is it?
type: Comment
comment on: http://stackoverflow.com/a/21006748
score: 0

http://stackoverflow.com/a/20972181
has comment: http://stackoverflow.com/comment/31506958
has body: If I understood your problem correctly I would replace the BufferedOutputStream with a OutputputStreamWriter + BufferedWriterspecifically setting the encoding. The last even have a handy newLine method: OutputStreamWriter ost = new OutputStreamWriter( new FileOutputStream("/opt/compliance/Atish.dat", true), Charset.forName("UTF-8").newEncoder() ); BufferedWriter bw = new BufferedWriter(ost); bw.write(constituentContent.toString()); Also, since you are not doing anything concurrently, I guess it is safe to replace StringBuffer with StringBuilder.
has comment: http://stackoverflow.com/comment/31507075
has comment: http://stackoverflow.com/comment/31509130
answers question: http://stackoverflow.com/q/20971788
type: Answer
has comment: http://stackoverflow.com/comment/31507816
has comment: http://stackoverflow.com/comment/31509214
has comment: http://stackoverflow.com/comment/31515959
has comment: http://stackoverflow.com/comment/31507274
has comment: http://stackoverflow.com/comment/31507205
score: 0
has comment: http://stackoverflow.com/comment/31508553

http://stackoverflow.com/comment/31358027
has text: Note: mappedBy doesn't help: @OneToMany(mappedBy="game", cascade = CascadeType.ALL) public List<Scenario> scenarios;
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20865686

http://stackoverflow.com/a/20901244
answers question: http://stackoverflow.com/q/20900854
downvote count: 1
score: -1
upvote count: 0
has body: First get the NodeList of the anchors: var res = document.querySelectorAll('ul.dropdown-menu li a.dropdown-add'); Then force a click on the 3rd, if it's not empty: if(res[2].childNodes[0].nodeValue.length) { res[2].click() };
type: Answer
has comment: http://stackoverflow.com/comment/31372737

http://stackoverflow.com/q/21002387
score: 0
has title: Java switch from DataStreams to ObjectStreams
has comment: http://stackoverflow.com/comment/31574830
has body: I'm building a 4 player network poker game. I first create a game object which runs the game. It creates a server object. The server object spawns 4 threads each one will take care of a different socket connection. The Game object then spawns 4 player objects. Each player object will have data about the players, but for now I'm only storing their input and output objects. The player objects each create a OFCTable and passes them the input and output connection information. The OFCTable objects are my clients. They connect to the server and send info back and forth. This example was working when i was using DataInputObjects/DataOutputObjects, but now that I have switched them to ObjectInputObjects/ObjectOutputObjects it spawns 2 of my clients(OFCTable) then throws and AC exception. I understand there is a lot wrong with the way I send data and I want to fix that later after I'm able to send objects. I have already tried creating my output objects before my input objects and it gives the same error. Thanks for your help Output: Starting server... Connecting... Server Started... Connection successful Connection from:/127.0.0.1 Connecting... Connection successful Connection from:/127.0.0.1 Connection from:/127.0.0.1 Connecting... Connection successful java.io.StreamCorruptedException: invalid type code: AC at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(Unknown Source) at java.io.ObjectInputStream$BlockDataInputStream.refill(Unknown Source) at java.io.ObjectInputStream$BlockDataInputStream.read(Unknown Source) at java.io.DataInputStream.readUnsignedShort(Unknown Source) at java.io.ObjectInputStream$BlockDataInputStream.readUnsignedShort(Unknown Source) at java.io.ObjectInputStream$BlockDataInputStream.readUTF(Unknown Source) at java.io.ObjectInputStream.readUTF(Unknown Source) at OFCTable.run(OFCTable.java:785) at java.lang.Thread.run(Unknown Source) Game Class public class Game { public static void main(String[] args) throws Exception { Server server …
answer count: 1
has comment: http://stackoverflow.com/comment/31564296
has comment: http://stackoverflow.com/comment/31564335
has comment: http://stackoverflow.com/comment/31564014
has comment: http://stackoverflow.com/comment/31563582
type: UnansweredQuestion
tagged with: java
duplicate of: http://stackoverflow.com/q/2393179
type: Question
tagged with: network-programming
linked to: http://stackoverflow.com/q/2393179
has answer: http://stackoverflow.com/a/21003462

http://stackoverflow.com/comment/31613525
type: AnswerComment
comment on: http://stackoverflow.com/a/21011017
type: Comment
has text: @ccjmne... Again I find myself as DENSE AS ... _iridium_ (thank you, Google). But to be a little fair to myself, since I'd modified a Java Tutorial's code and that code did NOT have the missing `setLayout` ("missing" since unnecessary to the tutorial's point), my lack of knowledge about `GridBagLayout` kept me from seeing the **absolutely obvious omission**. Anyway, I just went back to last night's addComponent adventure and added your line. Perfect-a-mundo. (Why can't I see this before asking............)
score: 0

http://stackoverflow.com/a/20998407
answers question: http://stackoverflow.com/q/20998371
has body: You must pass the Thread a Runnable. Since thread is an instance variable and the class implements Runnable I guess you want to do this: Thread thread = new Thread(this); But be careful when calling overridable methods from a constructor and be more careful if these methods are called by a separate thread that runs the code in parralel to the constructor initialization. It might run while the constructor still initializes the object. Think about what will happen if you subclass Screen, override the run method and the run method accesses properties of the superclass Screen while it is initializing. Also see What&#39;s wrong with overridable method calls in constructors?
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/31555385
accepted answer of: http://stackoverflow.com/q/20998371

http://stackoverflow.com/comment/31313395
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/20869537
has text: Proper indentation (or, really, ANY) would help...
type: Comment

http://stackoverflow.com/a/21034044
score: 0
has body: The shortest path for you to explore is Oracle's TimesTen. Since it is also an Oracle product, it's going to (probably) be the easiest to integrate with your current system. At a (very) high level, you can just bolt it on and, poof, it's an in-memory cache for your Oracle database, and will automatically keep it in sync. And, you'll be able to use the same SQL operations. If that doesn't get you to the performance you need, you could look at my company's product, eXtremeDB. We have quite a few customers that use it as a front-end cache to Oracle. It's not an Oracle product, so the SQL you use with Oracle will probably have to be tweaked, and there will be some work to do to keep eXtremeDB in sync with Oracle (but a whole lot less work than going with a NoSQL/key-value pair solution). The payoff is that eXtremeDB is a lot faster than TimesTen (Oracle's license doesn't permit publication of benchmarks, so I can't be more specific).
type: Answer
answers question: http://stackoverflow.com/q/21014349

http://stackoverflow.com/comment/31443219
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20909347
type: Comment
has text: Good point, maybe I'll start using those actually. Another thing the scope annotations are useful for is as a reminder not to inject `@RequestScoped` things directly (without `Provider<>`) into `@Singleton`s, for example. But it's true that you could get confused if the `Module` overrides that scope. Maybe Guice should have a mode that prohibits that.

ant
tags question: http://stackoverflow.com/q/20915785
tags question: http://stackoverflow.com/q/20863750
tags question: http://stackoverflow.com/q/20867949
tags question: http://stackoverflow.com/q/20925120
tags question: http://stackoverflow.com/q/20989460
tags question: http://stackoverflow.com/q/20992485
tags question: http://stackoverflow.com/q/20873323
tags question: http://stackoverflow.com/q/20866807
type: Tag
tags question: http://stackoverflow.com/q/20906977
tags question: http://stackoverflow.com/q/20958996
tags question: http://stackoverflow.com/q/20910593
tags question: http://stackoverflow.com/q/20976490
tags question: http://stackoverflow.com/q/20994125
tags question: http://stackoverflow.com/q/20945215
tag name: ant
tags question: http://stackoverflow.com/q/20972246
tags question: http://stackoverflow.com/q/21001689
tags question: http://stackoverflow.com/q/20991347
tags question: http://stackoverflow.com/q/20952872
tags question: http://stackoverflow.com/q/20988711
tags question: http://stackoverflow.com/q/20862535
tags question: http://stackoverflow.com/q/20949339
tags question: http://stackoverflow.com/q/20883212
tags question: http://stackoverflow.com/q/20958772
tags question: http://stackoverflow.com/q/20995903
tags question: http://stackoverflow.com/q/20993915
tags question: http://stackoverflow.com/q/20861539
tags question: http://stackoverflow.com/q/20879988

http://stackoverflow.com/q/20907831
downvote count: 0
has comment: http://stackoverflow.com/comment/31385393
linked to: http://stackoverflow.com/q/1198911
has comment: http://stackoverflow.com/comment/31385256
has comment: http://stackoverflow.com/comment/31385166
linked to: http://stackoverflow.com/q/585534
has comment: http://stackoverflow.com/comment/31385006
has comment: http://stackoverflow.com/comment/31385101
favorite count: 0
has title: OS-independent location to store program files
upvote count: 2
type: UnansweredQuestion
tagged with: file-location
score: 2
has comment: http://stackoverflow.com/comment/31385209
answer count: 0
has body: I'm looking for a platform-independent way of getting a location where my Java program can save files. This location should be user-dependent. What I want is: %userprofile%\AppData\Local\MyAppName\ on Windows, ~/.local/share/MyAppName/ or something like that on Ubuntu Anything else corresponting so it works on every platform
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31385648
has comment: http://stackoverflow.com/comment/31384904

http://stackoverflow.com/comment/31525057
has text: The server should be multi-threaded, doesn't have to be but might be easier, and should always be listening for new connections. When it receives a new connection put it into a new thread, to go do its business, and then listen for another connection. Look for tutorials out there, you'll figure it out. By practicing and trying new techniques you will find what works and what doesn't. The option I listed above is just one of many solutions to go about your project. Good Luck :)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20981455

http://stackoverflow.com/comment/31414177
type: Comment
has text: I start application about 10 times, and lastly `main_activity_actions` appeared in R.
type: AnswerComment
comment on: http://stackoverflow.com/a/20922855
score: 0

http://stackoverflow.com/a/20897623
has comment: http://stackoverflow.com/comment/31366116
has comment: http://stackoverflow.com/comment/31366303
type: Answer
has comment: http://stackoverflow.com/comment/31366370
has comment: http://stackoverflow.com/comment/31366264
has comment: http://stackoverflow.com/comment/31366054
has comment: http://stackoverflow.com/comment/31366157
score: 2
has body: please change your code to below .You have used the array indexes wrongly. import java.util.Scanner; public class CalculatorCode { public static void main(String[] args) { while(true){ Scanner input = new Scanner(System.in); String userinput = input.nextLine(); if(userinput.contains("x")){ String[] multiply = userinput.split("x"); String multiply1 = multiply[0]; String multiply2 = multiply[1]; double a = Double.parseDouble(multiply1); double b = Double.parseDouble(multiply2); double multoutput = a * b; System.out.println(a + "x" + b + "=" + multoutput); } if(userinput.contains("/")){ String[] divide = userinput.split("/"); String divide1 = divide[0]; String divide2 = divide[1]; double c = Double.parseDouble(divide1); double d = Double.parseDouble(divide2); double divideoutput = c/d; System.out.println(c + "/" + d + "=" + divideoutput); } if(userinput.contains("-")){ String[] subtract = userinput.split("\\-"); String subtract1 = subtract[0]; String subtract2 = subtract[1]; double e = Double.parseDouble(subtract1); double f = Double.parseDouble(subtract2); double suboutput = e - f; System.out.println(e + "-" + f + "=" + suboutput); } if(userinput.contains("+")){ String[] add = userinput.split("\\+"); String add1 = add[0]; String add2 = add[1]; double g = Double.parseDouble(add1); double h = Double.parseDouble(add2); double addoutput = g + h; System.out.println(g + "+" + h + "=" + addoutput); } } } }
has comment: http://stackoverflow.com/comment/31366345
upvote count: 3
has comment: http://stackoverflow.com/comment/31366564
has comment: http://stackoverflow.com/comment/31366131
accepted answer of: http://stackoverflow.com/q/20897588
downvote count: 1
has comment: http://stackoverflow.com/comment/31366086
answers question: http://stackoverflow.com/q/20897588
has comment: http://stackoverflow.com/comment/31455251
has comment: http://stackoverflow.com/comment/31365998
has comment: http://stackoverflow.com/comment/31366235
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31366342
has comment: http://stackoverflow.com/comment/31366175
has comment: http://stackoverflow.com/comment/31366097

http://stackoverflow.com/q/21009337
tagged with: java
has title: This command is failing file.createNewFile(); Exception "The system cannot find the path specified."
type: Question
has body: The problem I have is that I am at a state where I cannot change my code, but I can change my configuration. I am at the deployment stage. This command worked at our testing stage. I hope it is either a configuration problem or a permission problem. In my properties file I have kea.output=C:/TLA/kea - I use a / even though it is windows. Windows has usually allowed that. I am going to change it to \ to see if that helps. In my applicationContext.xml file I have `&lt;bean class="org.xxx.xxx.export.util.FileManager"&gt; &lt;property name="systemFolder" value="${system.folder}"/&gt; &lt;property name="keaOutput" value="${kea.output}"/&gt; &lt;/bean&gt;` The problem is in FileManager, which is a bean in Spring. At first I create a file then I run this to create the folders. This runs successfully. File file = new File( keaOutput + File.separator + EXPORT_RPT_FILE ); createFolders( keaOutput ); public void createFolders( String folderName ) { File folder = new File( folderName ); if ( !folder.exists() ) { folder.mkdirs(); } } The next line is: file.createNewFile(); I receive this partial stacktrace: java.io.IOException: The system cannot find the path specified at java.id.WinNTFileSystem.createFileExclusively(Native Method) at java.io.file.createNewFile(Unknown Source) at the line above file.createNewFile() I am using Java 6 64 bit and on my dev. computer I am using Java 6 32 bit.
has comment: http://stackoverflow.com/comment/31576834
has comment: http://stackoverflow.com/comment/31577203
has comment: http://stackoverflow.com/comment/31577911
score: 0
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/31576891
answer count: 0

http://stackoverflow.com/a/20898551
upvote count: 0
answers question: http://stackoverflow.com/q/20898389
score: -1
has comment: http://stackoverflow.com/comment/31367785
downvote count: 1
has comment: http://stackoverflow.com/comment/31367499
has comment: http://stackoverflow.com/comment/31367519
has body: As you have stated in your question it shows an old version of my app that has no buttons, only text that says "Hello World". Just try to uninstall the old application from your emulator and try to run the project. Go to Settings>ApplicationManager> select your application> Uninstall
type: Answer
has comment: http://stackoverflow.com/comment/31367766
has comment: http://stackoverflow.com/comment/31370082
has comment: http://stackoverflow.com/comment/31368326

http://stackoverflow.com/comment/31493197
has text: Also, I don't think `$ifNull` will work here. I want to return 1 if not null and 0 if not null OR not exists.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20964169
score: 0

file
tags question: http://stackoverflow.com/q/20889571
type: Tag
tags question: http://stackoverflow.com/q/20988153
tags question: http://stackoverflow.com/q/20921589
tags question: http://stackoverflow.com/q/20900603
tags question: http://stackoverflow.com/q/20860543
tags question: http://stackoverflow.com/q/20940330
tags question: http://stackoverflow.com/q/20897464
tags question: http://stackoverflow.com/q/20884521
tags question: http://stackoverflow.com/q/21013486
tag name: file
tags question: http://stackoverflow.com/q/20888383
tags question: http://stackoverflow.com/q/20876046
tags question: http://stackoverflow.com/q/20890202
tags question: http://stackoverflow.com/q/20960614
tags question: http://stackoverflow.com/q/20862869
tags question: http://stackoverflow.com/q/20940082
tags question: http://stackoverflow.com/q/20993844
tags question: http://stackoverflow.com/q/20871795
tags question: http://stackoverflow.com/q/20991102
tags question: http://stackoverflow.com/q/20937079
tags question: http://stackoverflow.com/q/20872958
tags question: http://stackoverflow.com/q/20890980
tags question: http://stackoverflow.com/q/20918414
tags question: http://stackoverflow.com/q/20987214
tags question: http://stackoverflow.com/q/20965658
tags question: http://stackoverflow.com/q/20927046
tags question: http://stackoverflow.com/q/20939805
tags question: http://stackoverflow.com/q/20916111
tags question: http://stackoverflow.com/q/20991860
tags question: http://stackoverflow.com/q/20941826
tags question: http://stackoverflow.com/q/20884318
tags question: http://stackoverflow.com/q/20921971
tags question: http://stackoverflow.com/q/20933782
tags question: http://stackoverflow.com/q/21017292
tags question: http://stackoverflow.com/q/20947166
tags question: http://stackoverflow.com/q/20898249
tags question: http://stackoverflow.com/q/20941185
tags question: http://stackoverflow.com/q/20882815
tags question: http://stackoverflow.com/q/20930986
tags question: http://stackoverflow.com/q/20889272
tags question: http://stackoverflow.com/q/20933922
tags question: http://stackoverflow.com/q/20891629
tags question: http://stackoverflow.com/q/20944296
tags question: http://stackoverflow.com/q/20975383
tags question: http://stackoverflow.com/q/20860511
tags question: http://stackoverflow.com/q/20998787
tags question: http://stackoverflow.com/q/20934831
tags question: http://stackoverflow.com/q/20871428
tags question: http://stackoverflow.com/q/20954659
tags question: http://stackoverflow.com/q/20983441
tags question: http://stackoverflow.com/q/21002434

http://stackoverflow.com/a/20895829
has comment: http://stackoverflow.com/comment/31362994
has comment: http://stackoverflow.com/comment/31363374
has comment: http://stackoverflow.com/comment/31363101
has body: Date date = new Date(); long timeAgo = 1000L * 60 * 60 * 24 * 7 * 12; Date dateAgo = new Date(date.getTime() - timeAgo); Should work just fine. Don't miss the L from the multiplication, otherwise you'll get overflow results. Good spot by Pshemo. FYI, the timeAgo columns are as follows: 1000 is representative of a second (1000 milliseconds) 1000 * 60 is representative of a minute (60 seconds) 1000 * 60 * 60 is representative of an hour (60 minutes) 1000 * 60 * 60 * 24 is representative of a day (24 hours) 1000 * 60 * 60 * 24 * 7 is representative of a week (7 days) 1000 * 60 * 60 * 24 * 7 * 12 is representative of 12 weeks (12 weeks)
downvote count: 0
has comment: http://stackoverflow.com/comment/31363300
has comment: http://stackoverflow.com/comment/31363405
has comment: http://stackoverflow.com/comment/31363339
type: Answer
has comment: http://stackoverflow.com/comment/31363129
has comment: http://stackoverflow.com/comment/31363151
has comment: http://stackoverflow.com/comment/31363611
has comment: http://stackoverflow.com/comment/31363050
score: 10
has comment: http://stackoverflow.com/comment/31363026
answers question: http://stackoverflow.com/q/20895784
upvote count: 10
has comment: http://stackoverflow.com/comment/31363948

http://stackoverflow.com/q/20953335
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31472428
has title: Can't print java string in jsp page using struts2
type: Question
tagged with: performance
has comment: http://stackoverflow.com/comment/31472672
tagged with: java
tagged with: struts2
tagged with: jsp
tagged with: javascript
has body: I have a string in a java class in a dynamic web application using struts2. I want to print the string within the jsp page. If I need to resort to using javascript I can. public void class writeToJSP(){ private String myString = "abcd"; public void setMyString(String myString) { this.myString = myString; } public String getMyString() { return myString; } } because I'm using struts I've used this line... s:property value="myString" /> But it doesn't print at all. Should I use a different method like putting the string in javascript and doing a document.write()?
has comment: http://stackoverflow.com/comment/31471527
score: 0
has comment: http://stackoverflow.com/comment/31471402
has comment: http://stackoverflow.com/comment/31471478

http://stackoverflow.com/a/20963036
score: 1
has comment: http://stackoverflow.com/comment/31490754
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31490822
has comment: http://stackoverflow.com/comment/31490827
has body: //Define a variable to indicate network settings has been done. public static boolean NETWORK_SETTINGS_DONE = false; public static Object LOCK = new Object(); public void doSometing() { try { } catch (Exception e) { synchronized (LOCK) { if (!NETWORK_SETTINGS_DONE) { //do some changes to your network settings. NETWORK_SETTINGS_DONE=true; } } } }
type: Answer
accepted answer of: http://stackoverflow.com/q/20962911
downvote count: 0
answers question: http://stackoverflow.com/q/20962911

http://stackoverflow.com/comment/31590987
type: Comment
comment on: http://stackoverflow.com/a/21017229
score: 0
has text: I know what you mean. You don't have to name those `Pair`s uniquely as you store them in `ArrayList`. I will edit my answer to show you what I mean. Anyway, I'd really encourage you to try the `HashMap` solution as it's quicker and may teach you something - I just showed you how to use it, so you can see it's really simple.
type: AnswerComment

http://stackoverflow.com/a/20895858
type: Answer
has comment: http://stackoverflow.com/comment/31366607
accepted answer of: http://stackoverflow.com/q/20895723
has comment: http://stackoverflow.com/comment/31363500
score: 0
answers question: http://stackoverflow.com/q/20895723
type: AcceptedAnswer
has body: Your client should change as following. Since you are using a doPOST not doGet String URL = "http://localhost:8080/" String serverURL = URL + "servlet?param=" + someParam; final URL url = new URL(serverURL) final HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoOutput(true); connection.setRequestMethod("POST"); final BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream())); System.out.println(br.readLine()); Your code as it is might be calling doGet

http://stackoverflow.com/q/20944368
answer count: 0
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31597827
has comment: http://stackoverflow.com/comment/31597744
has body: I am using Spring Hibernate with app engine and cloudSQL for my project but i am getting one error frequently. This occurs when application becomes ideal for sometimes. For every query (fetching or save/update to database), i open session and close session after its use. like this -- My code for database fetching is try{ Session session = getSessionFactory().openSession(); if(session != null) { List&lt;Account&gt; accounts = session.createQuery("from " + this.clazz.getName() + " where subDomainName = '"+subDomain+"'").list(); session.close(); if(accounts != null) { if(accounts.size()&gt;0){ return accounts.get(0); } else{ return null; } } else { return null; } } else { return null; } } catch(Exception e){ log.info("Error in retriving subdomain details :: in Account Dao"); return null; } I am using Autowired structuring. but when application becomes ideal for sometime and after some time when i refresh page its display the error as Stream Closed of CloudSQL on app engine, error is shown below... Error is : 6 Jan, 2014 6:21:04 AM com.google.appengine.repackaged.org.apache.http.impl.client.DefaultRequestDirector handleResponse WARNING: Authentication error: Unable to respond to any of these challenges: {bearer=WWW-Authenticate: Bearer realm="https://www.google.com/accounts/AuthSubRequest", error=invalid_token} 6 Jan, 2014 6:21:04 AM com.google.appengine.api.rdbms.dev.LocalRdbmsServiceRemoteDriver openConnection WARNING: openConnection java.sql.SQLException: Stream closed at com.google.cloud.sql.jdbc.internal.googleapi.RpcGoogleApi.newOpenConnectionIOException(RpcGoogleApi.java:187) at com.google.cloud.sql.jdbc.internal.googleapi.RpcGoogleApi.openConnection(RpcGoogleApi.java:105) at com.google.appengine.api.rdbms.dev.LocalRdbmsServiceRemoteDriver.openConnection(LocalRdbmsServiceRemoteDriver.java:206) at com.google.appengine.api.rdbms.dev.LocalRdbmsService.openConnection(LocalRdbmsService.java:119) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.ref…
type: Question
tagged with: gae-search
tagged with: google-cloud-datastore
tagged with: google-cloud-sql
has comment: http://stackoverflow.com/comment/31551776
has title: java + app engine + cloudSQL + spring/hibernate
type: UnansweredQuestion
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/31597795

http://stackoverflow.com/q/21005792
favorite count: 0
has title: Does MongoDB Grails plugin support SSL
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: plugins
score: 2
tagged with: java
tagged with: ssl
tagged with: grails
type: Question
upvote count: 2
tagged with: mongodb
has body: I am trying to configure my Grails application that uses MongoDB plugin for persistence. My application runs in the development environment, against default MongoDB installation. In production I am using a MongoDB instance configured to use SSL. I am unable to connect to that database (not find any documentation regarding the SSL configuration). The plugin documentation does mention using MongoOptions. So I tried: grails { mongo { ... options { socketFactory = SocketFactory.getDefault() } } } The error I am getting is: Bean property 'socketFactory' is not writabe or has an invalid setter method Without the options, the error is: IOException authentication the connection Does Grails MongDB plugin support SSL-based configuration?

http://stackoverflow.com/comment/31490363
has text: How do you intilialized a Graphics context then? I cannot figure this out.
type: Comment
comment on: http://stackoverflow.com/a/20939211
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31483309
type: QuestionComment
type: Comment
has text: "I can't make them into a grouped object either" why? how about a key-value pair?
comment on: http://stackoverflow.com/q/20959246
score: 0

http://stackoverflow.com/comment/31577186
has text: What is an exe file good for? It doesn't run on my computer. :D
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/21007064

http://stackoverflow.com/comment/31299106
comment on: http://stackoverflow.com/q/20862001
has text: cause replaceAll exepcts a regex.. and `.` is a special symbol
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/31442232
has text: it's not working, alert(state.stateName); gives output as "undefined"
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20937477

http://stackoverflow.com/q/20888590
has title: Catch startup exception in Grails if Hibernate database connection fails
answer count: 1
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: spring
score: 2
linked to: http://stackoverflow.com/q/20634276
tagged with: java
tagged with: hibernate
tagged with: grails-orm
type: Question
has answer: http://stackoverflow.com/a/20889236
downvote count: 0
tagged with: grails
has body: We're building an app using Grails 2.0.4, GORM, and Hibernate. When the database is not available, Grails will not initialize, and startup fails. We thought our pool settings would protect against startup failures, but that doesn't seem to be the case. If pool settings alone can't address this, is it possible to catch exceptions in resources.groovy where, if a database service can't be initialized, switch to a file-based service temporarily? Something like this... resources.groovy try{ myDataService(PostgresDatabaseServiceImpl){} }catch(Exception e){ //if database connect failed, use local service instead myDataService(FileBasedServiceImpl){} } Even if the above is possible, it creates a new problem; how to switch back, dynamically, once the database is available. We attempted the above try/catch, but it had no impact, the startup issue persists: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed If it's possible to avoid startup failures through pool settings alone, we could certainly manage SQL exceptions at runtime when the app attempts to use bad database connections, but startup failures we can't manage. DataSource.groovy (pool settings) dataSource { pooled = true driverClassName = "org.postgresql.Driver" properties { maxActive = 20 minEvictableIdleTimeMillis=1800000 timeBetweenEvictionRunsMillis=1800000 numTestsPerEvictionRun=3 testOnBorrow=true testWhileIdle=true testOnReturn=true validationQuery="SELECT 1" } } hibernate { cache.use_second_level_cache = false cache.use_query_cache = false cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory' }

http://stackoverflow.com/q/20923686
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/20908283
type: Question
has comment: http://stackoverflow.com/comment/31415887
has comment: http://stackoverflow.com/comment/31415977
downvote count: 0
favorite count: 0
tagged with: data-binding
has comment: http://stackoverflow.com/comment/31415790
has title: Bind property of property - JSF2 - <h:dataTable>
answer count: 0
has body: (Please view edit down below) As a continuation of the code from this SO question, I am now trying to save the modified values of a &lt;h:dataTable&gt; using the persistance of the entity class. I have a dataTable as follows: &lt;h:form&gt; &lt;h:dataTable id="userTable" value="#{admin.customerList}" var="c" binding="#{admin.customerTable}"&lt;!-- Not sure if this is necessary --&gt; styleClass="gnomeTable" headerClass="gnomeTableHeader" rowClasses="gnomeTableOddRow,gnomeTableEvenRow" bgcolor="#F1F1F1" border="10" cellspacing="2" rules="all" &gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="All registered customers" /&gt; &lt;/f:facet&gt; &lt;h:column&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="User ID" /&gt; &lt;/f:facet&gt; &lt;h:outputText value="#{c.id}"&gt;&lt;/h:outputText&gt; &lt;/h:column&gt; &lt;h:column&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="Username"/&gt; &lt;/f:facet&gt; &lt;h:outputText value="#{c.username}" rendered="#{not c.editable}"&gt;&lt;/h:outputText&gt; &lt;h:inputText value="#{c.username}" rendered="#{c.editable}"&gt;&lt;/h:inputText&gt; &lt;/h:column&gt; &lt;h:column&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="Email"/&gt; &lt;/f:facet&gt; &lt;h:outputText value="#{c.email}" rendered="#{not c.editable}"&gt;&lt;/h:outputText&gt; &lt;h:inputText value="#{c.email}" rendered="#{c.editable}"&gt;&lt;/h:inputText&gt; &lt;/h:column&gt; &lt;h:column&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="Banned?"/&gt; &lt;/f:facet&gt; &lt;h:selectBooleanCheckbox value="#{c.banned}" rendered="#{not c.editable}" disabled="true"&gt;&lt;/h:selectBooleanCheckbox&gt; &lt;h:selectBooleanCheckbox value="#{c.banned}" rendered="#{c.editable}" disabled="false"&gt;&lt;/h:selectBooleanCheckbox&gt; &lt;/h:column&gt; &lt;h:column&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="Admin?"/&gt; &lt;/f:facet&gt; &lt;h:selectBooleanCheckbox value="#{c.admin}" rendered="#{not c.editable}" disabled="true"&gt;&…
type: UnansweredQuestion
upvote count: 1
tagged with: datatable
tagged with: jsf
has comment: http://stackoverflow.com/comment/31415931

database
tags question: http://stackoverflow.com/q/20946090
tags question: http://stackoverflow.com/q/20987280
tags question: http://stackoverflow.com/q/20997410
tags question: http://stackoverflow.com/q/20986202
tags question: http://stackoverflow.com/q/20992888
tags question: http://stackoverflow.com/q/20852776
tags question: http://stackoverflow.com/q/21015231
tags question: http://stackoverflow.com/q/20920025
tags question: http://stackoverflow.com/q/20895646
type: Tag
tags question: http://stackoverflow.com/q/20924970
tags question: http://stackoverflow.com/q/20857383
tags question: http://stackoverflow.com/q/21016644
tags question: http://stackoverflow.com/q/20946311
tags question: http://stackoverflow.com/q/20956923
tags question: http://stackoverflow.com/q/20991219
tags question: http://stackoverflow.com/q/20994585
tag name: database
tags question: http://stackoverflow.com/q/20883964
tags question: http://stackoverflow.com/q/20961820
tags question: http://stackoverflow.com/q/20960004
tags question: http://stackoverflow.com/q/20949144
tags question: http://stackoverflow.com/q/20933425
tags question: http://stackoverflow.com/q/20935793
tags question: http://stackoverflow.com/q/20925090
tags question: http://stackoverflow.com/q/20931309
tags question: http://stackoverflow.com/q/21006073
tags question: http://stackoverflow.com/q/20949313
tags question: http://stackoverflow.com/q/20868677
tags question: http://stackoverflow.com/q/20968797
tags question: http://stackoverflow.com/q/21017616
tags question: http://stackoverflow.com/q/20991567
tags question: http://stackoverflow.com/q/20948400
tags question: http://stackoverflow.com/q/20971447
tags question: http://stackoverflow.com/q/20850973
tags question: http://stackoverflow.com/q/20980517
tags question: http://stackoverflow.com/q/20967440

http://stackoverflow.com/a/21015316
answers question: http://stackoverflow.com/q/21015225
has body: Add jsp-api.jar and servlet-api.jar to your build path.
type: Answer
score: 0

http://stackoverflow.com/q/20930511
accepted answer: http://stackoverflow.com/a/20930539
has comment: http://stackoverflow.com/comment/31428888
has answer: http://stackoverflow.com/a/20930527
has comment: http://stackoverflow.com/comment/31428724
has answer: http://stackoverflow.com/a/20930569
has comment: http://stackoverflow.com/comment/31428768
has comment: http://stackoverflow.com/comment/31428958
answer count: 4
has comment: http://stackoverflow.com/comment/31428843
has body: Just curious as to how I would add a letter or character to a pre-existing string. Here is what I'm trying to do, I'm taking a key and its cipher text and subtracting their values (stored in arraylist) to find the plaintext value (I get an int, and then use that to find the String value in the arraylist) and then continue to do that for each letter in the two strings(Cipher and Key). Is this possible, or would I have to use a substring or something along those lines. Any suggestions on how to do this, or the answer to my initial question is greatly appreciated! Thanks,
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31428633
upvote count: 2
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31428741
linked to: http://stackoverflow.com/q/3801343
has comment: http://stackoverflow.com/comment/31428938
has comment: http://stackoverflow.com/comment/31428786
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/20930551
has answer: http://stackoverflow.com/a/20930539
tagged with: resize
has comment: http://stackoverflow.com/comment/31428629
has title: Add characters to an empty String after it is initialized
has comment: http://stackoverflow.com/comment/31428853
tagged with: string
favorite count: 0
possible better answer: http://stackoverflow.com/a/20930527
linked to: http://stackoverflow.com/q/8798403

http://stackoverflow.com/q/20962339
answer count: 2
accepted answer: http://stackoverflow.com/a/20962426
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20962958
tagged with: java
tagged with: slick2d
has comment: http://stackoverflow.com/comment/31489515
upvote count: 1
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/20962958
has answer: http://stackoverflow.com/a/20962426
tagged with: class
has title: Java/Slick - Should I use multiple classes for a game
score: 0
has body: Hello i'm new to slick (and lwjgl) and was wondering if its best to stick to one class or multiple when I used straight java I used multiple classes but wasn't shoure about slick

http://stackoverflow.com/comment/31318465
has text: Consider using http://docs.oracle.com/javase/6/docs/api/javax/imageio/ImageIO.html#read(java.io.InputStream). Your code examples do not show enough for me to determine exactly what libraries you are using for image manipulation.
type: Comment
comment on: http://stackoverflow.com/a/20871284
score: 0
type: AnswerComment

http://stackoverflow.com/a/20915027
has comment: http://stackoverflow.com/comment/31399870
has comment: http://stackoverflow.com/comment/31399534
accepted answer of: http://stackoverflow.com/q/20915010
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31399670
has comment: http://stackoverflow.com/comment/31399756
type: Answer
has comment: http://stackoverflow.com/comment/31399729
has comment: http://stackoverflow.com/comment/31399632
has body: try import javax.swing.JButton; public class replaceButton **extends JButton** { public replaceButton(String name) { this.setText(name); ImageIcon background = new ImageIcon("/assets/buttons/menu.png"); this.setIcon(background); this.setSize(1000,1000); } } by extending JButton you give it the properties of a button. make sure you dont have any layout by adding this to the JFrame this.setLayout(null); else the button will be adjusted to the layout see http://docs.oracle.com/javase/tutorial/uiswing/layout/border.html
answers question: http://stackoverflow.com/q/20915010
has comment: http://stackoverflow.com/comment/31399692

http://stackoverflow.com/a/21002871
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21002032
answers question: http://stackoverflow.com/q/21002032
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31563751
has body: As Kevin mentioned, you never put anything in your ArrayList. Your code should look something like this... data = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(500); try { //give the record a numeric ID data.add(currRec, temp); In your previous solution, you're calling data.set(currRec, temp); which assumes there is a HashMap element in position currRec of your ArrayList. If you haven't put anything in the ArrayList yet, there will be no element currRec.

http://stackoverflow.com/comment/31393315
score: 0
type: Comment
type: QuestionComment
has text: What I mean by "doesn't work" is the function getAccelerometer(event) is not getting called. The minimum sdk is 10
comment on: http://stackoverflow.com/q/20911513

http://stackoverflow.com/q/20937349
tagged with: netbeans
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/20938623
score: 1
tagged with: java
tagged with: mysql
type: Question
has body: I have created MySQL database for my website using cPanel and phpMyAdmin on remote host and now i want to connect to this database my simple java program.I try this code: import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; public class Main { public static void main(String[] args) { try{ Connection con=DriverManager.getConnection("jdbc:mysql://sfg.ge/sfgge_mysql", "my_username", "my_password"); Statement state=(Statement) con.createStatement(); String name="shota"; int id=3; String insert = "INSERT INTO student VALUES ("+ id +",'"+ name +"')"; state.executeUpdate(insert); } catch(Exception ex){ } } } In this code DriverManager.getConnection(String url, username, pass) SQLException throws such error: null, message from server: "Host '188.129.228.176' is not allowed to connect to this MySQL server" Any suggestions appreciated.
answer count: 1
downvote count: 0
has title: Connect to remote mySQL(cPanel,phpMyAdmin) using Netbeans
favorite count: 0

http://stackoverflow.com/q/20949678
has answer: http://stackoverflow.com/a/20950488
type: Question
answer count: 1
has title: How to call methods on a Java nested abstract class from JRuby?
score: 0
tagged with: jruby
accepted answer: http://stackoverflow.com/a/20950488
has body: Have this: public abstract class A { public abstract static class B { public static void greet() { System.out.println("Hey"); } } } You can do, in Java, A.B.greet(); But in JRuby, how do I call that? I tried A::B.greet But it can't find the greet() method.
tagged with: ruby
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/20989523
has body: I'm having trouble with passing servlet variables to jsp. Of course, I also have the web.xml set for the servlet already databaseServlet Servlet.databaseServlet 1 databaseServlet /dbServlet The result is all of the name, owner, species and sex values are null. Can someone help me with this? Thanks P.S: I also tried to use request.getSession().setAttribute in the servlet, didn't work either P.P.S: So if I make the following changes: databaseServlet.java package Servlet; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.sql.*; import java.util.ArrayList; @SuppressWarnings("serial") public class databaseServlet extends HttpServlet { private Connection conn; private Statement statement; String name; String owner; String species; String sex; String birth; String death; public void init(ServletConfig config) throws ServletException { try { Class.forName("com.mysql.jdbc.Driver"); conn = DriverManager.getConnection( "jdbc:mysql://localhost/STUDENTS", "root", ""); statement = conn.createStatement(); String sql = "SELECT name, owner, species, sex, birth, death FROM pet"; ResultSet rs = statement.executeQuery(sql); //STEP 5: Extract data from result set while(rs.next()){ //Retrieve by column name name = rs.getString("name"); owner = rs.getString("owner"); species = rs.getString("species"); sex = rs.getString("sex"); birth = rs.getString("birth"); death = rs.getString("death"); } rs.close(); } catch (Exception e) { e.printStackTrace(); } } protected void doPost (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setAttribute("NAME", "Hello"); System.out.println(name); request.setAttribute("OWNER",owner); request.setAttribute("SPECIES",species); request.setAttribute("SEX", sex); RequestDispatcher dispatcher=getServletConfig().getServletContext().getRequestDispatcher("/dbServlet.jsp"); dispatcher.forward(request, response); } } and this is my new jsp: Name="${databaseServlet.NAME}" Owner="${dat…
type: Question
has answer: http://stackoverflow.com/a/44124014
tagged with: java
has title: Servlet JSP getparameter getattribute returning null
tagged with: servlets
tagged with: getparameter
score: 0
answer count: 3
tagged with: jsp
has comment: http://stackoverflow.com/comment/31539494
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20989616
linked to: http://stackoverflow.com/q/3177733
tagged with: getattribute
has comment: http://stackoverflow.com/comment/31539503
has comment: http://stackoverflow.com/comment/31562960
has answer: http://stackoverflow.com/a/20989745

http://stackoverflow.com/comment/31474732
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20954812
has text: In contrast, `getResourceAsStream` is designed to get files stored inside your jar files (`File` can't do this), and that is why you are able to load resources in your classpath using this. You normally use this to load resources that you are bundling with the program, as opposed to files saved by users outside your program (for which you will use `File`) These two are for different kinds of file loading, and **non-interchangeable**. Do not confuse between the two.
score: 0

dom
tags question: http://stackoverflow.com/q/20987309
type: Tag
tags question: http://stackoverflow.com/q/20861321
tags question: http://stackoverflow.com/q/20948398
tags question: http://stackoverflow.com/q/20908771
tags question: http://stackoverflow.com/q/20924101
tags question: http://stackoverflow.com/q/20931157
tags question: http://stackoverflow.com/q/21001961
tag name: dom
tags question: http://stackoverflow.com/q/20984323

http://stackoverflow.com/q/20922621
score: 0
has comment: http://stackoverflow.com/comment/31413115
possible better answer: http://stackoverflow.com/a/20922688
has comment: http://stackoverflow.com/comment/31413264
has answer: http://stackoverflow.com/a/20922855
has comment: http://stackoverflow.com/comment/31413553
has comment: http://stackoverflow.com/comment/31413369
favorite count: 0
has comment: http://stackoverflow.com/comment/31413228
has comment: http://stackoverflow.com/comment/31413283
answer count: 3
has comment: http://stackoverflow.com/comment/31413287
has comment: http://stackoverflow.com/comment/31413187
tagged with: android
has comment: http://stackoverflow.com/comment/31413156
accepted answer: http://stackoverflow.com/a/20922855
has title: How to add action bar to Android app?
has comment: http://stackoverflow.com/comment/31413391
type: AnsweredQuestion
has body: I just start with Android. Want to add action bar following the tutorial. I was added res/menu/main_activity_actions.xml: &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:NecoSeparator="http://schemas.android.com/apk/res-auto" &gt; &lt;!-- Search, should appear as action button --&gt; &lt;item android:id="@+id/action_search" android:icon="@drawable/ic_action_search" android:title="@string/action_search" NecoSeparator:showAsAction="ifRoom" /&gt; &lt;!-- Settings, should always be in the overflow --&gt; &lt;item android:id="@+id/action_settings" android:title="@string/action_settings" android:showAsAction="never" /&gt; In MainActivity.java i do: public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu items for use in the action bar MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main_activity_actions, menu); return super.onCreateOptionsMenu(menu); } But Eclipse says that cant find : R.menu.main_activity_actions. What's wrong with this code? I have to do something more with this xml file? UPDATE MainActivity.java package com.example.necoseparator; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.EditText; public class MainActivity extends Activity { public final static String EXTRA_MESSAGE = "com.example.myfirstapp.MESSAGE"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu items for use in the action bar MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main_activity_actions, menu); return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle presses on the action bar items switch (item.getItemId()) { cas…
has comment: http://stackoverflow.com/comment/31413435
upvote count: 1
downvote count: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/31413497
has answer: http://stackoverflow.com/a/20922688
has answer: http://stackoverflow.com/a/34370832

http://stackoverflow.com/q/20917944
has comment: http://stackoverflow.com/comment/31405223
type: Question
score: -2
has answer: http://stackoverflow.com/a/20918411
tagged with: java
has title: how to call all the saved information in array?
upvote count: 0
has comment: http://stackoverflow.com/comment/31405323
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/20918411
has comment: http://stackoverflow.com/comment/31404793
has body: whenever i enter the first account.. i can check the all information, i can withdraw, i can deposit.. but when i enter second bank account and check the information from the first entered account.. i can't get it.. it displays the error message that "no record found!".. someone help me please? heres the code: public class BankAccount extends JFrame implements ActionListener { private JLabel acct_noL, nameL, addressL, bdayL, amountL; private JTextField acct_noTF, nameTF, addressTF, bdayTF, amountTF; private JButton addB, checkB, clearB, exitB, withdrawB, depositB; SavingsAccount[] savings = new SavingsAccount[10]; private int index = 0; private int acct_no = 1000; public BankAccount() { for(int ctr=0;ctr&lt;=9;ctr++) { savings[ctr] = new SavingsAccount(); } setTitle("Bank Account"); setDefaultCloseOperation(EXIT_ON_CLOSE); acct_noL = new JLabel("Account Number",SwingConstants.RIGHT); nameL = new JLabel("Name",SwingConstants.RIGHT); addressL = new JLabel("Address",SwingConstants.RIGHT); bdayL = new JLabel("Birthday",SwingConstants.RIGHT); amountL = new JLabel("Amount to Save",SwingConstants.RIGHT); acct_noTF = new JTextField(10); nameTF = new JTextField(10); addressTF = new JTextField(10); bdayTF = new JTextField(10); amountTF = new JTextField(10); acct_noTF.setText("1000"); addB = new JButton("Add Account"); checkB = new JButton("Check Account"); clearB = new JButton("Clear"); exitB = new JButton("Exit"); withdrawB = new JButton("Withdraw"); depositB = new JButton("Deposit"); addB.addActionListener(this); checkB.addActionListener(this); clearB.addActionListener(this); exitB.addActionListener(this); withdrawB.addActionListener(this); depositB.addActionListener(this); Container pane = getContentPane(); pane.setLayout(new GridLayout(8,2)); pane.add(acct_noL); pane.add(acct_noTF); pane.add(nameL); pane.add(nameTF); pane.add(addressL); pane.add(addressTF); pane.add(bdayL); pane.add(bdayTF); pane.add(amountL); pane.add(amountTF); pane.add(addB); pane.add(checkB); pane.add(…
has comment: http://stackoverflow.com/comment/31404649
has comment: http://stackoverflow.com/comment/31404714
has comment: http://stackoverflow.com/comment/31404816
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31404935
tagged with: jframe
downvote count: 2

http://stackoverflow.com/comment/31386389
score: 0
comment on: http://stackoverflow.com/a/20908197
has text: Why are `i` and `s` final?
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31542816
has text: Yes. I'm using the same way.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20991558

http://stackoverflow.com/comment/31316126
comment on: http://stackoverflow.com/q/20870879
type: QuestionComment
type: Comment
has text: @norlesh: I suggest not guessing. Unless one is sure, one should leave the OP's text alone in hopes someone else understands it. I've seen a number of clearly-wrong guesses, where the editor basically ended up (inadvertently) vandalizing the question. (As well as, of course, a *lot* of cases where edits have improved/corrected questions.)
score: 0

http://stackoverflow.com/q/20994438
accepted answer: http://stackoverflow.com/a/21002085
type: Question
answer count: 1
downvote count: 0
has body: While validating an XML document using Xerces, it tries to access internet resources in w3c.org. My application that needs to work offline/behind a firewall throws an exception because of that. Is there a workaround? ps. This link provides some insights but no workarounds: http://xerces.apache.org/xerces2-j/faq-general.html#faq-10
tagged with: jaxp
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/21002085
tagged with: xerces
upvote count: 1
type: AnsweredQuestion
tagged with: schema
has title: Xerces (JAXP) tries to access internet resources
score: 1
tagged with: java

javascript
tags question: http://stackoverflow.com/q/20968107
tags question: http://stackoverflow.com/q/20986116
tags question: http://stackoverflow.com/q/20870082
tags question: http://stackoverflow.com/q/21006840
tags question: http://stackoverflow.com/q/20943489
tags question: http://stackoverflow.com/q/20868824
tags question: http://stackoverflow.com/q/20897938
tags question: http://stackoverflow.com/q/20963097
tags question: http://stackoverflow.com/q/20911127
tags question: http://stackoverflow.com/q/20890343
tags question: http://stackoverflow.com/q/20953335
tag name: javascript
tags question: http://stackoverflow.com/q/20976194
tags question: http://stackoverflow.com/q/20932847
tags question: http://stackoverflow.com/q/20881532
tags question: http://stackoverflow.com/q/20928491
tags question: http://stackoverflow.com/q/20870668
tags question: http://stackoverflow.com/q/20984323
tags question: http://stackoverflow.com/q/20965826
tags question: http://stackoverflow.com/q/20895806
tags question: http://stackoverflow.com/q/20904131
tags question: http://stackoverflow.com/q/20980265
type: Tag
tags question: http://stackoverflow.com/q/20879124
tags question: http://stackoverflow.com/q/20991442
tags question: http://stackoverflow.com/q/20903451
tags question: http://stackoverflow.com/q/20905221
tags question: http://stackoverflow.com/q/20983866
tags question: http://stackoverflow.com/q/20920727
tags question: http://stackoverflow.com/q/20880348
tags question: http://stackoverflow.com/q/20876897
tags question: http://stackoverflow.com/q/20945080
tags question: http://stackoverflow.com/q/21015812
tags question: http://stackoverflow.com/q/20878967
tags question: http://stackoverflow.com/q/20965072
tags question: http://stackoverflow.com/q/20992469
tags question: http://stackoverflow.com/q/20997439
tags question: http://stackoverflow.com/q/20955226
tags question: http://stackoverflow.com/q/20896611
tags question: http://stackoverflow.com/q/20990125
tags question: http://stackoverflow.com/q/20877050
tags question: http://stackoverflow.com/q/20878931
tags question: http://stackoverflow.com/q/21013550
tags question: http://stackoverflow.com/q/21000157
tags question: http://stackoverflow.com/q/20900931
tags question: http://stackoverflow.com/q/20930468
tags question: http://stackoverflow.com/q/20934315
tags question: http://stackoverflow.com/q/20935554
tags question: http://stackoverflow.com/q/20974731
tags question: http://stackoverflow.com/q/20896322
tags question: http://stackoverflow.com/q/20988153
tags question: http://stackoverflow.com/q/20977067
tags question: http://stackoverflow.com/q/20999631
tags question: http://stackoverflow.com/q/20973153
tags question: http://stackoverflow.com/q/20913780
tags question: http://stackoverflow.com/q/20934739
tags question: http://stackoverflow.com/q/20878744
tags question: http://stackoverflow.com/q/21013810
tags question: http://stackoverflow.com/q/20856712
tags question: http://stackoverflow.com/q/20994466
tags question: http://stackoverflow.com/q/20853666
tags question: http://stackoverflow.com/q/20989280
tags question: http://stackoverflow.com/q/20997276
tags question: http://stackoverflow.com/q/21008374
tags question: http://stackoverflow.com/q/20998271
tags question: http://stackoverflow.com/q/20940884
tags question: http://stackoverflow.com/q/20937169
tags question: http://stackoverflow.com/q/21005884
tags question: http://stackoverflow.com/q/20882063
tags question: http://stackoverflow.com/q/20888187
tags question: http://stackoverflow.com/q/20902677
tags question: http://stackoverflow.com/q/21007080
tags question: http://stackoverflow.com/q/20949540
tags question: http://stackoverflow.com/q/20975407
tags question: http://stackoverflow.com/q/20867119
tags question: http://stackoverflow.com/q/20904548

http://stackoverflow.com/a/20863299
answers question: http://stackoverflow.com/q/20863160
has body: Java is having trouble identifying which Scanner you are referring to. There are two Scanners in your project: java.util.Scanner and the Scanner class YOU created. Java thinks that you are referring to the Scanner class that you created, instead of the java.util.Scanner class. Simply rename your class and file to a name that java doesn't already use.
score: 0
type: Answer

http://stackoverflow.com/comment/31307009
comment on: http://stackoverflow.com/q/20866021
score: 0
type: Comment
type: QuestionComment
has text: I said put `refreshingThread.unpause();` into `OnResume();`,did you test that?

http://stackoverflow.com/q/20903589
tagged with: jdbc
linked to: http://stackoverflow.com/q/9937438
has body: I'm trying to connect a java program in netbeans using the mysql j connector i get an exception message saying com.mysql.jdbc.Driver this my code package testdb; import java.sql.*; public class Testdb { /** * @param args the command line arguments */ public static void main(String[] args) { String url = "jdbc:mysql://localhost:3306/location"; String login = "root"; String pass = ""; try { Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection(url,login,pass); Statement s = con.createStatement(); ResultSet r = s.executeQuery("select * from reservation"); while(r.next()) { System.out.println("id reservation = "+r.getInt("id_reservation")); } }catch (Exception e) { System.out.println(e.getMessage()); } } }
has comment: http://stackoverflow.com/comment/31376584
type: AnsweredQuestion
upvote count: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/20903971
tagged with: mysql
type: Question
score: -2
possible better answer: http://stackoverflow.com/a/20903961
has answer: http://stackoverflow.com/a/20903971
downvote count: 2
answer count: 2
tagged with: sql
has comment: http://stackoverflow.com/comment/31376558
has comment: http://stackoverflow.com/comment/31376636
favorite count: 0
has comment: http://stackoverflow.com/comment/31376569
has title: connect a java program to mysql in netbeans
duplicate of: http://stackoverflow.com/q/9937438
has comment: http://stackoverflow.com/comment/31376571
has answer: http://stackoverflow.com/a/20903961

http://stackoverflow.com/a/21328728
type: Answer
has comment: http://stackoverflow.com/comment/62929033
accepted answer of: http://stackoverflow.com/q/20970088
answers question: http://stackoverflow.com/q/20970088
has body: Found the solution as below.... posting it as it could help somebody else too :) DateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); Date date = format.parse("2014-04-24 11:15:00"); GregorianCalendar cal = new GregorianCalendar(); cal.setTime(date); XMLGregorianCalendar xmlGregCal = DatatypeFactory.newInstance().newXMLGregorianCalendar(cal); System.out.println(xmlGregCal); Output: 2014-04-24T11:15:00.000+02:00
score: 50
type: AcceptedAnswer
upvote count: 50
downvote count: 0

http://stackoverflow.com/comment/31286952
comment on: http://stackoverflow.com/q/20855657
score: 0
has text: This is a bug in GF 3.1.1's CDI implementation. Which OminFaces version are you using? Since 1.6.3 there's a CDI extension which should veto those classes from being unnecessarily auto-registered as CDI managed beans. So, with OmniFaces 1.6.3 you shouldn't be seeing those exceptions at all (if the container's CDI implementation is doing its job well ...). Never seen those in GF 3.1.2.2, by the way, haven't ever tested it on 3.1.1.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20866258
tagged with: java
tagged with: http://stackoverflow.com/tag/json
score: -1
tagged with: eclipse
answer count: 2
accepted answer: http://stackoverflow.com/a/20866282
has comment: http://stackoverflow.com/comment/31307336
has body: Here is some JSON output: { "model": "model/xxx", "source_status": true, "objective_field": "000007", "locale": "en-US", "credits": 0.01, "query_string": "", "private": true, "subscription": true, "updated": "2014-01-01T05:15:47.560445", "created": "2014-01-01T05:15:47.560417", "number_of_models": 1, "description": "", "name": "Prediction for Category", "prediction_path": { "path": [], "next_predicates": [ { "value": 1.12945, "field": "00000e", "count": 6483, "operator": "&gt;" }, { "value": 1.12945, "field": "00000e", "count": 3517, "operator": "&lt;=" } ], "bad_fields": [], "confidence": 0.32562, "unknown_fields": [], "objective_summary": { "categories": [ [ "Whale", 1626 ], [ "Minnow", 1953 ], [ "Fish", 3073 ], [ "Free", 3348 ] ] } }, "fields": { "00000e": { "column_number": 14, "optype": "numeric", "datatype": "double", "order": 5, "preferred": true, "prefix": "$", "name": "Monthly Spend" }, "000007": { "optype": "categorical", "order": 3, "description": "", "name": "Category", "term_analysis": { "enabled": true }, "label": "", "column_number": 7, "datatype": "string", "preferred": true } }, "tags": [], "shared": false, "objective_field_name": "Category", "status": { "progress": 1, "message": "The prediction has been created", "elapsed": 0.028, "code": 5 }, "resource": "prediction/52c3a483e61ab00496000000", "objective_fields": [ "000007" ], "model_status": true, "prediction": { "000007": "Free" }, "input_data": {}, "dataset_status": true, "tlp": 1, "confidence": 0.3245, "code": 201, "missing_strategy": 0, "category": 0, "source": "source/xxxxx", "dataset": "dataset/xxxxx", "model_type": 0, "output": "Free" } How can I get the Confidence value inside the prediction_path ?
favorite count: 0
has title: Accessing values inside a JSON object
tagged with: android
has answer: http://stackoverflow.com/a/20866285
type: AnsweredQuestion
upvote count: 2
has answer: http://stackoverflow.com/a/20866282
downvote count: 3
possible better answer: http://stackoverflow.com/a/20866285
type: Question

http://stackoverflow.com/q/20884018
has answer: http://stackoverflow.com/a/20884252
has comment: http://stackoverflow.com/comment/31340155
tagged with: arrays
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31340369
type: Question
has comment: http://stackoverflow.com/comment/31340277
has title: Filling a two dimensional array with integers java
has comment: http://stackoverflow.com/comment/31340228
has comment: http://stackoverflow.com/comment/31340481
has body: I wanted to write a function which should fill a two dimensional array like this: 1 -- 3 -- 5 -- 7 -- 9 3 -- 5 -- 7 -- 9 -- 11 5 -- 7 -- 9 -- 11 -- 13 7 -- 9 -- 11 -- 13 -- 15 9 -- 11 -- 13 -- 15 -- 17 Here's it what I could come up with ... by all my logic it should work, but obviously I made some mistake: public class Array { public static void TwoDimFill(int[] [] array, int start, int inc){ array[0] [0] = start; for (int i = 0; i &lt; array.length; i++){ for (int j = 0; j &lt; array[i].length; j++){enter code here array[i][j+1] = array[i][j] + inc; } array [i+1][0] = array[0][i+1]; } } public static void main(String[] args){ int[] [] b = new int[5] [5]; TwoDimFill(b, 1, 2); for (int x = 0; x &lt; b.length; x++){ for (int y = 0; y&lt;b[x].length; y++){ TextIO.put(b[x][y]+"\t"); } TextIO.putln(); } } By the way: This TextIO.class is something we use for printing, compareable to system.out ... Edit: Answered! Thank you a lot guys, you're great!
has answer: http://stackoverflow.com/a/20884238
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/20884210
has comment: http://stackoverflow.com/comment/31340323
has answer: http://stackoverflow.com/a/20884661
has comment: http://stackoverflow.com/comment/31340395
has answer: http://stackoverflow.com/a/20884280
answer count: 5
has comment: http://stackoverflow.com/comment/31340268
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31340333

http://stackoverflow.com/comment/31573687
comment on: http://stackoverflow.com/a/21007825
score: 0
type: AnswerComment
type: Comment
has text: @RobertHarvey Yes, but also move it out of the `for` loop, to prevent repeated "could not be found" messages.

http://stackoverflow.com/comment/31591277
type: Comment
has text: yes, you're right. i should have checked against 19 in the first place. i am testing your code right now. Thanks a lot!!
comment on: http://stackoverflow.com/a/21017863
type: AnswerComment
score: 0

http://stackoverflow.com/a/21010058
answers question: http://stackoverflow.com/q/21008102
has body: In your test you will need to create a control statement that keeps that test running as long as you want it to be run. while(myTestNeedsToRun) { if(speedChangeReceived) { sendSpeedChange(); speedChangeReceived = false; } } private void createSpeedDelegate() { EspressoMachineValues.setOnSpeedChangeListener(new EspressoMachineValues.OnSpeedChangeListener() { @Override public void onSpeedChanged(double speed) { //assert speed is correct. assertTrue(getStaticSpeed() == speed); speedChangedReceived = true; } }); Once you decide you are finished running your test just set myTestNeedsToRun = false and then your test will end.
accepted answer of: http://stackoverflow.com/q/21008102
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/31409180
comment on: http://stackoverflow.com/a/20920517
type: Comment
score: 1
has text: _"Have you verified that all the values in `datas[i][j]` are convertible to integer?"_ That would yield to `NumberFormat` exception, not a `NullPointer` one
type: AnswerComment

http://stackoverflow.com/comment/31544789
type: QuestionComment
comment on: http://stackoverflow.com/q/20992659
has text: You are deploying any application? If your deploying any application post the `web.xml` of the application.
score: 0
type: Comment

http://stackoverflow.com/q/20935554
linked to: http://stackoverflow.com/q/20944860
downvote count: 0
score: 1
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/20935657
tagged with: session
tagged with: jsp
tagged with: javascript
tagged with: struts2
has title: Save data between calls to the server in Struts 2
has body: I've an Action class as below: public XyzAction extends ActionSupport{ public String method1(){ // Get the Map by calling a stateless Session bean Map m = remoteInterface.getMap(); } public String method2(){ } } Now an Action is called which maps to method1 and my Map get filled and I use the Map values to fill my drop-down in my JSP. Now in the JSP user clicks a submit button and an Action is called which maps to method2 where some data is retrieved from DB and the same JSP has to display the data in a div and I also need to show the previous drop-down. So how do I save the Map so that I can display even after the second call to the server? Should I store it in a session and retrieve in my JSP like: <s:select name="#session.map" /> or do we have other options?
upvote count: 1
has answer: http://stackoverflow.com/a/20935742
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/31349724
comment on: http://stackoverflow.com/a/20884470
score: 0
type: AnswerComment
has text: When using what you wrote inside another method, say a constructor. I need a semicolon after the last '}', correct? I get an error if I don't.
type: Comment

http://stackoverflow.com/comment/31323797
has text: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/for.html
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20874792

http://stackoverflow.com/a/20935742
has comment: http://stackoverflow.com/comment/31465063
has comment: http://stackoverflow.com/comment/31458781
has comment: http://stackoverflow.com/comment/31440860
has comment: http://stackoverflow.com/comment/31458799
has comment: http://stackoverflow.com/comment/31452168
has comment: http://stackoverflow.com/comment/31458411
score: 0
answers question: http://stackoverflow.com/q/20935554
type: Answer
has body: To get the value from session via OGNL expression "#session.map" you need to change the code, so public String method1(){ // Get the Map by calling a stateless Session bean Map m = remoteInterface.getMap(); Map session = ActionContext.getContext().getSession(); session.put("map", m); return SUCCESS; } In the method2 you have to check if the value is available public String method2(){ Map session = ActionContext.getContext().getSession(); if (session.get("map") == null){ addActionError("map is null"); return ERROR; } return SUCCESS; } If you see the code that gets the session map from the action context is repeating, so why it's better to inject the session map to the action property. It is another, better way to get the session map to your action by implementing SessionAware interface.
has comment: http://stackoverflow.com/comment/31459632
has comment: http://stackoverflow.com/comment/31457023
has comment: http://stackoverflow.com/comment/31444228

http://stackoverflow.com/q/20913118
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/20913315
tagged with: java
has comment: http://stackoverflow.com/comment/31395898
answer count: 3
upvote count: 0
favorite count: 0
has body: i get this " java.lang.StackOverflowError " when i run the code but the problem come when i put a big number like (7,10) this is the code that i write The code for calculate The Ackermann Function public static void main(String[] args) { int m, n, s; Scanner maher = new Scanner(System.in); System.out.println(" the code for calculate The Ackermann Function "); System.out.println(" Enter first number M"); m = maher.nextInt(); System.out.println(" Enter Second number N"); n = maher.nextInt(); System.out.println("A(" + m + " , " + n + ") = " + Ack(m, n) + " \n"); } public static int Ack(int m, int n) { if (m == 0) { return n + 1; } if (m != 0 &amp;&amp; n == 0) { return Ack(m - 1, 1); } if (m != 0 &amp;&amp; n != 0) { return Ack(m - 1, Ack(m, n - 1)); } return 0; // This code written by Maher Al Shammari 212542270 // KFU } I try to change the type to long but the problem doesn't solve ,,,,
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31395941
has title: java.lang.StackOverflowError? in java
has answer: http://stackoverflow.com/a/20913221
score: -1
has answer: http://stackoverflow.com/a/20913136

http://stackoverflow.com/q/20905634
accepted answer: http://stackoverflow.com/a/20905839
favorite count: 0
has comment: http://stackoverflow.com/comment/31381098
has comment: http://stackoverflow.com/comment/31380551
has comment: http://stackoverflow.com/comment/31380587
has comment: http://stackoverflow.com/comment/31380676
has comment: http://stackoverflow.com/comment/31380623
downvote count: 6
has comment: http://stackoverflow.com/comment/31380757
upvote count: 2
has body: I m trying to code up the following figure using hashtag and a bunch of for loops: My code: for(int i = 0 ; i &lt; 10 ; i++){ if( i % 3 == 0 ) System.out.println(); else System.out.print(" # "); for(int j = i + 2 ; j &lt; 10 ; j++){ if( j % 2 == 0 ) System.out.print(" #"); else System.out.println(); } } But i still can't get it right , please give me some hint!
score: -4
has comment: http://stackoverflow.com/comment/31380704
has comment: http://stackoverflow.com/comment/31380699
has answer: http://stackoverflow.com/a/20905839
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 1
has title: hashtag pattern formula in java
has comment: http://stackoverflow.com/comment/31380559

http://stackoverflow.com/comment/31550693
type: QuestionComment
has text: I would guess that you haven't (successfully) decrypted the string. (Try decrypting the BYTES, not the STRING.)
comment on: http://stackoverflow.com/q/20995263
score: 0
type: Comment

http://stackoverflow.com/comment/31576706
type: QuestionComment
has text: Wow - just skimmed that description - very cool. :D
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21009207

http://stackoverflow.com/a/21008155
type: Answer
answers question: http://stackoverflow.com/q/21007518
has comment: http://stackoverflow.com/comment/31650131
has body: dd.findElement(By.xpath("//*[@id='defaultSwatchContainer_wxnit']/div/div/ul/li["+ list.get(0)+"]")).click(); Right now your "list" is a string literal, you're just sending the text "list". You need to instead pull an element from list and add it to the string.
score: 0

http://stackoverflow.com/q/20901210
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/31372943
tagged with: java
type: Question
upvote count: 15
has answer: http://stackoverflow.com/a/20920252
answer count: 2
downvote count: 0
has title: Push Notification in Spring MVC WebApp
score: 15
favorite count: 0
tagged with: cometd
tagged with: push-notification
has body: I am currently writing a forum web-application using Spring MVC. I'm just a beginner at Spring and have only been working with it for about 1 week now. I need to implement push notifications. Here is the scenario: User A logs in and creates a post. User B comments on User A's post while User A is still logged in. User A receives a notification that some user has commented on his post, without his browser refreshing the page. I need help with sending the notification to User A that User B has commented on his post asynchronously. I have done some research, and found that there is a package called CometD that I can use, but I cannot find any simple tutorials for me to understand. Can anyone suggest any other packages/way to solve my problem? Or if you have any simple CometD tutorials, that would be great as well.
has comment: http://stackoverflow.com/comment/39697140
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/20901798

http://stackoverflow.com/comment/31307615
comment on: http://stackoverflow.com/q/20865973
type: Comment
type: QuestionComment
has text: @KeithNicholas I have updated my question with channel option value. They share the same channel, C.
score: 0

http://stackoverflow.com/q/20924321
tagged with: java
has body: Before yesterday, I was using the SVNKit Subversive connector, I believe version 1.7.11. I had some trouble with the SmartBear Collaborator plugin, so I tried to install new connectors, and I set the connector to "Native JavaHL 1.6.15". This resolved my problem with the Collaborator plugin, but this morning when I checked for Eclipse plugin updates, it prompted me for the following updates: JavaHL 1.6.15 Win32 Binaries (Optional) 4.0.0.I20131101-1700 JavaHL 1.7.9 Win32 Binaries (Optional) 4.0.0.I20131101-1700 JavaHL 1.8.4 Win32 Binaries (Optional) 4.0.0.I20131101-1700 Native JavaHL 1.6 Implementation (Optional) 4.0.0.I20131101-1700 Native JavaHL 1.7 Implementation (Optional) 4.0.0.I20131101-1700 Native JavaHL 1.8 Implementation (Optional) 4.0.0.I20131101-1700 Subversive SVN Connectors 4.0.0.I20131101-1700 SVNKit 1.3.8 Implementation (Optional) 4.0.0.I20131101-1700 SVNKit 1.7.11 Implementation (Optional) 4.0.0.I20131101-1700 SVNKit 1.8.0 Implementation (Optional) 4.0.0.I20131101-1700 But it also said: Cannot complete the install because one or more required items could not be found. Software being installed: Native JavaHL 1.8 Implementation (Optional) 4.0.0.I20131101-1700 (org.polarion.eclipse.team.svn.connector.javahl18.feature.group 4.0.0.I20131101-1700) Missing requirement: Native JavaHL 1.8 Implementation (Optional) 4.0.0.I20131101-1700 (org.polarion.eclipse.team.svn.connector.javahl18.feature.group 4.0.0.I20131101-1700) requires 'org.eclipse.team.svn.feature.group [2.0.0.I20131101-1700,3.0.0)' but it could not be found I also noticed that when I look at the "SVN Connector" dropdown in my Subversive preferences, it's currently set to "Native JavaHL 1.6.15", but some of the other choices in the dropdown are interesting ("" is the path to my eclipse distro): Native JavaHL 0x00100000: Cannot load libraries: &lt;pathtoeclipse&gt;\plugins\org.polarion.eclipse.team.svn.connector.javahl17.win32_3.0.2.I20130808-1700\ssleay32.dll: The operating system cannot run %1 Native…
type: Question
tagged with: svn
has answer: http://stackoverflow.com/a/20931070
tagged with: eclipse
tagged with: subversive
score: 0
tagged with: polarion
answer count: 1
type: UnansweredQuestion
has title: eclipse update conflict with polarion subversive connectors

http://stackoverflow.com/q/20961074
has body: I am having a problem importing classes and setting variables and I need help with a test program I am doing. So I am testing out a program that just simply outputs what your input was and puts a time stamp ( Like Skype ). I am having an issue getting the message and time variable type to work! Here is my code: class Test { public static void main(String[] args) { Scanner input = new Scanner(System.in); Message messageObject = new Message (); Time timeObject = new Time (); System.out.println("Enter your message here: "); String message = input.nextLine(); messageObject.simpleMessage(message); timeObject.getTime(); } void simpleMessage(String message) { System.out.println(message + time); } } And here is my error: Exception in thread "main" java.lang.Error: Unresolved compilation problems: Message cannot be resolved to a type Message cannot be resolved to a type The constructor Time() is undefined at Test.main(Test.java:8)
has answer: http://stackoverflow.com/a/55661961
favorite count: 0
has answer: http://stackoverflow.com/a/20961296
tagged with: time
accepted answer: http://stackoverflow.com/a/20961296
has title: Exception in thread "main" java.lang.Error: Unresolved compilation problems
score: 2
type: AnsweredQuestion
upvote count: 14
has comment: http://stackoverflow.com/comment/31487026
has answer: http://stackoverflow.com/a/46972951
tagged with: java
has comment: http://stackoverflow.com/comment/31487160
has answer: http://stackoverflow.com/a/53984490
tagged with: import
type: Question
tagged with: testing
tagged with: message
downvote count: 12
possible better answer: http://stackoverflow.com/a/54215197
answer count: 6
has comment: http://stackoverflow.com/comment/31487030
has answer: http://stackoverflow.com/a/54215197
has comment: http://stackoverflow.com/comment/31487200
has comment: http://stackoverflow.com/comment/31487191
has answer: http://stackoverflow.com/a/68018562

http://stackoverflow.com/q/20938318
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20938348
has body: I have written sorting methods for an array of comparables, insertion, merge, and selection, I've done this by altering code I had before from sorting an int array, and I just changed things from int to Comparable. However, When I was doing it for int arrays, I knew very well how to actually use the method, for example this is my my selection sort for ints: public void selectionSort(int[] list){ for (int i=0;i&lt;list.length;i++){ for (int si=i;si&lt;list.length;si++){ if (list[si]&lt;list[i]){ int temp=list[i]; list[i]=list[si]; list[si]=temp; } } } } and this is the code which ends up using this method: public static void main(String[] args) { Scanner in=new Scanner(System.in); int numItems,searchNum,location; Sorts sort=new Sorts(); int[]test; System.out.print("Enter the number of elements: "); numItems=in.nextInt(); test=new int[numItems]; for (int i=0;i&lt;test.length;i++){ test[i]=(int)(100*Math.random()); } System.out.println("Unsorted: "); displayArray(test); sort.selectionSort(test); System.out.println("Sorted: "); displayArray(test); and everything works fine, but for my comparable selection sort, I have this code: public static void selectionSort(Comparable[] list){ for (int i=0;i&lt;list.length;i++){ for (int si=i;si&lt;list.length;si++){ if (list[si].compareTo(list[i])&lt;0){ Comparable temp=list[i]; list[i]=list[si]; list[si]=temp; } } } } but when I get to writing the code to test out this method, I just have no idea how to approach it, I don't know how I can make an array of Comparable interfaces, the concept is just so confusing for me and I can't find a way to make it work.
favorite count: 0
type: Question
tagged with: interface
has title: Sorting an array of comparable interface
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31444018
upvote count: 1
has answer: http://stackoverflow.com/a/20938348
answer count: 1
downvote count: 1
tagged with: arrays
tagged with: sorting
tagged with: comparable
has comment: http://stackoverflow.com/comment/31443613

http://stackoverflow.com/q/20992567
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31544844
has comment: http://stackoverflow.com/comment/31544796
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31546080
upvote count: 1
has comment: http://stackoverflow.com/comment/31544585
has title: Selenium Webdriver & findelement
has answer: http://stackoverflow.com/a/20993100
tagged with: http://stackoverflow.com/tag/html
favorite count: 0
has comment: http://stackoverflow.com/comment/31544681
type: UnansweredQuestion
tagged with: selenium
has body: I want to find a element, xpath is like this "//div[@id='contentPane']/div/div[2]/div/div[2]/div[2]/div/div/div[2]/div/div/div/div/div/div/div[3]/div/div" and then do "clickAt" If I use driver.findElement(By.xpath("//div[@id='contentPane']/div/div[2]/div/div[2]/div[2]/div/div/div[2]/div/div/div/div/div/div/div[3]/div/div"); Actions clicker = new Actions(driver); clicker.moveToElement(baseElement).moveByOffset(0, 0).click().perform(); I receive Exception "Element not found". What I'm doing wrong?
has answer: http://stackoverflow.com/a/46721279
downvote count: 0

http://stackoverflow.com/q/20899351
has comment: http://stackoverflow.com/comment/31369210
accepted answer: http://stackoverflow.com/a/20899394
has comment: http://stackoverflow.com/comment/31368944
tagged with: java
has comment: http://stackoverflow.com/comment/31368936
has comment: http://stackoverflow.com/comment/31368865
score: 5
linked to: http://stackoverflow.com/q/235785
answer count: 1
has comment: http://stackoverflow.com/comment/31369308
has title: Could md5 algrithom generate the same string with the original string?
favorite count: 0
duplicate of: http://stackoverflow.com/q/235785
has comment: http://stackoverflow.com/comment/31369267
has answer: http://stackoverflow.com/a/20899394
has body: I found this on github occasionally. md5(text).equals(text) Could this happen in common use?
upvote count: 6
tagged with: md5
downvote count: 1
type: Question
type: AnsweredQuestion

http://stackoverflow.com/a/20927499
downvote count: 0
type: Answer
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/20922958
has body: This looks like a bad WAR file to me (the embedded tomcat jars shoudln't be in WEB-INF/lib at all). All you should need is to mark the tomcat embedded jars as scope=provided in the build configuration. The GS guide for converting JAR to WAR is a good reference for standard configuration options, and there are several samples in the Spring Boot codebase. If your app is not using the web socket features of tomcat it should still work with older versions (so please feel free to raise an issue in github). The easiest fix for you is to simply upgrade tomcat (7.0.47 should work).
accepted answer of: http://stackoverflow.com/q/20922958
type: AcceptedAnswer

http://stackoverflow.com/comment/31471355
score: 3
comment on: http://stackoverflow.com/q/20953284
type: Comment
type: QuestionComment
has text: Ask them to create a webservice and you call it.

http://stackoverflow.com/a/20980315
score: 0
has comment: http://stackoverflow.com/comment/31523575
has comment: http://stackoverflow.com/comment/31524974
type: Answer
answers question: http://stackoverflow.com/q/20978703
has body: Make sure that the following two changes are done: The minimum API should be at least 11 in the Android manifest file The correct API should be linked to your project, as @laalto demonstrated hour You should have something like this in your Manifest file: &lt;uses-sdk android:minSdkVersion="11" android:targetSdkVersion="19"/&gt; You should always target the latest API, and have the latest API linked to the project, and set the minimum as I have included to whatever your true minimum is. If you do this, you can selectively use new features in the API if available.

http://stackoverflow.com/comment/31452620
type: Comment
has text: What is on line 131 of SocketActivity?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/20942664

http://stackoverflow.com/comment/31585511
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20991069
has text: I'm using version 2.16

http://stackoverflow.com/q/20952739
downvote count: 1
has answer: http://stackoverflow.com/a/20952946
favorite count: 0
has title: How would you convert a string to a 64 bit integer?
answer count: 3
upvote count: 4
linked to: http://stackoverflow.com/q/5688042
has answer: http://stackoverflow.com/a/20952969
has body: I am making an application that involves a seed to generate a world and some games let you provide that seed with text. I'm wondering how would you 'convert' a string to an integer. A simple way would be to use the ASCII values of all the characters and append them to a string which you would then parse to an integer, but that severely limits the size of the string. How would you be able to do this with a larger string? EDIT: 64 bit not 32
possible better answer: http://stackoverflow.com/a/20952946
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/31470341
tagged with: java
has comment: http://stackoverflow.com/comment/31472030
tagged with: seed
has answer: http://stackoverflow.com/a/20952755
accepted answer: http://stackoverflow.com/a/20952755
type: Question

http://stackoverflow.com/comment/31516372
comment on: http://stackoverflow.com/q/20977039
has text: You can escape the `%` with a `%25`. That would mean it would look like `%2520`...but I don't think that that is what you want. What you are describing is standard browser behavior.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20981195
has title: UTF8 - CharsetEncoder#encode() - Infinite Loop
type: UnansweredQuestion
tagged with: playframework-2.2
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
has body: We have a Play 2.2.1 application that's using the plugin jongo to managed MongoDB access and object mapping. This plugin uses a library called bson4jackson to adds support for BSON to the Jackson JSON processor. We can handle hundreds MB of UTF8 data but randomly, we have a thread that never ends and takes 100% of one thread of the CPU. With the same set of data, the error can occur or not. Here is the call stack of the thread : application-akka.actor.default-dispatcher-12 [RUNNABLE] de.undercouch.bson4jackson.io.DynamicOutputBuffer.putUTF8(int, String) de.undercouch.bson4jackson.io.DynamicOutputBuffer.putUTF8(String) de.undercouch.bson4jackson.BsonGenerator._writeCString(String) de.undercouch.bson4jackson.BsonGenerator._writeString(String) de.undercouch.bson4jackson.BsonGenerator.writeString(String) com.fasterxml.jackson.databind.ObjectWriter.writeValue(OutputStream, Object) org.jongo.marshall.jackson.JacksonEngine.marshall(Object) org.jongo.Insert.marshallDocument(Object) org.jongo.Insert.createDBObjectToInsert(Object) org.jongo.Insert.save(Object) org.jongo.MongoCollection.save(Object) models.audits.PageEntityCollection.save(PageEntity) services.audit.PageBean.finish() services.audit.PageBean.auditChangeState(AuditState) services.audit.dispatcher.SchedulerAPI.schedule(PageBean) services.audit.dispatcher.PageAuditManager.startAudit(String, String, String, String, String) controllers.HARReceiver.launchAudit(JsonNode, String) controllers.HARReceiver$1.run() akka.dispatch.TaskInvocation.run() akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec() scala.concurrent.forkjoin.ForkJoinTask.doExec() scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinTask) scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool$WorkQueue) scala.concurrent.forkjoin.ForkJoinWorkerThread.run() The code of the method is the following : Link to the class public int putUTF8(int pos, String s) { ByteBuffer minibb = null; CharsetEncoder enc = getUTF8Encoder(); CharBu…
has comment: http://stackoverflow.com/comment/31607123
tagged with: character-encoding
downvote count: 0
tagged with: jongo
favorite count: 0

http://stackoverflow.com/comment/31366837
comment on: http://stackoverflow.com/q/20896386
score: 0
type: Comment
type: QuestionComment
has text: Each connection have separate column name and no of columns.so it will be ambiguous to represent it in one table.

swt
tags question: http://stackoverflow.com/q/20956538
tags question: http://stackoverflow.com/q/20892135
tags question: http://stackoverflow.com/q/20968958
tags question: http://stackoverflow.com/q/20957507
tags question: http://stackoverflow.com/q/20998673
tags question: http://stackoverflow.com/q/20905989
tags question: http://stackoverflow.com/q/20917832
tags question: http://stackoverflow.com/q/20934138
tags question: http://stackoverflow.com/q/20883923
type: Tag
tags question: http://stackoverflow.com/q/20969953
tags question: http://stackoverflow.com/q/20975980
tags question: http://stackoverflow.com/q/20983000
tags question: http://stackoverflow.com/q/20896733
tag name: swt
tags question: http://stackoverflow.com/q/20935854
tags question: http://stackoverflow.com/q/20940252
tags question: http://stackoverflow.com/q/20885743

http://stackoverflow.com/a/21003210
accepted answer of: http://stackoverflow.com/q/21002944
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31564834
has comment: http://stackoverflow.com/comment/31566595
has body: A model is representation-agnostic. It can be rendered, from different points of view using different types of views or diagrams, e.g. the same set of classes can be seen from the static point of view of a class diagram, or from the point of view of their dynamic mutual interaction in a communication diagram. So, the model is the same, but how we view it is different depending on the information we want to convey. Think of the model as the data that you would put on a spreadsheet and the diagrams as the different types of charts that you can use to view and interpret that data, for instance, a pie chart or bar chart. It is the same data, but every chart would convey different aspects of the information that can be useful to make decisions. Similarly, every type of UML diagram conveys different aspects of the design of a system, but they all share a common model that you would probably reuse to create every type of diagram. Most UML CASE tools let you interact with such model. For instance, in most of these tools if you define a class in a class diagram, it is automatically added to the model and, later, while defining a communication diagram that uses an object of that class you can simply drag it from the model and drop it in your communication diagram, by this, conveying the idea that you are using an object from a class already in the model. Further information: Diagram vs Model UML Model vs UML Diagram
answers question: http://stackoverflow.com/q/21002944
has comment: http://stackoverflow.com/comment/31566697
upvote count: 9
has comment: http://stackoverflow.com/comment/31570932
score: 9

http://stackoverflow.com/a/20971068
answers question: http://stackoverflow.com/q/20970980
has comment: http://stackoverflow.com/comment/31504797
score: 1
upvote count: 1
downvote count: 0
has body: To make the class that extended your class (made abstract) to provide a specific type of implementation. For example: abstract ClassA ClassB extends ClassB - Provides a specific implementation of abstract methods defined in ClassA
type: Answer

http://stackoverflow.com/comment/31592222
comment on: http://stackoverflow.com/a/21018191
type: AnswerComment
score: 0
type: Comment
has text: Does invoking Undecorated(true); remove the title bar and border? What are the other frame properties that come under decoration of frame?

http://stackoverflow.com/a/38181611
type: Answer
has body: You can't disable the popups (alert), just do alert.accept() means clicking the ok button of alert modal or alert.dismiss() means clicking the cancel or close button. The worst in this case is that you need to wait a certain time if you are not very sure that alert is going to be present or not. If the alert is present as a result of event sucess( just like clicing the button, webpage asks for your confirmation ) you dont need to do wait wait.until(ExpectedConditions.alertIsPresent()); you can save the time by going to next step which is switching the drver to alert. i.e Alert alert = driver.switchTo().alert(); if ( alert.getText().contains("Are you sure you want to leave this page?")) { alert.accept(); } else if ( alert.getText().contains("Some other text which means you need to dismiss")) { alert.dismiss(); } else { //something else } } just to be sure you can use a small waiting time, but yes it depends uponthe network speed to load the web page for the case that alert is present when webpage is loaded.
has comment: http://stackoverflow.com/comment/63789524
answers question: http://stackoverflow.com/q/20974729
score: 0

http://stackoverflow.com/comment/31519949
comment on: http://stackoverflow.com/a/20970837
has text: Okay, sorry i contacted the author of bindings and he managed to fix the issue. ;)
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/31521325
comment on: http://stackoverflow.com/q/20979514
type: Comment
score: 1
has text: [Swing tutorial](http://docs.oracle.com/javase/tutorial/uiswing/)
type: QuestionComment

http://stackoverflow.com/a/20901798
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20901210
upvote count: 5
has body: Have a look at the spring MVC chat sample app for spring MVC 3.2, there is also a spring blog post about it.
score: 5

http://stackoverflow.com/a/20877987
has comment: http://stackoverflow.com/comment/31342865
answers question: http://stackoverflow.com/q/20877894
has body: Because you specify the grid coordinates of a component through GridBagContraints when adding the component. The GridBagLayout’s size is then determined automatically by the largest coordinates (and probably the grid width and grid height of the component at these coordinates).
upvote count: 4
downvote count: 0
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/31332171

http://stackoverflow.com/comment/31299620
type: AnswerComment
comment on: http://stackoverflow.com/a/20861564
type: Comment
has text: Oh, also note: For 'jar in a jar' to work requires a custom class-loader, which in turn requires a trusted applet. It *really* complicates matters.
score: 0

http://stackoverflow.com/comment/31369394
type: QuestionComment
comment on: http://stackoverflow.com/q/20896124
has text: Seems like LogFactory might require a class from a jar not on your classpath, or is not in the jars you've listed. Possibly a duplicate of http://stackoverflow.com/questions/7955442/java-lang-noclassdeffounderror-org-apache-juli-logging-logfactory?rq=1
score: 0
type: Comment

http://stackoverflow.com/comment/31452786
type: Comment
has text: I removed it and it still doesn't accept or send the messages. Do you think maybe I also should not close the socket on the Client code?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/20942821

http://stackoverflow.com/q/20974420
score: 0
tagged with: java
tagged with: vaadin
answer count: 1
type: UnansweredQuestion
has body: NOTE: This issue may or may not be Vaadin related, depending on wether there is a "better" solution to "resetting" the bean or not. Background scenario I am building a wizard for entering some values that, when finished, is sent to a table (using Vaadin and the add-on "Wizards for Vaadin"). The add-on does not provide a way to reset the Wizard (i.e. go back to step 1) without a forced call to the current steps (overridden) onAdvance() and onBack() methods, which will return false in some of my steps because I'm using logic in those methods in case the use for example haven't filled in all required data. I cannot simple create a new instance of the Wizard, because I'm using Spring to manage this @Component. So, this leaves me with actually resetting the bean in order to reset the wizard correctly. My question is How do I "reset" a Spring managed Bean (@Component)? I should add that this Bean also has some dependencies injected to it. or... (for the Vaadin people): Is there another way of resetting this wizard other than creating a new Wizard? Some code @Component @Scope("session") public class MyWizard extends Wizard { @Inject private MyWizardContainer myWizardContainer; @Inject private MyService myService; @Inject private MyWizardStep1 myWizardStep1; @Inject private MyWizardStep2 myWizardStep2; @Inject private MyWizardStep3 myWizardStep3; @Inject private MyMainTableContainer myMainTableContainer; final static Logger logger = LoggerFactory.getLogger(MyWizard.class); private static final long serialVersionUID = 1L; public MyWizard() { setupListener(); } public void addSteps() { this.addStep(myWizardStep1); this.addStep(myWizardStep2); this.addStep(myWizardStep3); this.mainLayout.setComponentAlignment(this.footer, Alignment.BOTTOM_LEFT); } private void setupListener() { this.addListener(new WizardProgressListener() { @Override public void wizardCompleted(WizardCompletedEvent event) { endWizard("Wizard Finished Successfully!"); } @Override public void wizardCancelled(Wi…
has answer: http://stackoverflow.com/a/20982412
type: Question
tagged with: vaadin7
tagged with: spring
has title: How to reset a Spring managed Bean

http://stackoverflow.com/a/25771884
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/20910451
downvote count: 0
has body: If you're not using Gradle then below is how I got it to work: Download the zip from the stripe GitHub (stripe-android-master) Import JUST the stripe folder as a module into your project. You shouldn't have to do anything fancy here. It added to my project as "main". Go into Project Structure -> modules and add "main" as a module dependency to your working module Click on the "main" (stripe) module and click the "Export" checkbox on the lib so that your working module has access to it ???? Profit

http://stackoverflow.com/comment/31285988
score: 2
has text: See also [*The Glass Pane*](http://docs.oracle.com/javase/tutorial/uiswing/components/rootpane.html#glasspane).
comment on: http://stackoverflow.com/q/20855058
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20858159
answer count: 1
has answer: http://stackoverflow.com/a/20858255
tagged with: android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20858255
has body: I am trying to use the code from here http://www.ibm.com/developerworks/webservices/library/ws-android/index.html?ca=dat- to call a web service. I keep getting the exception thrown at the following line of my code…. androidHttpTransport.call(SOAP_ACTION, envelope); The class I've written looks as follows; import org.ksoap2.SoapEnvelope; import org.ksoap2.serialization.PropertyInfo; import org.ksoap2.serialization.SoapObject; import org.ksoap2.serialization.SoapPrimitive; import org.ksoap2.serialization.SoapSerializationEnvelope; import org.ksoap2.transport.HttpTransportSE; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.EditText; public class MainActivity extends Activity { private EditText editext1; private EditText editext2; private EditText editext3; private EditText editext4; private Button btn1; private static final String NAMESPACE = "http://service.hotornot.com/"; private static String URL = "http://hotornot-hnwebservice.rhcloud.com/TomcatHotOrNot/messages?wsdl"; private static final String METHOD_NAME = "addMessage"; private static final String SOAP_ACTION = "http://service.hotornot.com/addMessage"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); editext1 = (EditText) findViewById(R.id.editText1); editext2 = (EditText) findViewById(R.id.editText2); editext3 = (EditText) findViewById(R.id.editText3); editext4 = (EditText) findViewById(R.id.editText4); btn1 = (Button) findViewById(R.id.button1); btn1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); PropertyInfo propInfo = new PropertyInfo(); propInfo.name = "arg0"; propInfo.type = PropertyInfo.STRING_CLASS; request.addProperty(propInfo, editext1.getText().toString()); PropertyInfo propInfo1 = new PropertyInfo(); propInfo.name = "arg…
tagged with: java
tagged with: web-services
has title: Calling a web service from android - NullPointerException
type: Question
score: 0

jpa
tags question: http://stackoverflow.com/q/20884350
tags question: http://stackoverflow.com/q/20980759
tags question: http://stackoverflow.com/q/20873359
tags question: http://stackoverflow.com/q/21013188
tags question: http://stackoverflow.com/q/20865686
tags question: http://stackoverflow.com/q/20856058
tags question: http://stackoverflow.com/q/20990889
tags question: http://stackoverflow.com/q/20885149
tags question: http://stackoverflow.com/q/20903900
tags question: http://stackoverflow.com/q/20981160
tags question: http://stackoverflow.com/q/20946090
tags question: http://stackoverflow.com/q/20993262
tags question: http://stackoverflow.com/q/20949180
tags question: http://stackoverflow.com/q/20940814
tags question: http://stackoverflow.com/q/21012231
tags question: http://stackoverflow.com/q/21007609
tags question: http://stackoverflow.com/q/20856067
tags question: http://stackoverflow.com/q/20978662
tags question: http://stackoverflow.com/q/20907923
type: Tag
tags question: http://stackoverflow.com/q/20973961
tags question: http://stackoverflow.com/q/20972426
tags question: http://stackoverflow.com/q/21000237
tags question: http://stackoverflow.com/q/20935413
tags question: http://stackoverflow.com/q/20978739
tags question: http://stackoverflow.com/q/20907912
tags question: http://stackoverflow.com/q/20869112
tags question: http://stackoverflow.com/q/20899603
tags question: http://stackoverflow.com/q/20988992
tags question: http://stackoverflow.com/q/20940370
tags question: http://stackoverflow.com/q/20968173
tags question: http://stackoverflow.com/q/20985481
tags question: http://stackoverflow.com/q/20927020
tags question: http://stackoverflow.com/q/20939068
tags question: http://stackoverflow.com/q/20993870
tags question: http://stackoverflow.com/q/20900819
tags question: http://stackoverflow.com/q/21001657
tags question: http://stackoverflow.com/q/20884418
tags question: http://stackoverflow.com/q/20992007
tags question: http://stackoverflow.com/q/21005794
tags question: http://stackoverflow.com/q/20972328
tags question: http://stackoverflow.com/q/20951338
tags question: http://stackoverflow.com/q/20905870
tags question: http://stackoverflow.com/q/20907206
tags question: http://stackoverflow.com/q/20881667
tag name: jpa
tags question: http://stackoverflow.com/q/20989405
tags question: http://stackoverflow.com/q/20882501
tags question: http://stackoverflow.com/q/20849929
tags question: http://stackoverflow.com/q/20957463
tags question: http://stackoverflow.com/q/20929979
tags question: http://stackoverflow.com/q/20918634
tags question: http://stackoverflow.com/q/20935977
tags question: http://stackoverflow.com/q/20850258
tags question: http://stackoverflow.com/q/20911763
tags question: http://stackoverflow.com/q/20981862
tags question: http://stackoverflow.com/q/20868851
tags question: http://stackoverflow.com/q/20856833
tags question: http://stackoverflow.com/q/20878702
tags question: http://stackoverflow.com/q/20898060
tags question: http://stackoverflow.com/q/20945447
tags question: http://stackoverflow.com/q/20901282

http://stackoverflow.com/comment/31526894
type: Comment
score: 0
comment on: http://stackoverflow.com/q/20982449
has text: Upvoted: Useful question, demonstrated effort, sufficient and not overly abundant information. Good!
type: QuestionComment

http://stackoverflow.com/comment/31559754
score: 0
type: QuestionComment
type: Comment
has text: @KevinWorkman just googled it and i think this may work! thanks =)
comment on: http://stackoverflow.com/q/21000580

http://stackoverflow.com/a/20862608
type: Answer
answers question: http://stackoverflow.com/q/20862515
has body: You can have a HashMap with key as (Questions,Answers..) and ArrayList as value HashMap &lt;String,ArrayList&lt;String&gt;&gt; array = new HashMap&lt;String,ArrayList&lt;String&gt;&gt;(); if(array.containsKey("Question")){ array.get("Question").add(sCurrentLine.split(":")[1]); }else{ ArrayList&lt;String&gt; questions = new ArrayList&lt;String&gt;(); questions.add(sCurrentLine.split(":")[1]); array.put("Question",questions ); } Modification In your Code public static void OpenFile() { HashMap &lt;String,ArrayList&lt;String&gt;&gt; array = new HashMap&lt;String,ArrayList&lt;String&gt;&gt;(); int retrival = chooser.showOpenDialog(null); if (retrival == JFileChooser.APPROVE_OPTION) { try (BufferedReader br = new BufferedReader(new FileReader( chooser.getSelectedFile()))) { String sCurrentLine; while ((sCurrentLine = br.readLine()) != null) { if (sCurrentLine.equals("")) { continue; } else if (sCurrentLine.startsWith("Question")) { System.out.println(sCurrentLine.split(":")[1]); if(array.containsKey("Question")){ array.get("Question").add(sCurrentLine.split(":")[1]); }else{ ArrayList&lt;String&gt; questions = new ArrayList&lt;String&gt;(); questions.add(sCurrentLine.split(":")[1]); array.put("Question",questions ); } //add to [0] in array ArrayList } else if (sCurrentLine.startsWith("Answer")) { System.out.println(sCurrentLine.split(":")[1]); //add to [1] in array ArrayList //Do the same as above if condition with Answer as Key } else if (sCurrentLine.startsWith("Category")) { System.out.println(sCurrentLine.split(":")[1]); //add to [2] in array ArrayList } else if (sCurrentLine.startsWith("Essay")) { System.out.println(sCurrentLine.split(":")[1]); //add to [3] in array ArrayList } } } catch (Exception ex) { ex.printStackTrace(); } } }
score: 0

http://stackoverflow.com/q/20863286
tagged with: spring-mvc
has title: How to use PreAuthorize with async Spring MVC controller
score: 1
tagged with: java
upvote count: 1
has body: I have a Spring MVC service which lets me upload a file. It uses @PreAuthorize from Spring Security to handle access controls on resources. The controller uses Servlet 3 async servlets by use of a Callable. @PreAuthorize("...") @RequestMapping(value = "upload", method = RequestMethod.PUT) public Callable&lt;ResponseEntity&gt; upload(final InputStream inputStream) { return new Callable&lt;ResponseEntity&gt;() { @Override public ResponseEntity call() throws Exception { ... } }; } Somewhere in the service - outside of my code - an exception is being thrown. An Authentication object was not found in the SecurityContext The exception appears to be thrown by the cglib generated code for my Spring controller. Here is bulk of the stack trace. org.springframework.security.authentication.AuthenticationCredentialsNotFoundException: An Authentication object was not found in the SecurityContext at org.springframework.security.access.intercept.AbstractSecurityInterceptor.credentialsNotFound(AbstractSecurityInterceptor.java:339) ~[spring-security-core-3.2.0.RELEASE.jar:3.2.0.RELEASE] at org.springframework.security.access.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:198) ~[spring-security-core-3.2.0.RELEASE.jar:3.2.0.RELEASE] at org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:60) ~[spring-security-core-3.2.0.RELEASE.jar:3.2.0.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) ~[spring-aop-3.2.4.RELEASE.jar:3.2.4.RELEASE] at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631) ~[spring-aop-3.2.4.RELEASE.jar:3.2.4.RELEASE] at com.testing.upload.controller.RESTService$$EnhancerByCGLIB$$66a0c4c9.upload(&lt;generated&gt;) ~[spring-core-3.2.4.RELEASE.jar:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_65] at sun.reflect.Na…
type: Question
linked to: http://stackoverflow.com/q/5246428
tagged with: servlet-3.0
has answer: http://stackoverflow.com/a/20866960
answer count: 1
downvote count: 0
tagged with: spring-security
favorite count: 0
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/comment/31414531
type: QuestionComment
has text: Ohh, just a regular program?
score: 0
comment on: http://stackoverflow.com/q/20913509
type: Comment

http://stackoverflow.com/a/20947532
accepted answer of: http://stackoverflow.com/q/20947130
type: AcceptedAnswer
score: 7
upvote count: 8
type: Answer
downvote count: 1
has body: Use doseq instead of the lazy for. It has for-like bindings but it's meant for side-effects. (defn make-an-array-list2 [] (let [alist (java.util.ArrayList.)] (doseq [n (range 6)] (.add alist n)) alist)) ;; [0 1 2 3 4 5]
answers question: http://stackoverflow.com/q/20947130

http://stackoverflow.com/comment/31510115
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20973778
has text: realObject has the reference now, thats fine, how do i assign this back to my calling place?
type: AnswerComment

http://stackoverflow.com/comment/31546014
type: Comment
score: 1
comment on: http://stackoverflow.com/a/20993082
has text: same result, it's not working. even `SUM((java.lang.Number)1)` result in a _The method SUM(Number) is undefined for.._ message
type: AnswerComment

http://stackoverflow.com/comment/31469558
type: Comment
has text: Same problem with SLF4J. But in this case the application outputs the following message `SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".` Anyway, the correct way to load a different logger (even if the logger doesn't print anything) seems to be `mvn vertx:runMod -Drg.vertx.logger-delegate-factory-class-name=xxx`. By using `MAVEN_OPTS` the app throws an exception.
type: AnswerComment
comment on: http://stackoverflow.com/a/20931543
score: 0

sql
tags question: http://stackoverflow.com/q/20892271
tags question: http://stackoverflow.com/q/21007416
tags question: http://stackoverflow.com/q/20876291
tags question: http://stackoverflow.com/q/20947715
tags question: http://stackoverflow.com/q/20881646
tags question: http://stackoverflow.com/q/20889249
tags question: http://stackoverflow.com/q/20903972
tags question: http://stackoverflow.com/q/20946090
tags question: http://stackoverflow.com/q/20958306
tags question: http://stackoverflow.com/q/20855104
tags question: http://stackoverflow.com/q/20915678
tags question: http://stackoverflow.com/q/20974316
tags question: http://stackoverflow.com/q/20979585
tags question: http://stackoverflow.com/q/20930013
tags question: http://stackoverflow.com/q/20881540
tags question: http://stackoverflow.com/q/20999211
tags question: http://stackoverflow.com/q/20986202
tags question: http://stackoverflow.com/q/20853630
tags question: http://stackoverflow.com/q/20989015
tags question: http://stackoverflow.com/q/20913337
tags question: http://stackoverflow.com/q/20877951
tags question: http://stackoverflow.com/q/21002434
tags question: http://stackoverflow.com/q/20920025
tags question: http://stackoverflow.com/q/20894073
tag name: sql
tags question: http://stackoverflow.com/q/21005407
type: Tag
tags question: http://stackoverflow.com/q/20930996
tags question: http://stackoverflow.com/q/20935413
tags question: http://stackoverflow.com/q/20883527
tags question: http://stackoverflow.com/q/20882264
tags question: http://stackoverflow.com/q/20877245
tags question: http://stackoverflow.com/q/20899603
tags question: http://stackoverflow.com/q/20899977
tags question: http://stackoverflow.com/q/20949794
tags question: http://stackoverflow.com/q/20873104
tags question: http://stackoverflow.com/q/20878854
tags question: http://stackoverflow.com/q/20997695
tags question: http://stackoverflow.com/q/20975945
tags question: http://stackoverflow.com/q/20927020
tags question: http://stackoverflow.com/q/20956124
tags question: http://stackoverflow.com/q/20922966
tags question: http://stackoverflow.com/q/20947696
tags question: http://stackoverflow.com/q/20883852
tags question: http://stackoverflow.com/q/20901516
tags question: http://stackoverflow.com/q/20889170
tags question: http://stackoverflow.com/q/20881667
tags question: http://stackoverflow.com/q/20949144
tags question: http://stackoverflow.com/q/21016235
tags question: http://stackoverflow.com/q/20916479
tags question: http://stackoverflow.com/q/21003087
tags question: http://stackoverflow.com/q/21017171
tags question: http://stackoverflow.com/q/20993845
tags question: http://stackoverflow.com/q/21014838
tags question: http://stackoverflow.com/q/21018395
tags question: http://stackoverflow.com/q/20916063
tags question: http://stackoverflow.com/q/20943047
tags question: http://stackoverflow.com/q/20862508
tags question: http://stackoverflow.com/q/20894009
tags question: http://stackoverflow.com/q/20968797
tags question: http://stackoverflow.com/q/20903589
tags question: http://stackoverflow.com/q/20945019
tags question: http://stackoverflow.com/q/20971345
tags question: http://stackoverflow.com/q/20948400
tags question: http://stackoverflow.com/q/20906942
tags question: http://stackoverflow.com/q/20971447
tags question: http://stackoverflow.com/q/20948536
tags question: http://stackoverflow.com/q/20896237

http://stackoverflow.com/comment/31365731
comment on: http://stackoverflow.com/a/20897286
score: 0
type: AnswerComment
type: Comment
has text: @smriti3 you can use a SimpleAdapter also check my eidt

http://stackoverflow.com/q/20924354
has title: converting integer from 2 bytes
type: Question
answer count: 1
tagged with: arrays
tagged with: integer
has comment: http://stackoverflow.com/comment/31416652
has body: First of all I have a couple hours experience with java, so if its a bit easy question sorry about that. Now, I have a byte array with size 2 And I want to get corresponding integer value from it. I use little endian notation. Here is my code: public static int convertInt(byte[] twoByte){ //TODO } Is there anyone to help me ?
score: 0
has answer: http://stackoverflow.com/a/20924457
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20924457
tagged with: java

sprite
tags question: http://stackoverflow.com/q/20927189
tags question: http://stackoverflow.com/q/20925202
tags question: http://stackoverflow.com/q/20867279
type: Tag
tags question: http://stackoverflow.com/q/20867772
tags question: http://stackoverflow.com/q/20888125
tags question: http://stackoverflow.com/q/20922525
tags question: http://stackoverflow.com/q/20960331
tags question: http://stackoverflow.com/q/20986826
tags question: http://stackoverflow.com/q/20959456
tag name: sprite

http://stackoverflow.com/q/20894106
accepted answer: http://stackoverflow.com/a/20894273
tagged with: gwt-editors
tagged with: gwt
type: AnsweredQuestion
tagged with: java
has title: GWT Editor Client Side Validation?
has answer: http://stackoverflow.com/a/20894273
type: Question
tagged with: validation
answer count: 1
score: 0
has body: Using the Editor framework I found that you have to do client side validation yourself. Here is a question that deals with this topic. Do I really have to write all this code when I want to integrate the client side validation with the editor framework? Person newPerson = editorDriver.flush(); Validator validator = Validation.buildDefaultValidatorFactory().getValidator(); Set&lt;ConstraintViolation&lt;Person&gt;&gt; violations = validator.validate(newPerson, Default.class); @SuppressWarnings({ "rawtypes", "unchecked" }) Iterable&lt;ConstraintViolation&lt;?&gt;&gt; tmpViolations = (Iterable&lt;ConstraintViolation&lt;?&gt;&gt;) (Set) violations; if (!violations.isEmpty()) { editorDriver.setConstraintViolations(tmpViolations); }
tagged with: http://stackoverflow.com/tag/html
linked to: http://stackoverflow.com/q/5978473

http://stackoverflow.com/comment/31473921
type: Comment
has text: There is no need to modify a string if he only needs to look up the last number. If the format is constant just do: Too much code. Just use s.substring(c.lastIndexOf(" "), s.length())
score: 1
comment on: http://stackoverflow.com/a/20954442
type: AnswerComment

http://stackoverflow.com/comment/31296389
type: Comment
type: QuestionComment
has text: @MJM I don't think there's gonna be a super-relevant library to do this stuff for you. Take the advice in answers below and contain this complexity its its own Class(s). With some effort, I'm sure you could refactor Elliotts answer to be quite readable and elegant.
comment on: http://stackoverflow.com/q/20859712
score: 0

http://stackoverflow.com/comment/31388131
type: Comment
comment on: http://stackoverflow.com/a/20905765
has text: then you can mark the answer as accepted if you think its sufficient or you can +1 if it only helped
type: AnswerComment
score: 0

http://stackoverflow.com/a/29762625
has body: public enum Category { CATEGORY_1(null), CATEGORY_1_1(CATEGORY_1), CATEGORY_1_2(CATEGORY_1), CATEGORY_2(null), CATEGORY_2_1(CATEGORY_2), CATEGORY_2_1_1(CATEGORY_2_1), CATEGORY_2_1_2(CATEGORY_2_1); private final Category parent; private final List&lt;Category&gt; children = new ArrayList&lt;&gt;(); private final List&lt;Category&gt; roChildren = Collections.unmodifiableList(children); private Category(Category parent) { this.parent = parent; if (parent != null) { parent.children.add(this); } } public Category getParent() { return parent; } public List&lt;Category&gt; getChildren() { return roChildren; } }
answers question: http://stackoverflow.com/q/20999455
score: 4
upvote count: 4
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/47657116

http://stackoverflow.com/q/20899607
tagged with: java
tagged with: servlets
has answer: http://stackoverflow.com/a/52696030
upvote count: 1
has comment: http://stackoverflow.com/comment/31369413
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/31369694
favorite count: 0
has comment: http://stackoverflow.com/comment/31369419
has title: Arabic value does not work in jsp servlet
downvote count: 0
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/31372200
has body: I have one demo code where I have three jsp named arabic1.jsp, arabic2.jsp, arabic3.jsp and one servlet named ArabicServlet. Inside arabic1.jsp I have one textbox where I entered arabic value and submitted the page by calling ArabicServlet servlet, which forward same content to arabic2.jsp, where I have displayed the same content inside textbox which is correctly displayed. Now I have one link on arabic2.jsp to forward request on arabic3.jsp using same servlet and content, here on arabic3.jsp I have displayed same arabic content inside textbox but I got wrong characters. I am entering value on first jsp as محمد , It is shown on third jsp as ÙØ­ÙØ¯ arabic1.jsp <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> Name : arabic2.jsp <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% Map map = (Hashtable)request.getAttribute("arabic"); String arabicvalue = (String)map.get("arabicmap"); System.out.println("Arabic Value on jsp = "+arabicvalue); String url = "/test/ArabicServlet?page=2&arabicvalue="+arabicvalue; %> Name : <input type="text" id="arabic" name="arabic" value="<%=arabicvalue%>"> <a href="<%=url%>"> Test arabic3.jsp <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% Map map = (Hashtable)request.getAttribute("arabic"); String arabicvalue = (String)map.get("arabicmap"); System.out.println("Arabic Value on jsp = "+arabicvalue); String url = "/test/ArabicServlet?page=2&arabicvalue="+arabicvalue; %> Name : <input type="text" id="arabic" name="arabic" value="<%=arabicvalue%>"> ArabicServlet.java protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); String page = request.getParameter("page"); System.out.println("Page Number = "+page); if(page.equals("1")){ String arabic = (String)request.getParameter("arabic"); System.out.println("Arabic Value from first page = "+arabic); Map map = new java.util.Hashtable(); …
score: 1

http://stackoverflow.com/comment/31399154
comment on: http://stackoverflow.com/a/20914324
has text: @RichardTingle I understand now, please see my updates.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/20875585
answer count: 1
has title: Android Thread getName gives current class name
tagged with: multithreading
tagged with: android
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31325392
has answer: http://stackoverflow.com/a/20876719
has comment: http://stackoverflow.com/comment/31325476
accepted answer: http://stackoverflow.com/a/20876719
has comment: http://stackoverflow.com/comment/31325389
type: Question
has body: In Android I have a class: class A extends Thread { A() { setName("AThread"); } class SM extends StateMachine { class A1 extends State { @Override enter() { Log.d (TAG, "" + Thread.currentThread().getName()); // this gives A } } } } class B { B1 () { new Handler(super.getLooper()).postDelayed(new Runnable() { @Override public void run() { mA = new A(); mA.start(); // start thread } }, 0); } } Class B object is running from an Android service. SM is a state machine class. A1 is a State class. So enter() is executed when I create a SM and switch to the state A1. SM object is created inside the Thread, run from the Thread. And switching to state also happens inside the Thread and run from the Thread. getName gives A class name instead of Thread name "AThread". Why ? Thank you.
has comment: http://stackoverflow.com/comment/31325566
has comment: http://stackoverflow.com/comment/31325532
score: 0
has comment: http://stackoverflow.com/comment/31325589

http://stackoverflow.com/comment/31472151
comment on: http://stackoverflow.com/q/20952908
score: 0
type: Comment
type: QuestionComment
has text: You'll also need to specify what _the external data source object_ is, either explicitly or through some convention.

http://stackoverflow.com/a/32017886
has comment: http://stackoverflow.com/comment/52968859
has body: I've managed to do this using a Java executable wrapper (I used Launch4j). This is the manifest file: { "name": "com.your.application", "description": "Your description.", "path": "path\\to\\wrapped\\java\\host.exe", "type": "stdio", "allowed_origins": [ "chrome-extension://idofyourchromeextension/" ] } This is the native host application I wrapped: import javax.swing.*; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.Socket; import java.net.URISyntaxException; public class ChromeHandler { static public void main(String[] args) { InputStream input = System.in; try { System.in.available(); } catch (Exception e) { return; } char receivedChar; try{ FileOutputStream output = new FileOutputStream("PathToTextFile"); while((receivedChar = (char) input.read()) != -1) { output.write(receivedChar); //My messages only have the '}' character at the end. if(receivedChar == '}') { return; } } } catch (IOException e) { e.printStackTrace(); } } }
score: 0
has comment: http://stackoverflow.com/comment/52968648
has comment: http://stackoverflow.com/comment/53031282
type: Answer
answers question: http://stackoverflow.com/q/20861303
has comment: http://stackoverflow.com/comment/52968736
has comment: http://stackoverflow.com/comment/53039220

http://stackoverflow.com/comment/31308967
type: AnswerComment
comment on: http://stackoverflow.com/a/20867060
has text: Error: Could not find or load main class test.Test
score: 0
type: Comment

http://stackoverflow.com/a/20906510
type: Answer
has comment: http://stackoverflow.com/comment/31383059
answers question: http://stackoverflow.com/q/20906214
has comment: http://stackoverflow.com/comment/31382888
has body: I've written that code some time ago, and edited a bit to match your requests. I hope it works. static ArrayList&lt;String&gt; permutations(String s) { ArrayList&lt;String&gt; ret = new ArrayList&lt;String&gt;(); permutation(s.toCharArray(), 0, ret); return ret; } public static void permutation(char[] arr, int pos, ArrayList&lt;String&gt; list){ if(arr.length - pos == 1) list.add(new String(arr)); else for(int i = pos; i &lt; arr.length; i++){ swap(arr, pos, i); permutation(arr, pos+1, list); swap(arr, pos, i); } } public static void swap(char[] arr, int pos1, int pos2){ char h = arr[pos1]; arr[pos1] = arr[pos2]; arr[pos2] = h; } UPDATE I just tried it on ideone.com. It seems to work. You're welcome. :) UPDATE 2 It should basically be the same code with arrays of int's: static ArrayList&lt;int[]&gt; permutations(int[] a) { ArrayList&lt;int[]&gt; ret = new ArrayList&lt;int[]&gt;(); permutation(a, 0, ret); return ret; } public static void permutation(int[] arr, int pos, ArrayList&lt;int[]&gt; list){ if(arr.length - pos == 1) list.add(arr.clone()); else for(int i = pos; i &lt; arr.length; i++){ swap(arr, pos, i); permutation(arr, pos+1, list); swap(arr, pos, i); } } public static void swap(int[] arr, int pos1, int pos2){ int h = arr[pos1]; arr[pos1] = arr[pos2]; arr[pos2] = h; } UPDATE 3 Works with int's too: http://ideone.com/jLpZow
score: 0
has comment: http://stackoverflow.com/comment/31383857

http://stackoverflow.com/q/20855502
has comment: http://stackoverflow.com/comment/31295031
answer count: 2
has answer: http://stackoverflow.com/a/20855594
duplicate of: http://stackoverflow.com/q/20932102
favorite count: 0
score: 0
has body: I'm trying to programmatically execute the new command "ScreenRecorder" kitkat. I just tried this: suProcess = Runtime.getRuntime().exec("su"); process = Runtime.getRuntime().exec("screenrecord /sdcard/Folder/Example.mp4"); But doesn't work. In the Folder I've the file Example.mp4 but it is empty (0 byte). Why? How can I solve this? Where is the problem? If from terminal emulator I write su and press enter and after write screenrecord /sdcard/Folder/Example.mp4 it works perfectly. Obvisioully I'm running on 4.4.2 and in a rooted terminal.
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
tagged with: root
has comment: http://stackoverflow.com/comment/31286153
upvote count: 3
type: UnansweredQuestion
has title: Execute a shell command programmatically: why it doesn't work?
has answer: http://stackoverflow.com/a/33254101
has comment: http://stackoverflow.com/comment/31286096
tagged with: java
has comment: http://stackoverflow.com/comment/31286100
downvote count: 3
linked to: http://stackoverflow.com/q/20932102
type: Question

http://stackoverflow.com/q/20861984
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/20862015
has comment: http://stackoverflow.com/comment/31299087
has title: Is this a good case where I should use Java Enum?
accepted answer: http://stackoverflow.com/a/20862055
favorite count: 0
tagged with: android
upvote count: 1
type: AnsweredQuestion
tagged with: enums
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20862055
possible better answer: http://stackoverflow.com/a/20862027
has answer: http://stackoverflow.com/a/20862027
has comment: http://stackoverflow.com/comment/31299121
has body: In an android asynctask of mine I have the following code: public class AddNewItemToServerAsync extends AsyncTask&lt;String, String, Bundle&gt; { private static final String TAG_SUCCESS = "success"; private static final String TAG_ITEM_ID = "item_id"; private static final String TAG_TRANSACTION_ID = "transaction_id"; private static final String TAG_TIME_ITEM_WAS_ADDED_TO_DB = "time_product_added"; private static final String TAG_BAD_REQUEST = "Bad request"; private static final String TAG_DB_PROBLEM = "Database Problem"; private static final String TAG_UNKNOWN_PROBLEM = "Unknown Problem"; private void setReason(String reason) { this.reason = reason; } @Override protected void onPreExecute() { ShowLoadingMessage.loading(context, Configurationz.LoadingMessages.ADDING_NEW_ITEM_TO_USER_COLLECTION); } @Override protected Bundle doInBackground(String... args) { //code here return dataRegardingTheItemJustAdded; } else if (success == Configurationz.HttpResponses.FAILURE_BAD_REQUEST) { // report tool setReason(TAG_BAD_REQUEST); return null; } else if (success == Configurationz.HttpResponses.FAILURE_DATABASE_PROBLEM) { setReason(TAG_DB_PROBLEM); return null; } else { setReason(TAG_UNKNOWN_PROBLEM); return null; } } catch (JSONException e) { e.printStackTrace(); setReason(TAG_UNKNOWN_PROBLEM); return null; } } @Override protected void onPostExecute(Bundle dataRegardingTheItemJustAdded) { ShowLoadingMessage.dismissDialog(); if (dataRegardingTheItemJustAdded != null) { if (listener != null) { listener.onAddNewItemSuccess(dataRegardingTheItemJustAdded); } } else { if (listener != null) { if (reason != null) { listener.onAddNewItemFailure(reason); } } } super.onPostExecute(dataRegardingTheItemJustAdded); } } and then the listener class goes like this: private static final String TAG_BAD_REQUEST = "Bad request"; private static final String TAG_DB_PROBLEM = "Database Problem"; private static final String TAG_UNKNOWN_PROBLEM = "Unknown Problem"; @Override public void onAddNewItemFail…

http://stackoverflow.com/comment/31368607
has text: it is not must .. just suggested if possible .. usually utilities methods are easy to use if it is static
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/20899122

http://stackoverflow.com/comment/31342876
score: 1
comment on: http://stackoverflow.com/q/20885312
type: Comment
type: QuestionComment
has text: Provided that re-compiling and running your application does not take huge amounts of time, and since as you said you plan to dispose of this once you find a good solution, I'd say that it would be most unwise to "Construct a car to travel 5 meters, instead of walking there on foot"

http://stackoverflow.com/q/20866290
has title: parsing a data from JSON response and populating to listview
has answer: http://stackoverflow.com/a/20866342
has answer: http://stackoverflow.com/a/20866353
has comment: http://stackoverflow.com/comment/31307354
downvote count: 5
has comment: http://stackoverflow.com/comment/31307326
tagged with: listview
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20866353
has comment: http://stackoverflow.com/comment/31307318
favorite count: 0
has answer: http://stackoverflow.com/a/20866349
type: Question
has comment: http://stackoverflow.com/comment/31307313
tagged with: android
score: -2
has body: Here is my structure of JSON URL:: http://54.218.73.244:7004/DescriptionSortedPrice/ JSON :: { "restaurants": [ { "Sl_no": 1, "Person_Name": "salmanKhan", "Image_Name": "image.jpg" }, Adapter.java public class Adapter extends BaseAdapter { // Declare Variables Context context; LayoutInflater inflater; ArrayList&lt;HashMap&lt;String, String&gt;&gt; data; HashMap&lt;String, String&gt; resultp = new HashMap&lt;String, String&gt;(); public Adapter(Context context, ArrayList&lt;HashMap&lt;String, String&gt;&gt; arraylist) { this.context = context; data = arraylist; } @Override public int getCount() { return data.size(); } @Override public Object getItem(int position) { return null; } @Override public long getItemId(int position) { return 0; } public View getView(final int position, View convertView, ViewGroup parent) { // Declare Variables TextView name; inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View itemView = inflater.inflate(R.layout.single_item, parent, false); // Get the position resultp = data.get(position); // Locate the TextViews in listview_item.xml name = (TextView) itemView.findViewById(R.id.title_textView_id); // Capture position and set results to the TextViews name.setText(resultp.get(MainActivity.NAME)); return itemView; } } MainActivity.java public class MainActivity extends Activity{ // Declare Variables JSONObject jsonobject; JSONArray jsonarray; ListView listview; Adapter adapter; ProgressDialog mProgressDialog; ArrayList&lt;HashMap&lt;String, String&gt;&gt; arraylist; static String NAME = "rank"; String TYPE_FILTER; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Get the view from listview_main.xml setContentView(R.layout.activity_main); listview = (ListView) findViewById(R.id.listView_id); // Execute DownloadJSON AsyncTask new DownloadJSON().execute(); } // DownloadJSON AsyncTask private class DownloadJSON extends AsyncTask&lt;Void, Void, Void&gt; { @Over…
possible better answer: http://stackoverflow.com/a/20866349
upvote count: 3
tagged with: java
tagged with: http://stackoverflow.com/tag/json
answer count: 3

http://stackoverflow.com/q/20940921
has answer: http://stackoverflow.com/a/20941001
accepted answer: http://stackoverflow.com/a/20941001
has comment: http://stackoverflow.com/comment/31448989
has body: As of late I've been developing a (very) small GUI application in Java. I'm extremely new to Swing and Java in general, but up until now I have been able to get everything to work the way I want it to. However, after cleaning up my code, when I run the program nothing but the border of the window appears. What am I doing wrong and how can I fix my code? Thanks ahead of time! For the sake of saving space I've made Pastebin links to all of my classes (besides Main). Main Class package me.n3rdfall.ezserver.main; public class Main { public static GUI g = new GUI(); public static void main(String[] args) { g.showWindow(800, 500); } } GUI Class http://pastebin.com/gDMipdp1 ButtonListener Class http://pastebin.com/4XXm70AD EDIT: It appears that calling removeAll() directly on 'frame' actually removed essential things other than what I had added. By calling removeAll() on getContentPane(), the issue was resolved.
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/31450181
has title: I'm attempting to create a small GUI application, but the contents of the JFrame are not showing on screen. How can I fix my code?
upvote count: 2
answer count: 1
tagged with: user-interface
downvote count: 1
favorite count: 0

http://stackoverflow.com/comment/31318472
type: QuestionComment
has text: I've tried replaceAll but it wasn't reading it.. it was giving me errors with incompatible types and such
score: 0
comment on: http://stackoverflow.com/q/20872034
type: Comment

http://stackoverflow.com/q/21005906
has body: so before I get into it, I'd like to describe my setup. Here is what I have: A file called MainActivity.java which is a simple Activity class that has onCreate() method and a btnClick() method that executes a Toast message. That's it, nothing complicated. The package name for this MainActivity.java is com.testapp. A file called LoadInst.java which is an Instrumentation class that tries to load the MainActivity.java into a Class object. THe package name for this is com.inst. So what I"m trying to do is in the LoadInst.java class, I'm loading the MainActivity.java class into a Class object and then I create a method object to represent the onCreate() method in order to invoke the onCreate() method. The problem is that I get an Exception null thrown when on MainActivity.java onCreate() method tries to execute the line super.onCreate(savedInstanceState) I don't know if its because it is missing some information it needs in order to execute super.onCreate(savedInstanceState) properly. Here is the code in my LoadInst.java which is extends to an Instrumentation class. package com.inst; import java.lang.reflect.Method; import android.app.Activity; import android.app.Instrumentation; import android.os.Bundle; import android.os.Looper; import android.util.Log; import android.view.View; public class LoadInst extends Instrumentation { @Override public void onCreate(Bundle arguments) { super.onCreate(arguments); start(); } @Override public void onStart() { super.onStart(); String mainAct= "com.testapps.MainActivity"; Looper.prepare(); try { Class&lt;?&gt; clazz = Class.forName(mainAct); Object obj = clazz.newInstance(); Class onCreateParam[] = new Class[1]; onCreateParam[0] = Bundle.class; Method onCreateMethod = Class.getDeclaredMethod("onCreate", onCreateParam); Bundle bundle = new Bundle(); Log.d("TAG", "test: invoking onCreate()"); onCreateMethod.setAccessible(true); onCreateMethod.invoke(obj, bundle); } catch (ClassNotFoundException e) { Log.d("TAG", "ClassNotFoundException…
has comment: http://stackoverflow.com/comment/31595525
answer count: 0
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31571695
has title: Android Load activity into Class<?> object
type: Question
has comment: http://stackoverflow.com/comment/31599067
has comment: http://stackoverflow.com/comment/31597798
tagged with: instrumentation
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/31598396
has comment: http://stackoverflow.com/comment/31597613

http://stackoverflow.com/comment/31551199
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20985619
type: AnswerComment
has text: Start a new question and paste in your entire exception, along with the code it references.

http://stackoverflow.com/comment/31496951
type: AnswerComment
score: 0
type: Comment
has text: But in my case I need to print english and hindi both in one page.Will this work?
comment on: http://stackoverflow.com/a/20966668

http://stackoverflow.com/q/20861539
answer count: 1
tagged with: jar
tagged with: applet
tagged with: onejar
has body: I have an applet that needs to import another libraries. I used Apache Ant to build this applet and libraries into same jar files, but there is no way to connect classes with libraries. I got NoClassDefFoundError. Because of that I decided to use one-jar with Ant. One-jar creates a jar files that contains libraries and classes. But classes that I wrote are in another jar inside of main jar. Directory looks like below : main.jar com doc lib main applets.jar MyApplet.class I need to access MyApplet class in applets.jar file but problem is that how can I import my applet class which is in second jar. It's not possible to write second attribute in applet tag. Is there any option in one-jar to build only one jar with libraries? What should I use?
score: 0
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20861564
has title: One-Jar for Applet
type: Question
tagged with: ant

http://stackoverflow.com/a/20914363
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/31398606
answers question: http://stackoverflow.com/q/20910840
downvote count: 0
score: 1
has body: If you have an OSGI Service Reference (which you do because you are using the osgi:reference spring tag), you need that reference when you evaluate your unit test. Since the unit test you are running has no OSGI runtime, that osgi:reference is failing. Your best bet is to write your unit test with an alternate version of /META-INF/spring/camel-context.xml that does not try to use the OSGI runtime. Without knowing which version of spring you are on, profiles in 3.1 can also help.
has comment: http://stackoverflow.com/comment/31400309

http://stackoverflow.com/q/20862921
tagged with: java
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/20864871
score: 0
answer count: 1
tagged with: paintcomponent
has body: this is my viewclass import java.awt.*; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.*; public class View { JFrame frame; JPanel background; public View() { frame = new JFrame("Platformer"); background = new JPanel(new BorderLayout()); BuildMenu(); SetBackground(); BuildLowerPanel(); frame.getContentPane().add(background); frame.setSize(800, 700); frame.setVisible(true); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); } private void BuildMenu() { JMenuBar menuBar = new JMenuBar(); JMenu menu = new JMenu("Menu"); menuBar.add(menu); frame.setJMenuBar(menuBar); JMenuItem i = new JMenuItem("Resume"); i.setActionCommand("RESUME"); JMenuItem j = new JMenuItem("Pause"); j.setActionCommand("PAUSE"); menu.add(i); menu.add(j); } public void paintComponent(Graphics g) { } private void BuildLowerPanel() { } } this is my Model class which essentially only reads in the image package introGUI; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; public class Model { private BufferedImage img; public void ReadImage() { try { img = ImageIO.read(new File("C:\\Users\\p333kle\\Pictures\\lvl1.jpg")); } catch(IOException e) { System.err.println("Error: Couldn't load background image"); } } } Right now i want to add a setBackground method to my view class which will be called by the controller when a level is initialized, and will take in the image read by the model. However i am confused as to how i will be doing this, because i know for sure i have to use paintComponent and then draw the image i have read. However i am unsure of how to proceed writing the setBackground method.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31301140
has title: How to use MVC and paintComponent to create a setBackground method in the view class for my platformer?
tagged with: model-view-controller
linked to: http://stackoverflow.com/q/3066590

http://stackoverflow.com/comment/31406343
score: 1
comment on: http://stackoverflow.com/q/20918902
has text: Have you register your **AlarmReciever** in your Maifest.xml file?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31482579
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20958823
type: Comment
has text: You mean numArray.length without subtracting it right?

http://stackoverflow.com/q/20985529
favorite count: 0
has comment: http://stackoverflow.com/comment/31532769
has comment: http://stackoverflow.com/comment/31532844
accepted answer: http://stackoverflow.com/a/20985619
downvote count: 6
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31532709
tagged with: java
has comment: http://stackoverflow.com/comment/31532727
has title: Can anyone help fix my code
has comment: http://stackoverflow.com/comment/31532841
type: Question
has comment: http://stackoverflow.com/comment/31532732
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31532868
has answer: http://stackoverflow.com/a/20985619
has comment: http://stackoverflow.com/comment/31532796
has comment: http://stackoverflow.com/comment/31532818
has comment: http://stackoverflow.com/comment/31532701
tagged with: macos
has body: These lines have errors on them the bs.show and g.dispose have the error syntax error identifier expect after this token and part of the g.drawImage says delete the tokens and the says says syntax error decleratorid expected after this token what have I done wrong g.drawImage(img, 0, 0, WIDTH HEIGHT, null); g.dispose(); bs.show(); Here is the full code package com.mime.WorldExplorer; public static final int WIDTH = 800; public static final int HEIGHT = 600; public static final String TITLE = "World explorer(Name not final) Pre-Alpha 0.0.1"; private static final String createBufferStrategy = null; private Thread thread; private BufferedImage img; private boolean running = false; private Render render; private Screen screen; private int[]pixels; private int i; private BufferStrategy bs; public Display() { screen = new Screen(HEIGHT, WIDTH); img = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB); pixels = ((DataBufferedInt)img.getRaster().getDataBuffer()).getData; } private void start() { if (running) return; running = true; thread = new Thread(this); } private void stop() { if(running) return; running = false; try { thread.join(); } catch (Exception e) { e.printStackTrace(); System.exit(0); } } public void run() { while(running); tick(); render(); } private void render() { BufferStrategy bs = this.getBufferStrategy(); if (bs == null) { createBufferStrategy(3); return; } for (int i = 0; i&lt;(WIDTH*HEIGHT); i++); pixels[i] = screen.pixels[i]; } Graphics g = bs.getDrawGraphics(); g.drawImage(img, 0, 0, WIDTH, HEIGHT, null); g.dispose(); bs.show(); private void tick() { } public static void main(String[] args) { Display game = new Display(); JFrame frame = new JFrame(); frame.add(game); frame.pack(); frame.setTitle(TITLE); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(WIDTH, HEIGHT); frame.setResizable(true); frame.setVisible(true); System.out.println("Running...."); System.out.println("Working!"); game…
score: -6

http://stackoverflow.com/a/20983568
upvote count: 1
has body: Does not look like a problem in the Java code. It is more a lower level networking and routing issue. First of all use system level tools to check the path from your computer to that domain name.
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/20983060
type: Answer

http://stackoverflow.com/q/20965164
score: 0
answer count: 3
has title: Null pointer access warning on enum type
has comment: http://stackoverflow.com/comment/31494384
has comment: http://stackoverflow.com/comment/31494411
has comment: http://stackoverflow.com/comment/31494398
has answer: http://stackoverflow.com/a/20965315
has answer: http://stackoverflow.com/a/20965370
type: AnsweredQuestion
tagged with: enums
tagged with: java
possible better answer: http://stackoverflow.com/a/20965315
type: Question
has answer: http://stackoverflow.com/a/20965516
has body: My MainActivity code is private void updateConnectionState() { Device localDevice = this.Controller.getConnectedDevice(); if (localDevice == null) updateModelSpinner(localDevice.getType()); //warning at this line str2 = localDevice.getHostName(); if (!TextUtils.isEmpty(str2)) } private void updateSpinner(Device.Type paramType) { boolean bool = Device.Type.UNKNOWN.equals(paramType); int i = 0; if (!bool) i = 1 + paramTvType.ordinal(); this.ModelSpinner.setSelection(i); } private void ModelSpinner(Device.Type paramType) { boolean bool = Device.Type.UNKNOWN.equals(paramType); int i = 0; if (!bool) i = 1 + paramType.ordinal(); this.ModelSpinner.setSelection(i); } My enum class is public class Device { private Type type = Type.A_LOGIC; public static Type getTypeForId(int paramInt) { switch (paramInt) { default: return Type.A_LOGIC; case 0: return TvType.B_LOGIC; case 1: return TvType.A_LOGIC; case 2: return TvType.D_LOGIC; case 3: return TvType.E_LOGIC; case 4: } return TvType.F_LOGIC; } public void setType(Type paramType) { this.Type = paramType; } public enum Type { A_LOGIC("A_LOGIC"), B_LOGIC ("B_LOGIC" ), C_LOGIC ("C_LOGIC"), D_LOGIC("D_LOGIC"), E_LOGIC ("E_LOGIC"), UNKNOWN("UNKNOWN"); private String object; TvType(String localobj) { this.object; = localobj; } public String getLetter() { return this.object;; } } public Type getType() { return this.type; } and in my main activity inside the method am calling type as updateSpinner(localDevice.getType()); but here it is showing the warning as Null pointer access: The variable localTVDevice can only be null at this location and throwing an null point error at that line. Am new to the concept of enum so please tell me why it is throwing this error.I referred stack overflow but couldn't find the answer.
accepted answer: http://stackoverflow.com/a/20965370
has comment: http://stackoverflow.com/comment/31494346

http://stackoverflow.com/comment/31441041
type: AnswerComment
comment on: http://stackoverflow.com/a/20935638
has text: Yah i already tried with "C:\\Program Files (x86)\\Mbrola Tools" [studied about these escape characters in C :P]
score: 0
type: Comment

http://stackoverflow.com/comment/31354387
type: QuestionComment
comment on: http://stackoverflow.com/q/20891176
has text: @ZouZou: Please see my update. It happens sometime.
score: 0
type: Comment

http://stackoverflow.com/comment/31353193
type: Comment
comment on: http://stackoverflow.com/a/20889136
has text: Solution is just boolean array to store subset solutions, if solution[n] = true means nth element is included in subset. n is the number element that can be in the solution which initially is total number of items
type: AnswerComment
score: 0

http://stackoverflow.com/a/20945512
has body: You can't access that instance of dj without making it final. You should be able to call ftpDisconnect from inside the class: @Override protected void onPostExecute(String result) { ftpDisconnect(); super.onPostExecute(result); }
score: 1
accepted answer of: http://stackoverflow.com/q/20945475
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/20945475

http://stackoverflow.com/comment/31441679
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/20936666
type: Comment
has text: No, when people (in programming) say **origin**, they mean the origin `(0,0)` of the coordinate system. In your case this is the top-left corner of the screen (forget about the center of the screen). [See this image](http://www.codesampler.com/d3dbook/chapter_03/chapter_03_files/image001.jpg). The center of the rectangle has nothing to do with this.

http://stackoverflow.com/a/20973306
has comment: http://stackoverflow.com/comment/31519782
has comment: http://stackoverflow.com/comment/31541313
score: 5
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20973221
type: Answer
has body: It's not possible. That's one of the enum limitations I find most annoying, but all you can do is try to work around it (as you would have done in Java pre-5.0). Only the enum itself can implement the interface and the generics must be specified at the enum level, so only Object or some common interface for those two would apply in your case. Declaring any aspect that you want to treat polymorphically (the run() method, in your example) inside the enum itself (and overriding the behavior in each constant) is usually the best workaround. Of course, you need to loosen up your type safety requirements. If you want to keep those strategies separated, you still need a run(Object) method inside the enum and that will be defined in each constant with some explicit cast, since you simply cannot have different method signatures per enum instance (or even if you can, they won't be visible as such from the outside). A hint on how to trick the compiler, if you really want to do that rather than a redesign or explicit casts for each instance: enum MyEnum implements MyInterface&lt;Object&gt; { MY_CLASS_1(new MyClass1()), MY_CLASS_2(new MyClass2()); // you may also drop generics entirely: MyInterface delegate // and you won't need that cast in the constructor any more private final MyInterface&lt;Object&gt; delegate; MyEnum(MyInterface&lt;?&gt; delegate) { this.delegate = (MyInterface&lt;Object&gt;) delegate; } @Override public void run(Object e) { delegate.run(e); } } The above will work and you'll get a ClassCastException (as expected) if you try to use MyEnum.MY_CLASS_1.run() with something other than SomeOtherClass1.
has comment: http://stackoverflow.com/comment/31541455
answers question: http://stackoverflow.com/q/20973221
upvote count: 5
has comment: http://stackoverflow.com/comment/31516425

http://stackoverflow.com/q/20866756
has title: A growing a panel does not end at the end of the JFrame - FormLayout
has comment: http://stackoverflow.com/comment/31308239
answer count: 1
has comment: http://stackoverflow.com/comment/31312640
tagged with: layout-manager
tagged with: jgoodies
favorite count: 0
has comment: http://stackoverflow.com/comment/31315594
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31308567
score: 2
has body: I have the below code, where I have a JPanel that needs to occupy all the space of the JFrame but stop when the frame completes. When using the Form Layout it does not. Please see the below code import com.jgoodies.forms.debug.FormDebugPanel; import com.jgoodies.forms.layout.FormLayout; import javax.swing.*; import java.awt.*; public class Test { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { final JFrame frame=new JFrame(); JPanel panel=new JPanel(new BorderLayout()); FormDebugPanel comp = new FormDebugPanel( new FormLayout("10dlu,fill:pref:grow,10dlu","10dlu,fill:pref:grow,10dlu")); panel.add(comp, BorderLayout.CENTER); frame.setContentPane(panel); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.setVisible(true); } }); } } This results in the diagram below. The border on the right and the bottom does not show, since it looks like the panel continues to grow beyond the parent container's boundary. Is there something that I am doing wrong?
downvote count: 0
tagged with: java
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/21271658
has comment: http://stackoverflow.com/comment/31312624
upvote count: 2
has comment: http://stackoverflow.com/comment/31308266

http://stackoverflow.com/comment/31294987
type: QuestionComment
has text: You also updated the API key in the manifest file, right?
type: Comment
score: 1
comment on: http://stackoverflow.com/q/20859984

http://stackoverflow.com/q/21000508
has title: Random select Java Maps values
linked to: http://stackoverflow.com/q/9919734
has body: Im trying to find out the correct Map or List to use... I need to add values to a list or map and retrieve then randomly..ie Something like Map&lt;String, String&gt;map index 1 of map (or list) = "John", "John is from some country" index 2 of map (or list) = "Mary", "Mary is from some country" index 3 of map (or list) = "Paul", "Paul is from some country" and then pass the values of the index to variable... The result for index 1 String name = "John" String from = "John is from some country" Any ideas welcome...
tagged with: maps
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21000844
tagged with: java
accepted answer: http://stackoverflow.com/a/21000844
has answer: http://stackoverflow.com/a/21000913
type: Question
duplicate of: http://stackoverflow.com/q/9919734
tagged with: arraylist
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/21000913

permissions
tag name: permissions
type: Tag
tags question: http://stackoverflow.com/q/20929119
tags question: http://stackoverflow.com/q/21013473
tags question: http://stackoverflow.com/q/20860403

http://stackoverflow.com/comment/31311869
score: 0
type: AnswerComment
has text: And the answer shows as..... 1: 7 - 1 = 6 2: 6/7*6 = 306 3: 306 - 19 = 287
type: Comment
comment on: http://stackoverflow.com/a/20867854

http://stackoverflow.com/comment/31402275
has text: change the code inside mouseClicked and moseEntered to this: Playnow.setIcon(new ImageIcon(getClass().getResource("PlaynowHover.png"))); also make sure PlaynowHover.png is in the same package.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20916340

http://stackoverflow.com/q/20937969
tagged with: java
downvote count: 3
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31443254
score: -2
has comment: http://stackoverflow.com/comment/31443152
has comment: http://stackoverflow.com/comment/31442968
answer count: 1
has comment: http://stackoverflow.com/comment/31443683
has comment: http://stackoverflow.com/comment/31442974
favorite count: 0
has comment: http://stackoverflow.com/comment/31443292
has title: How to find size of ArrayList<String> in my map?
has comment: http://stackoverflow.com/comment/31443097
has answer: http://stackoverflow.com/a/20938972
has comment: http://stackoverflow.com/comment/31442984
type: UnansweredQuestion
has body: I want to find the size of each value from the key-value pair in Map&lt;Integer, ArrayList&lt;String&gt;&gt;. Simply writing list.size() does not work. Here's my code: public void getF() throws Exception { BufferedReader br2 = new BufferedReader( new FileReader("/home/abc/NetBeansProjects/network1.txt")); System.out.println("hello" +r.usr); while ((s= br2.readLine()) != null) { String F[]= s.split(":"); for (String uid : F) { if (uid == F[0]) { user.add(uid); } else { li = followee.get(Integer.valueOf(F[0])); if (li == null) { followee.put(Integer.valueOf(F[0]), li= new ArrayList&lt;String&gt;()); } li.add(uid); } System.out.println(followee); int g = li.size(); System.out.println("g:" +g); [...] } } } Why am I not getting correct size on last line?

sensors
type: Tag
tag name: sensors
tags question: http://stackoverflow.com/q/20960715
tags question: http://stackoverflow.com/q/20949672

http://stackoverflow.com/q/20968325
has answer: http://stackoverflow.com/a/20985510
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/31532787
has comment: http://stackoverflow.com/comment/31500158
has comment: http://stackoverflow.com/comment/31499882
type: Question
tagged with: setter
tagged with: getter
has title: Identify valid getters and setters
answer count: 3
has comment: http://stackoverflow.com/comment/31499996
score: 3
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/20968552
has comment: http://stackoverflow.com/comment/31499967
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20968543
has comment: http://stackoverflow.com/comment/31500191
has body: I have a requirement like to scan a directory of java(POJO) files, go through each among them, and find out the corresponding variables defined in those POJO's, and to check whether it is having the correct getter and setter name. For Eg:- if empName is the variable name, then it should have getter as getEmpName() and not getempName(). This is because our J2EE application which was build on long time back started failing because of the use of invalid getters and setters, which is not recognizable with the front end technologies. I have done a basic program in which this can be determined. My exact problem is like on what basis can i identify a variable in a line. In my logic i have written assuming the third word in a line which contains private keyword will be the variable name. just want to know whether this approach is right or do i need to try something different, as it seems the requirement is very generic.

http://stackoverflow.com/q/20972246
tagged with: ant
has title: Generate multiple APK's with same code base using ANT
downvote count: 0
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: android
upvote count: 1
has body: I am trying to generate multiple apk with same code using ANT and have followed many posts to get it done. But i am unable to build the project successfully. Let me start with my first problem. I have a main project which has two library projects, something like Main Project ---> Library Project(isLibrary) ---> Google Play Services (isLibrary) When i am trying to update those projects, each and every time getting a message like It seems that there are sub-projects. If you want to update them please use the --subprojects parameter. So, from the above message it looks like am failing at early step of the build process. Then i have added the following snippet prior to &lt;target name="-package-resources" &gt; &lt;!-- only package resources if *not* a library project --&gt; &lt;echo message="Current Package name: ${app.custompackagename}" /&gt; &lt;do-only-if-not-library elseText="Library project: do not package resources..." &gt; &lt;aapt androidjar="${project.target.android.jar}" apkfolder="${out.absolute.dir}" assets="${asset.absolute.dir}" buildType="${build.target}" command="package" debug="${build.is.packaging.debug}" executable="${aapt}" ignoreAssets="${aapt.ignore.assets}" libraryPackagesRefid="project.library.packages" libraryRFileRefid="project.library.bin.r.file.path" libraryResFolderPathRefid="project.library.res.folder.path" manifest="${out.manifest.abs.file}" manifestpackage="${app.custompackagename}" nocrunch="${build.packaging.nocrunch}" previousBuildType="${build.last.target}" resourcefilename="${resource.package.file.name}" resourcefilter="${aapt.resource.filter}" versioncode="${version.code}" versionname="${version.name}" &gt; &lt;res path="${out.res.absolute.dir}" /&gt; &lt;res path="${resource.absolute.dir}" /&gt; &lt;!-- &lt;nocompress /&gt; forces no compression on any files in assets or res/raw --&gt; &lt;!-- &lt;nocompress extension="xml" /&gt; forces no compression on specific file extensions in assets and res/raw --&gt; &lt;/aapt&gt; &lt;/do-o…
score: 1
tagged with: java
tagged with: eclipse
type: Question

http://stackoverflow.com/q/21012843
has answer: http://stackoverflow.com/a/62340443
has body: I'm learning reactive programming techniques, with async I/O etc, and I just can't find decent authoritative comparative data about the benefits of not switching threads. Apparently switching threads is "expensive" compared to computations. But what scale are we talking on? The essential question is "How many processor cycles/instructions does it take to switch a java thread?" (I'm expecting a range) Is it affected by OS? I presume it's affected by number of threads, which is why async IO is so much better than blocking - the more threads, the further away the context has to be stored (presumably even out of the cache into main memory). I've seen Approximate timings for various operations which although it's (way) out of date, is probably still useful for relating processor cycles (network would likely take more "instructions", SSD disk probably less). I understand that reactive applications enable web apps to go from 1000's to 10,000's requests per second (per server), but that's hard to tell too - comments welcome NOTE - I know this is a bit of a vague, useless, fluffy question at the moment because I have little idea on the inputs that would affect the speed of a context switch. Perhaps statistical answers would help - as an example I'd guess >=60% of threads would take between 100-10000 processor cycles to switch.
score: 4
has comment: http://stackoverflow.com/comment/31582678
answer count: 2
has answer: http://stackoverflow.com/a/21012943
favorite count: 0
type: UnansweredQuestion
upvote count: 4
tagged with: reactive-programming
downvote count: 0
has title: How long does java thread switch take?
tagged with: java
has comment: http://stackoverflow.com/comment/31582856
type: Question

http://stackoverflow.com/comment/31584478
comment on: http://stackoverflow.com/q/21012798
has text: can someone respond me please its very urgent
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31557580
type: Comment
has text: I don't see any `excecuteBatch()` in doc.
type: AnswerComment
comment on: http://stackoverflow.com/a/20999323
score: 0

http://stackoverflow.com/comment/31492777
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20963342
has text: Haha, thanks. I apologise for my website!
type: AnswerComment

http://stackoverflow.com/comment/31450710
comment on: http://stackoverflow.com/a/20941617
has text: HA! Got it.. I'm not sure if this is right solution, but I can't deny it's workig.
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/q/20996710
has answer: http://stackoverflow.com/a/20996756
has answer: http://stackoverflow.com/a/20996902
has comment: http://stackoverflow.com/comment/31552018
upvote count: 1
possible better answer: http://stackoverflow.com/a/20996756
favorite count: 0
has answer: http://stackoverflow.com/a/20996953
has answer: http://stackoverflow.com/a/20996794
has title: What should be the correct way in assigning value to a static variable?
accepted answer: http://stackoverflow.com/a/20996794
has body: I'm trying to initialize a variable within a class constructor but the IDE is showing this warning: The static field SoapClient.url should be accessed in a static way. Can you please check my code below? What should be the correct way to initialize the static variable? Should I ignore the warning or should I just make the variable non-static? Thanks. public class SoapClient { private static String url; public SoapClient(String url) { this.url = url; } }
has answer: http://stackoverflow.com/a/20996838
has answer: http://stackoverflow.com/a/20996844
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31552049
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31552638
type: Question
has comment: http://stackoverflow.com/comment/31552335
answer count: 6

http://stackoverflow.com/comment/31328287
score: 1
comment on: http://stackoverflow.com/q/20877366
type: Comment
type: QuestionComment
has text: define "approximate match". Also, is "appropriate match" in your question a typo for "approximate match"?

http://stackoverflow.com/a/21024445
has body: As with others who have commented on your question — I, too, think the solution you have in your post is a bad one. The sole purpose of a repository abstraction is to hide away the persistence mechanism so that clients don't have to know about it. In your case you look for a low-level SQL Exception which has been intentionally abstracted away by Spring as well as JPA. If you really want to handle a constraint violation, the DataIntegrityViolationException is the correct one to catch. The repositories will wrap the store specific (MongoDB, JPA, whatever you use) in Spring DataAccessException subtypes to allow the clients to do exactly that: catch an exception per error type, not per persistence mechanism.
has comment: http://stackoverflow.com/comment/31653654
type: Answer
score: 6
answers question: http://stackoverflow.com/q/21000110
downvote count: 0
has comment: http://stackoverflow.com/comment/33438591
has comment: http://stackoverflow.com/comment/31818265
upvote count: 6
has comment: http://stackoverflow.com/comment/31698613
has comment: http://stackoverflow.com/comment/31848245

http://stackoverflow.com/comment/31446445
comment on: http://stackoverflow.com/a/20939692
has text: I tried putting the label after the loop in the `System.out.println("\nReversed order of lines is as follows..\n");` line but the same error occurs. I am unable to understand where/how I should place my break statement and the label.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/20876423
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31329389
has body: I suggest you read about Transport Layer Security (TLS); It is probably the simplest reasonable approach to security and has been widely adopted (e.g. https and ftps). In a sentence, it works by establishing a "secure channel" for your existing protocol to communicate over.
has comment: http://stackoverflow.com/comment/31328143
has comment: http://stackoverflow.com/comment/31327011
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31327149
accepted answer of: http://stackoverflow.com/q/20876249
has comment: http://stackoverflow.com/comment/31327071
type: Answer
answers question: http://stackoverflow.com/q/20876249

http://stackoverflow.com/q/20981224
has comment: http://stackoverflow.com/comment/31524576
has comment: http://stackoverflow.com/comment/31524424
tagged with: syntax
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/1367322
has body: I need to process a command in cmd and the command looks like this: "c:\Program Files (x86)\HMA! Pro VPN\bin\HMA! Pro VPN.exe" -changeip But I can't really add the " because I will get errors.. Is there a way to do that? What i've tried causes errors: cmd.exec(""c:/Program Files (x86)/HMA! Pro VPN/bin/HMA! Pro VPN.exe" -reconnect"); How can I escape that character so it works? Exception in thread "Thread-1" java.lang.IllegalArgumentException: Executable name has embedded quote, split the arguments at java.lang.ProcessImpl.isQuoted(Unknown Source) at java.lang.ProcessImpl.getExecutablePath(Unknown Source) at java.lang.ProcessImpl.&lt;init&gt;(Unknown Source) at java.lang.ProcessImpl.start(Unknown Source) at java.lang.ProcessBuilder.start(Unknown Source) at java.lang.Runtime.exec(Unknown Source) at java.lang.Runtime.exec(Unknown Source) at java.lang.Runtime.exec(Unknown Source) at HMACommand.reconnect(HMACommand.java:15)
score: 0
has title: Java syntax escapting symbols?
answer count: 2
has answer: http://stackoverflow.com/a/20981592
has answer: http://stackoverflow.com/a/20981248
has comment: http://stackoverflow.com/comment/31524418
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/16890457

http://stackoverflow.com/q/20870750
has title: Create a single entity for each of existing entity using queue lead to many duplications
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20880594
has comment: http://stackoverflow.com/comment/31316029
has body: I'm using GAE task queue in a common situation, i.e. create a single Entity for each User entity, In each task(url based), i did: Iterator with a fix number of User entity per time(say, 500). Create one Entity for each user and batch save it(async). Enqueue next task with end cursor as the start of next iteration, until no User to iterate. This seem work nice but i found i got many duplicated Entities there, say, i have 10k users but turn out there are 20k+ other entities created. My question is why the so many duplicated entities and any way to prevent? Thanks
score: 0
has comment: http://stackoverflow.com/comment/31331881
answer count: 1
accepted answer: http://stackoverflow.com/a/20880594
tagged with: google-app-engine

http://stackoverflow.com/comment/31304869
has text: What are you using for FTS that will not allow you to join the books table to the chapters found?
comment on: http://stackoverflow.com/a/20864378
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31461745
type: QuestionComment
comment on: http://stackoverflow.com/q/20948083
score: 0
has text: By generically I meant to say, that Map can have more than 2 key value pairs. And I need to use map key and value both to make a where clause, instead of just using value of the map..
type: Comment

http://stackoverflow.com/a/20890793
upvote count: 7
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31357729
type: Answer
downvote count: 0
score: 7
answers question: http://stackoverflow.com/q/20890770
accepted answer of: http://stackoverflow.com/q/20890770
has body: You've declared your variable as type Object which is the base type of every reference type, ie. it's the parent class of your Person class. You can therefore only access fields and methods available through the Object type. You'll need to declare your variable as type Person Person person1 = new Person(...); or cast the variable before you use it String response = ((Person) person1).myName; Also, be careful with your access modifiers.

http://stackoverflow.com/a/20982479
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20982449
upvote count: 11
answers question: http://stackoverflow.com/q/20982449
type: AcceptedAnswer
type: Answer
score: 11
has body: Remove the intent-filter from the non-primary activity in the manifest: &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; This is what causes a launcher icon for the activity to appear.
has comment: http://stackoverflow.com/comment/31527283

http://stackoverflow.com/comment/31512652
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/20975232
has text: Depends on `SomeOtherSteam` I guess.. See the [docs](http://docs.oracle.com/javase/7/docs/api/java/io/FileInputStream.html#close()) to be sure.
type: Comment

http://stackoverflow.com/a/20944809
has comment: http://stackoverflow.com/comment/38297835
type: Answer
has body: I spent days looking for a solution to why my native heap was increasing and my dalvik heap remained constant. After many questions and android documentation pages read i eventually tried to shut off hardware acceleration since I came across a OOM question relating the two already. I removed the line setLayerType( View.LAYER_TYPE_HARDWARE , null ) from my SurfaceView and the problem went away. I added that line after some advice from some suggestions on trying to get hardware acceleration turned on and i never really understood what i was doing there. For some reason that line caused about 1mb/2seconds to be added to the native heap until my program crashed. So to anyone who's looking for solutions to problems try one thing at a time and understand what your trying before you copy paste it to your code. I still don't know why that caused the native heap to constantly increase though. I hope this helps someone with OOM native heap issues.
accepted answer of: http://stackoverflow.com/q/20915639
answers question: http://stackoverflow.com/q/20915639
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/52327883

http://stackoverflow.com/comment/31427584
comment on: http://stackoverflow.com/a/20929778
type: AnswerComment
has text: I don't think its possible, at least in BlueJ, but I'll definitely let you know otherwise.
score: 0
type: Comment

http://stackoverflow.com/q/20885521
has answer: http://stackoverflow.com/a/20885702
score: 27
accepted answer: http://stackoverflow.com/a/20885702
upvote count: 27
has title: spring resttemplate url encoding
has body: I try to do a simple rest call with springs resttemplate: private void doLogout(String endpointUrl, String sessionId) { template.getForObject("http://{enpointUrl}?method=logout&amp;session={sessionId}", Object.class, endpointUrl, sessionId); } Where the endpointUrl variable contains something like service.host.com/api/service.php Unfortunately, my call results in a org.springframework.web.client.ResourceAccessException: I/O error: service.host.com%2Fapi%2Fservice.php So spring seems to encode my endpointUrl string before during the creation of the url. Is there a simple way to prevent spring from doing this? Regards
downvote count: 0
answer count: 7
has answer: http://stackoverflow.com/a/34061640
favorite count: 0
has answer: http://stackoverflow.com/a/70878809
has answer: http://stackoverflow.com/a/56027025
tagged with: spring
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20885763
tagged with: resttemplate
has answer: http://stackoverflow.com/a/59139616
possible better answer: http://stackoverflow.com/a/27550501
has answer: http://stackoverflow.com/a/27550501
has comment: http://stackoverflow.com/comment/98815835
type: Question

http://stackoverflow.com/comment/31550159
score: 0
type: Comment
type: QuestionComment
has text: My platform is Windows 7 Prof, SP1, x64. The Chrome version is 31.0.1650.63 m
comment on: http://stackoverflow.com/q/20993591

http://stackoverflow.com/comment/31433622
type: Comment
score: 2
has text: I always love Genius Solutions To Simple Problems - bit.ly/KqRW8v :) And still prefer to know than CSV has German data without looking into it. This makes code clean and readable. Cheers.
comment on: http://stackoverflow.com/a/20932488
type: AnswerComment

http://stackoverflow.com/q/20850193
tagged with: eclipse
has title: Android ADK error: There are no JREs installed in the workspace that are strictly compatible with this environment
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/11071233
has answer: http://stackoverflow.com/a/20850228
tagged with: android
type: AnsweredQuestion
tagged with: compiler-errors
tagged with: java
has comment: http://stackoverflow.com/comment/31277382
has body: I seem to have solved the immediate compile errors, but would appreciate some deeper insight and have not found anything on StackExchange or Googling the error message that appears directly applicable. Have been using Android Development Kit plugin for Eclipse for only a few weeks now. I understand that Android only uses syntax through Java 1.5 and suspect that may be a clue to my problem which only occurred after I added a Debug.startMethodTracing("filename.trace"); and added WRITE_EXTERNAL_STORAGE uses-permissions. Successfully compiled and ran simple (hello world style) apps, then all of a sudden: bam!! Brand new error message: "Build path specifies execution environment JavaSE-1.6. There are no JREs installed in the workspace that are strictly compatible with this environment." When I checked the Java Build path for my app: Right click project name &gt; Properties &gt; Java Build Path &gt; Libraries There were only four items: 1) An imported jar file library (for an API) 2) Android 4.4.2 3) Android Dependencies 4) Android Private Libraries I seem to have solved the problem by following these non-Android specific instructions: Java Build Path which essentially said to: 'Add Library" &gt; 'JRE System Library" &gt; "Workspace default JRE (jre7) and now my code appears to be compiling again. However, I am somewhat uncomfortable with my level of understanding of why it was necessary to do this (I just checked and Jdk1.7 is still in my system path and seemed to work fine before). Is this usually necessary when developing for Android? In other words, is it normal for a JRE to be explicitly listed in the libraries section with the ADK? Is there any problem with using JRE 1.7 instead of an older version? I also read these instructions, but again, the answer is not specific to Android: Warning - Build path specifies execution environment J2SE-1.4
linked to: http://stackoverflow.com/q/3138384
type: Question
accepted answer: http://stackoverflow.com/a/20850228

http://stackoverflow.com/comment/31298105
comment on: http://stackoverflow.com/a/20861564
score: 0
type: AnswerComment
type: Comment
has text: You can write it any way you like! But then ..what happened when you *tried it?*

http://stackoverflow.com/a/21006230
downvote count: 0
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/21006136
has body: First, you need to change the "project bytecode version" under File &gt; Settings, Compiler &gt; Java Compiler Second, do a full rebuild.
score: 2

http://stackoverflow.com/a/20951420
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20951312
type: Answer
has body: From the above code we can see the synchronized block uses 'this' as argument. the purpose of it is that, the threads created in the main method acquire lock on the object CodeOne and hence only one thread is able to access it. Only one thread at a time is able to access code inside a synchronized block that is synchronized on that object. is this mean that the main thread acquires a lock on 't1' ? In this example, this and t1 happen to refer to the same MyThread object. in the MainThread class, i get an exception You will have to show us the code that actually causes this, but you can't call notify or wait on objects which you haven't synchronized on. by the way the output of the 2nd program is This depends on a race condition. It depends on which Thread acquires the lock on the MyThread object first. If it's the main thread, then that's the output you will get. If it's the other thread, those lines will be reversed. I don't see a question on wait() and notify() so I'll just refer to Gray's answer, who has given a general explanation. Finally, don't ever synchronized on Thread objects. They have different behavior than normal objects when the actual thread they are referring to comes to an end.

http://stackoverflow.com/comment/31529848
type: Comment
type: QuestionComment
has text: Well, the error is gone, but it didn't replace the words for some reason
score: 0
comment on: http://stackoverflow.com/q/20983867

http://stackoverflow.com/comment/31451228
has text: Your works and doesn't work code are identical.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20941717
score: 0

http://stackoverflow.com/a/20859290
answers question: http://stackoverflow.com/q/20859113
upvote count: 1
downvote count: 0
type: Answer
has body: If you can declare it final, then declare it final. If you cannot, declare it volatile. Declaring it volatile has no effects on the inner structure of the Queue though. It only adds additional synchronization when assigning the a new ConcurrentLinkedQueue()
score: 1

http://stackoverflow.com/comment/31307188
type: Comment
type: QuestionComment
has text: @M.Sameer - How to configure servlet for that because in my app I have used webservlet annotation so it don't need any configuration in web.xml.
score: 0
comment on: http://stackoverflow.com/q/20856016

http://stackoverflow.com/a/20971384
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31515914
has comment: http://stackoverflow.com/comment/31523964
accepted answer of: http://stackoverflow.com/q/20969794
type: Answer
has body: As far as I understand, you want to access Event nodes if their Result attribute equals "INFORMATION". NOTE: This informs you about the general principles of XSLT, since your question is broad and unspecific. More precise answers can be given only if the question is more precise. In XSLT, you specify such restrictions in square brackets: &lt;xsl:template match="Event[parent::Event and @Result='INFORMATION']"&gt; The above line of code matches Event elements if they are a child of a superior Event element and if their @Result is right. Here is a full stylesheet as an example for finding specific nodes: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; &lt;xsl:output method="text"/&gt; &lt;xsl:strip-space elements="*"/&gt; &lt;xsl:template match="/"&gt; &lt;xsl:apply-templates/&gt; &lt;/xsl:template&gt; &lt;xsl:template match="TestLog|Event[parent::Testlog]"&gt; &lt;xsl:apply-templates/&gt; &lt;/xsl:template&gt; &lt;xsl:template match="Event[parent::Event and @Result='INFORMATION']"&gt; &lt;xsl:text&gt;Type: &lt;/xsl:text&gt; &lt;xsl:value-of select="@Type"/&gt; &lt;xsl:text&gt;&amp;#10;&lt;/xsl:text&gt; &lt;xsl:text&gt;Script name: &lt;/xsl:text&gt; &lt;xsl:value-of select="Property/@script_name"/&gt; &lt;xsl:text&gt;&amp;#10;&lt;/xsl:text&gt; &lt;/xsl:template&gt; &lt;xsl:template match="Property"/&gt; &lt;/xsl:stylesheet&gt; If applied to your input XML, this is the result: Type: Script Start Script name: DSE.DSEBalanceInquiry_FC.DseBalanceInquiry_FC_Test_003 Type: General Script name: DSE.DSEBalanceInquiry_FC.DseBalanceInquiry_FC_Test_003 It finds the wanted Event nodes and outputs their Type attribute, together with the script_name attribute of one of their child elements. EDIT (responding to your comment): The following stylesheet does what you want, I have modified several things: the namespace for XSL must be "http://www.w3.org/1999/XSL/Transform" you are matching "/" (the documen…
answers question: http://stackoverflow.com/q/20969794
has comment: http://stackoverflow.com/comment/31505613
has comment: http://stackoverflow.com/comment/31539977
has comment: http://stackoverflow.com/comment/31505648
has comment: http://stackoverflow.com/comment/31536562
has comment: http://stackoverflow.com/comment/31540771

http://stackoverflow.com/comment/31366472
has text: In that case, seems like Spring Servlet is serving you the jsp but not the html. Try changing your url-pattern of the mvc-dispatcher from / to /*
comment on: http://stackoverflow.com/a/20885901
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/20951025
has body: I'm sorry I'm new in Web Service specification and more specially with secured web service. I try to access a secured web service given by a .net application from an Alfreco web script. I've got .pfx file and .cer file and I already have method to access to a similar unsecured web service. So I just have to add certificate but after a lot of research I'm a little bit lost and I don't know where begin. Can somebody help me? Cdt
downvote count: 0
tagged with: pfx
has title: Call a secured (pfx) .NET webservice from Java (Alfresco)
tagged with: asp.net
favorite count: 0
tagged with: alfresco
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: web-services
score: 1
tagged with: java
type: Question

http://stackoverflow.com/a/20853049
has comment: http://stackoverflow.com/comment/31284766
has comment: http://stackoverflow.com/comment/31284530
has comment: http://stackoverflow.com/comment/31282020
type: Answer
has body: Try like the following example: MainActivity.java: package com.androidbegin.jsonparsetutorial; import java.util.ArrayList; import java.util.HashMap; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.app.ProgressDialog; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.widget.ListView; public class MainActivity extends Activity { // Declare Variables JSONObject jsonobject; JSONArray jsonarray; ListView listview; ListViewAdapter adapter; ProgressDialog mProgressDialog; ArrayList&lt;HashMap&lt;String, String&gt;&gt; arraylist; static String RANK = "rank"; static String COUNTRY = "country"; static String POPULATION = "population"; static String FLAG = "flag"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Get the view from listview_main.xml setContentView(R.layout.listview_main); // Execute DownloadJSON AsyncTask new DownloadJSON().execute(); } // DownloadJSON AsyncTask private class DownloadJSON extends AsyncTask&lt;Void, Void, Void&gt; { @Override protected void onPreExecute() { super.onPreExecute(); // Create a progressdialog mProgressDialog = new ProgressDialog(MainActivity.this); // Set progressdialog title mProgressDialog.setTitle("Android JSON Parse Tutorial"); // Set progressdialog message mProgressDialog.setMessage("Loading..."); mProgressDialog.setIndeterminate(false); // Show progressdialog mProgressDialog.show(); } @Override protected Void doInBackground(Void... params) { // Create an array arraylist = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); // Retrieve JSON Objects from the given URL address jsonobject = JSONfunctions .getJSONfromURL("http://www.androidbegin.com/tutorial/jsonparsetutorial.txt"); try { // Locate the array name in JSON jsonarray = jsonobject.getJSONArray("worldpopulation"); for (int i = 0; i &lt; jsonarray.length(); i++) { HashMap&lt;String, String&gt; ma…
score: 0
answers question: http://stackoverflow.com/q/20852466

http://stackoverflow.com/a/21053885
has body: First of all, I am answering this question for Windows users, and at the time of writing this, I am using Windows 8.1. So after playing around with this for a while, I ended up thinking I had to delete my entire description of the PATH environment variable, but all you have to do is add to the PATH variable. What needs to be added is the location of your Play folder (which is recommended to be placed in the root), and also add the location of JavaSDK+bin, which should be located somewhere in the Program Files folder. Adding these is a simple copy and paste of the entire location of the folder (found in the browsing bar), and insertion into the PATH variable by editing the variable. Be sure to go to the end of the value of the variable once clicking on Edit. Then, before pasting the location that was just copied, add a ; after the previous entry. If you accidentally delete anything, (as I did), this could spell out some problems for your computer. If you do delete anything, then Ctrl+z or go so some similar thread (&lt;--- like this one). I hope that this is somewhat of a dummies guide to solving the matter, as several Youtube tutorials and threads did not seem to work entirely for me. Best of luck!
answers question: http://stackoverflow.com/q/20960942
score: 0
type: Answer

http://stackoverflow.com/q/20898105
score: 6
has body: I have a text box, The value in that text box like 0.0 it is the currency value i need to format it the code is like below - &lt;div class="input"&gt; &lt;input type="radio" name="minSavingsPre" id="minSavingsOn" class="_mirror {mirror:{to:'minPlaceholder',autoSubmit:false}}" value="true" /&gt; &lt;buxwatch:message code="fi.admindashboard.rewardcontrols.savingsthresholds.mindollarsavingsofeachreward.radio" /&gt; &lt;input type="text" name="minimumSavingPre" id="minimumSavingPre" class="_mirror {rules:{required:function(element) {return $('#minPlaceholder').val() == 'true';}},mirror:{to:'minimumSaving',autoSubmit:false}}" /&gt; &lt;/div&gt; I dont know exactly how to format it by using JSTL Can any one help me
tagged with: java
has title: How do I format a Currency value using jstl format tag?
type: Question
tagged with: jstl
answer count: 1
upvote count: 6
downvote count: 0
tagged with: jsp
favorite count: 0
tagged with: http://stackoverflow.com/tag/html
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20898207

http://stackoverflow.com/comment/31361024
comment on: http://stackoverflow.com/a/20891476
has text: I'm testing the application on my mobile
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/20932254
has comment: http://stackoverflow.com/comment/31431755
type: Answer
score: 6
answers question: http://stackoverflow.com/q/20932244
has body: You only set value to this variable and never use its value. So - it is never used.
upvote count: 6
accepted answer of: http://stackoverflow.com/q/20932244
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/20953795
has body: Why don't you check the list size first and then create a restriction (if the size is &gt; 0): if (getOtherEntitiesList() != null &amp;&amp; getOtherEntitiesList().size() &gt; 0) { criteria.add(Restrictions.in("entity.otherEntity", getOtherEntitiesList())); }
has comment: http://stackoverflow.com/comment/31474391
upvote count: 2
has comment: http://stackoverflow.com/comment/31472336
type: Answer
score: 2
answers question: http://stackoverflow.com/q/20953728
has comment: http://stackoverflow.com/comment/31474128
has comment: http://stackoverflow.com/comment/31472849
has comment: http://stackoverflow.com/comment/31473274
has comment: http://stackoverflow.com/comment/31472587
downvote count: 0

http://stackoverflow.com/a/20891733
has body: I think you misunderstand android:onClick. It looks like you are expecting it to load a certain layout file when you click the Button but that is not how it works. The name you give android:onClick should be the name of a function which doesn't return anything and accepts a View as its one and only parameter. It looks like you pulled that from the example in the docs with public void sendMessage(View view) { Intent intent = new Intent(this, NewsActivity.class); startActivity(intent); } There are different ways you could do this. Since you already have the android:onClick and you have a method in your Activity, you could change that to look like android:onClick="sendMessage" then add a switch statement to that method to open the correct Activity. So something like public void sendMessage(View view) { switch (view.getId()) // get the id of the View clicked { case (R.id.newsButton): Intent intent = new Intent(this, NewsActivity.class); startActivity(intent); break; case (R.id.contactButton): // assuming ContactActivity.java is an Activity name Intent intent = new Intent(view.getContext(), ContactActivity.class); startActivity(intent); break; ... } } This answer shows a little different way to do the Intent so you cut down on some of the reusable code. If it looks too complicated then don't worry about it until you have a better understanding but just an idea.
answers question: http://stackoverflow.com/q/20891532
upvote count: 2
accepted answer of: http://stackoverflow.com/q/20891532
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/31504758
score: 0
comment on: http://stackoverflow.com/q/20970793
has text: I tried that too but its not working for me.Is there any other option to iterate and get the list ?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31494804
has text: If with "args" you mean default program args:If you don't call the program with any arg "args" will be of size 0 amd [0] will be out of array. Use if (args.Length > 0) before access it.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20965465

http://stackoverflow.com/q/20902932
accepted answer: http://stackoverflow.com/a/20906048
tagged with: jspinner
has comment: http://stackoverflow.com/comment/31375722
has comment: http://stackoverflow.com/comment/31375637
tagged with: java
has comment: http://stackoverflow.com/comment/31375822
linked to: http://stackoverflow.com/q/20887317
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/8282488
has body: I am adapting code from here: Value Change Listener to JTextField EDIT 2 The following code gives me an infinite loop of dialogs when I press the up spinner arrow: STRING: STRING: 10 VALS: 10 STRING: STRING: 10 VALS: 10 STRING: STRING: 10 VALS: 10 ..... Warning you will need to use taskmanager to kill it. public static void main(String[] args) { // TODO Auto-generated method stub JFrame F = new JFrame(); F.setVisible(true); JPanel p = new JPanel(); final JSpinner spin2 = new JSpinner(); spin2.setModel(new SpinnerNumberModel(10, 10, 100, 1)); JComponent comp = spin2.getEditor(); JFormattedTextField field = (JFormattedTextField) comp.getComponent(0); DefaultFormatter formatter = (DefaultFormatter) field.getFormatter(); formatter.setCommitsOnValidEdit(true); ((JSpinner.DefaultEditor)spin2.getEditor()).getTextField().getDocument().addDocumentListener(new DocumentListener() { public void changedUpdate(DocumentEvent e) { warn(); } public void removeUpdate(DocumentEvent e) { warn(); } public void insertUpdate(DocumentEvent e) { warn(); } public void warn() { String text = ((JSpinner.DefaultEditor)spin2.getEditor()).getTextField().getText(); JOptionPane.showMessageDialog(null, "STRING: "+text, "Error Massage", JOptionPane.ERROR_MESSAGE); if (text != null &amp;&amp; !text.trim().isEmpty()) { int stringValue = Integer.parseInt(((JSpinner.DefaultEditor)spin2.getEditor()).getTextField().getText()); JOptionPane.showMessageDialog(null, "VALS: "+spin2.getValue(), "Error Massage", JOptionPane.ERROR_MESSAGE); if (stringValue&lt;10 || stringValue &gt;100){ JOptionPane.showMessageDialog(null, "Error: Number outside bounds", "Error Massage", JOptionPane.ERROR_MESSAGE); } } } }); p.add(spin2); F.add(p); F.pack(); F.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } EDIT 3 This changes background to red when invalid, BUT values reverts to previous (if invalid) when field looses focus. I want to be able to put up a JOptionPane at that point saying value is STILL invalid, instead of reverti…
linked to: http://stackoverflow.com/q/3953208
has answer: http://stackoverflow.com/a/52505422
has title: How to check manual edits on a JSpinner field using DefaultEditor approach
has answer: http://stackoverflow.com/a/20906048
score: 1
answer count: 4
has comment: http://stackoverflow.com/comment/31376704
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/20903097
possible better answer: http://stackoverflow.com/a/20904380
tagged with: swing
has answer: http://stackoverflow.com/a/20904380
has comment: http://stackoverflow.com/comment/31375755
has comment: http://stackoverflow.com/comment/31376090
has comment: http://stackoverflow.com/comment/31375881
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/20966239

http://stackoverflow.com/comment/31458822
type: AnswerComment
comment on: http://stackoverflow.com/a/20936694
type: Comment
has text: Why do you use the @EntityManager Qualifier?
score: 0

http://stackoverflow.com/comment/31316098
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20861276
has text: Argh, noticed my mistake! I mistakenly copy-pasted an intermediate version in which I modified Humpty to be generic. Fixed that both here + in the gist!
score: 0

http://stackoverflow.com/comment/31523698
has text: No, since you have them in your `ArrayList`, you can instead do `myBalls.get(4).doSomething()`.
comment on: http://stackoverflow.com/q/20980785
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20955871
type: Answer
answers question: http://stackoverflow.com/q/20955528
downvote count: 0
score: 1
has body: JOptionPane.showMessageDialog(myPanel, "Something went wrong", "Error!", JOptionPane.ERROR_MESSAGE);
upvote count: 1

http://stackoverflow.com/q/20897672
has body: Cannot complete the install because one or more required items could not be found. Software being installed: Dali Java Persistence Tools - EclipseLink Support SDK (Optional) 2.2.2.v200911250220-53383ADCMoJCFjDTINGJOJBlG88h (org.eclipse.jpt.eclipselink_sdk.feature.feature.group 2.2.2.v200911250220-53383ADCMoJCFjDTINGJOJBlG88h) Missing requirement: Dali Java Persistence Tools - DB UI 1.1.100.v200906070220 (org.eclipse.jpt.db.ui 1.1.100.v200906070220) requires 'bundle org.eclipse.datatools.connectivity.ui [1.1.0,1.2.0)' but it could not be found Cannot satisfy dependency: From: Dali Java Persistence Tools - EclipseLink Support (Optional) 2.2.2.v200911250220-65A9AkF77g8OFL7BB7 (org.eclipse.jpt.eclipselink.feature.feature.group 2.2.2.v200911250220-65A9AkF77g8OFL7BB7) To: org.eclipse.jpt.feature.feature.group [2.2.2,3.0.0) Cannot satisfy dependency: From: Dali Java Persistence Tools - EclipseLink Support SDK (Optional) 2.2.2.v200911250220-53383ADCMoJCFjDTINGJOJBlG88h (org.eclipse.jpt.eclipselink_sdk.feature.feature.group 2.2.2.v200911250220-53383ADCMoJCFjDTINGJOJBlG88h) To: org.eclipse.jpt.eclipselink.feature.feature.group [2.2.2.v200911250220-65A9AkF77g8OFL7BB7] Cannot satisfy dependency: From: Dali Java Persistence Tools 2.2.2.v200911250220-7L7OAPFBBoPS0TBgXV1je (org.eclipse.jpt.feature.feature.group 2.2.2.v200911250220-7L7OAPFBBoPS0TBgXV1je) To: org.eclipse.jpt.db.ui [1.1.100.v200906070220]
has answer: http://stackoverflow.com/a/21587311
tagged with: java
tagged with: eclipse
tagged with: jakarta-ee
has title: Java J2ee plugin installtion has dependency errors
downvote count: 0
type: UnansweredQuestion
tagged with: eclipse-plugin
score: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/31366454
upvote count: 1
has comment: http://stackoverflow.com/comment/31366032
answer count: 1
has comment: http://stackoverflow.com/comment/31369239

http://stackoverflow.com/comment/31581064
has text: http://docs.oracle.com/javase/tutorial/collections/interfaces/order.html
comment on: http://stackoverflow.com/q/21011662
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31562593
comment on: http://stackoverflow.com/a/20989182
score: 0
type: AnswerComment
has text: Oh, if you are making an interactive application then that doesn't work. You could try making a method for logging the errors to disk or use a logging library. But again, your best bet is to use an IDE.
type: Comment

http://stackoverflow.com/q/20940082
type: AnsweredQuestion
upvote count: 2
tagged with: file
type: Question
has comment: http://stackoverflow.com/comment/31447300
has answer: http://stackoverflow.com/a/20940137
tagged with: java
has answer: http://stackoverflow.com/a/20940164
has body: I have like 2 files with almost same name like "myfile_1234.mp4" and "myfile_5678.mp4" in the same directory. One File, say, "myfile_1234.mp4" size is ZERO bytes where as the other file say "myfile_5678.mp4" has some size NOT EQUAL to ZERO (say 32kb). Now I want to delete the 1st File from the Directory but not the other File. Can we have something like a loop temp pointer to the Files in the Directory and we would then check for Size of file and delete it when its size is ZERO. Can anyone help me here...?
accepted answer: http://stackoverflow.com/a/20940164
has comment: http://stackoverflow.com/comment/31447257
has title: Deleting a file with similar names in Java
answer count: 2
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/20940137
score: 2

http://stackoverflow.com/q/20926835
has comment: http://stackoverflow.com/comment/31421427
has comment: http://stackoverflow.com/comment/31422259
has comment: http://stackoverflow.com/comment/31422780
has comment: http://stackoverflow.com/comment/31422219
has comment: http://stackoverflow.com/comment/31421602
favorite count: 0
has answer: http://stackoverflow.com/a/20927591
has answer: http://stackoverflow.com/a/20927682
has comment: http://stackoverflow.com/comment/31422389
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31421451
has comment: http://stackoverflow.com/comment/31421570
possible better answer: http://stackoverflow.com/a/20927682
score: 1
tagged with: java
has body: I would like to first say that this is not homework, but a pet project that I am working on in Java to better understand a complete Java program, and will hopefully be my first attempt at making my own GUI. That aside, I have a question about creating a hand of cards from my current code. As it stands, I have a main class called DummyRummy, a class for creating cards, a class that creates a standard deck of cards (which includes Jokers and "shuffles" the deck when a new deck is created), and a PlayerHands class. I am strictly working with ArrayLists for all of the code, and the PlayersHands class should return two ArrayLists that will be used. However, when I try to call the PlayerHands() method in the public static void main(), PlayerHands cannot be located for some reason... Here is the code for PlayerHands: package dummyrummy; public class PlayerHands { private Card[] playerOneCards; private Card[] playerTwoCards; private int[] value; PlayerHands(deck d, int round) { value = new int[round+3]; playerOneCards = new Card[round+2]; playerTwoCards = new Card[round+2]; //(round+2) is the handsize at any given time for (int x=0; x&lt;round+3; x++) { playerOneCards[x] = d.drawFromDeck(); //fills up one hand. playerTwoCards[x] = d.drawFromDeck(); //fills up second hand. } } } Here is the DummyRummy class. package dummyrummy; import java.util.*; public class DummyRummy { public static void main(String[] args) { deck testDeck; testDeck = new deck(); System.out.println(testDeck.getTotalCards()); System.out.println(testDeck.getClass()); int round = 1; PlayerHands(testDeck, round); //This is where the error is occurring }//End of arguments }//End of DummyRummy class Here is the Card class: package dummyrummy; public class Card { private short rank, suit; private static String[] suits = { "Hearts", "Spades", "Diamonds", "Clubs", "Joker" }; private static String[] ranks = { "Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King" }; private static String[] jo…
upvote count: 1
has title: Card Game in Java: Creating a "hand of cards"
type: Question
accepted answer: http://stackoverflow.com/a/20927591
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/31507919
type: QuestionComment
comment on: http://stackoverflow.com/q/20972530
has text: Oops, yes. It translates to it, i.e. all args are put into an array for you.
score: 0
type: Comment

http://stackoverflow.com/comment/31526915
comment on: http://stackoverflow.com/a/20982411
type: AnswerComment
score: 0
type: Comment
has text: Is this possible: `new Thread(new MyObject()).start();` if MyObject implements Runnable?

http://stackoverflow.com/comment/31584475
score: 0
comment on: http://stackoverflow.com/a/21013948
type: Comment
has text: Thats cause the getChildCount() is a method of ViewGroup.
type: AnswerComment

http://stackoverflow.com/a/20877115
downvote count: 5
has comment: http://stackoverflow.com/comment/31360485
has comment: http://stackoverflow.com/comment/83534207
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31328141
has comment: http://stackoverflow.com/comment/31343107
type: Answer
score: 193
has comment: http://stackoverflow.com/comment/61177065
has comment: http://stackoverflow.com/comment/31328841
answers question: http://stackoverflow.com/q/20877086
has body: There's a striking difference here. valueOf is returning an Integer object, which may have its values cached between -128 and 127. This is why the first value returns true - it's cached - and the second value returns false - 128 isn't a cached value, so you're getting two separate Integer instances. It is important to note that you are comparing references with Integer#valueOf, and if you are comparing a value that is larger than what the cache supports, it will not evaluate to true, even if the parsed values are equivalent (case in point: Integer.valueOf(128) == Integer.valueOf(128)). You must use equals() instead. parseInt is returning a primitive int. This is why the third value returns true - 128 == 128 is evaluated, and is of course, true. Now, a fair bit happens to make that third result true: An unboxing conversion occurs with respect to the equivalence operator you're using and the datatypes you have - namely, int and Integer. You're getting an Integer from valueOf on the right hand side, of course. After the conversion, you're comparing two primitive int values. Comparison happens just as you would expect it to with respect to primitives, so you wind up comparing 128 and 128.
upvote count: 198
accepted answer of: http://stackoverflow.com/q/20877086

http://stackoverflow.com/comment/31330660
has text: What is the EL that you have used ?
comment on: http://stackoverflow.com/q/20874229
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31448377
type: Comment
comment on: http://stackoverflow.com/a/20940396
has text: it is printing the first number and then very small numbers next to it
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31469618
comment on: http://stackoverflow.com/a/20952368
type: Comment
score: 2
has text: This is a syntax error... it should be `Arrays.asList(new String[]{"a","b","c"...})`
type: AnswerComment

http://stackoverflow.com/a/20974021
upvote count: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20971834
type: Answer
accepted answer of: http://stackoverflow.com/q/20971834
has body: A JDK is required to compile your JSP files. To fix your problem, you will need to use a JDK instead of a JRE for your Eclipse. You should do the following: Go to Window->Preferences->Java->Installed JREs. Make sure that you point to a JDK here and not JRE. The above should address your problem. Restart Eclipse - just in case. If not, do the following: If your Eclipse is still not able to take that setting, you will need to specify the JDK in the eclipse.ini file in the -vm arguments. Check this answer if you have problems setting it up in the eclipse.ini file : changing jdk in eclipse
score: 2

http://stackoverflow.com/a/20949269
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Right-To-Left or Left-To-Right, some editors decide to reverse string if they detect RTL language. In your case an editor reverses it only when there is RTL language but no LTR (english) in particular line. see explanation here: http://en.wikipedia.org/wiki/Bi-directional_text
answers question: http://stackoverflow.com/q/20948899
score: 2
accepted answer of: http://stackoverflow.com/q/20948899
upvote count: 2

http://stackoverflow.com/comment/31509214
comment on: http://stackoverflow.com/a/20972181
has text: I am opening the file using Textpad.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/20901446
has answer: http://stackoverflow.com/a/23383041
tagged with: java
has answer: http://stackoverflow.com/a/41763656
downvote count: 0
favorite count: 0
tagged with: face-detection
answer count: 3
type: UnansweredQuestion
tagged with: android
has body: Face Detection I had a bitmap want to detect face from that bitmap in java . Any one have idea to get face from image .
score: 2
upvote count: 2
has title: Implementing Face Detection from bitmap android
tagged with: bitmap
type: Question
has answer: http://stackoverflow.com/a/20901470

http://stackoverflow.com/a/20928127
score: 1
upvote count: 1
has body: Just implement Comparable to your class end override the compareTo method. In the method just compare the property u want to be compared when the sorting is applied. Ex. public class Planeet implements Comparable&lt;Planeet&gt; private int diameter; private String naam; private double relatieveMassa; public Planeet(int diameter, String naam, double relatieveMassa) { this.diameter = diameter; this.naam = naam; this.relatieveMassa = relatieveMassa; } @Override public int compareTo(Planeet arg0) { //sorting on naam return this.naam.compareTo(arg0.naam); } } then in your other class just use Collections.sort(planeten); it will use the compareTo() method to sort them . If u want to make more sorting options, just make Comparators
downvote count: 0
answers question: http://stackoverflow.com/q/20927971
type: Answer

http://stackoverflow.com/comment/31534234
has text: I've added the entire class where the Quizz list is in.
comment on: http://stackoverflow.com/a/20986358
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31357669
score: 1
has text: If it had quotes the error message would show `""16""` ... FYI
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20892969

http://stackoverflow.com/a/20967402
upvote count: 1
has comment: http://stackoverflow.com/comment/31498527
has comment: http://stackoverflow.com/comment/31499773
answers question: http://stackoverflow.com/q/20966456
downvote count: 0
has comment: http://stackoverflow.com/comment/31500749
score: 1
has body: You can use the validation groups feature. Here is the nice article about that but in a short it can be like this: interface Positive { } class Amount { ... @DecimalMin(value = "0.01", message = "field.number.positive", groups=Positive.class) private BigDecimal value; } // when you want to validate that value is positive Set&lt;ConstraintViolation&lt;Order&gt;&gt; violations = validator.validate(order, Positive.class); // when you don't want to validate that value is positive Set&lt;ConstraintViolation&lt;MyNewEntity&gt;&gt; violations = validator.validate(myNewEntity);
has comment: http://stackoverflow.com/comment/31501100
type: Answer

http://stackoverflow.com/a/20988215
has body: When connect using the credentials (Username : system, Password : ####) the account got connected without any issue from java program. However, when connected using the credentials (Username: HR, Password : ****) got the error message ORA-28000: the account got locked. But was able to login using these HR credentials from oracle console. So, to get the connection from java program, did the following: public static void main(String args[]) throws SQLException, ClassNotFoundException{ String query; // Connect to system Database first Class.forName("oracle.jdbc.driver.OracleDriver"); String url = "jdbc:oracle:thin:@127.0.0.1:1521:XE"; Connection con = DriverManager.getConnection(url,"system","####"); Statement statement = con.createStatement(); query = "alter user HR identified by HR account unlock"; //Unlock the account ResultSet resultset = statement.executeQuery(query); //Connect to HR database con = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:XE","HR","****"); statement = con.createStatement(); //Fetch all the tables in HR database query = "select 'Connected' from dual"; resultset = statement.executeQuery(query); //Prints records fetched while (resultset.next()) { System.out.println(resultset.getString(1)); } statement.close(); con.close(); } The HR account got unlocked and now able to execute other queries without issues.
score: 0
has comment: http://stackoverflow.com/comment/31538162
type: Answer
answers question: http://stackoverflow.com/q/20988214
has comment: http://stackoverflow.com/comment/31583532

http://stackoverflow.com/comment/31588624
has text: ARE YOU NOT ENTERTAINED?
comment on: http://stackoverflow.com/a/21015562
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/31373789
comment on: http://stackoverflow.com/a/20901938
has text: is your device rooted? are you on windows or linux or mac?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31453929
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20943327
has text: Sorry I am facing problem in updating my Jlist from another thread I am making a program which will update JList present in GUI class from another thread Nut this code which is an example is not working for me :(

http://stackoverflow.com/q/20876326
tagged with: subdirectory
has title: Java applet with files amomg several subfolders
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/20876449
tagged with: applet
possible better answer: http://stackoverflow.com/a/20877332
has body: I have a Java program that includes several directories and I would like to turn it into an applet. For that purpose I have embedded the class which will have the start and paint methods like so: &lt;applet code="appletClass.class" width="450" height="420" codebase="myProgram/bin/"&gt; &lt;/applet&gt; Now, the appletClass.class file is in myProgram/bin/, but other classes that appletClass.class calls to and instantiates are among several other folders (some are myProgram/bin/ca, myProgram/bin/de). Does the JVM automatically know which subfolder to look for if I use import statements in appletClass.java or is there some way to include multiple subdirectories in the embedding so that when I instantiate objects defined in different directories the application works?
has answer: http://stackoverflow.com/a/20876449
tagged with: embed
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20877332
tagged with: java

http://stackoverflow.com/comment/31442974
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20937969
has text: What do you mean by does not work ?

http://stackoverflow.com/q/20971504
type: Question
accepted answer: http://stackoverflow.com/a/20971665
score: 0
has title: jetty is showing index.html from eclipse root folder
answer count: 1
tagged with: jetty
has body: I have a plugin project where I want to embedd jetty and display an index.html file that is in the project root folder. I'm running this code: Server server = new Server(8080); ResourceHandler resource_handler = new ResourceHandler(); resource_handler.setDirectoriesListed(true); resource_handler.setWelcomeFiles(new String[]{ "index.html" }); resource_handler.setResourceBase("."); HandlerList handlers = new HandlerList(); handlers.setHandlers(new Handler[] { resource_handler, new DefaultHandler() }); server.setHandler(handlers); server.start(); server.join(); server.setStopAtShutdown(true); I'm getting the Eclipse folder listed in the browser. I moved the index.html to the eclipse folder and the problem was solved. But I want jetty to get the index.html file from my project root folder and not from the Eclipse root folder. Can somebody help me?
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20971665

http://stackoverflow.com/comment/31553248
score: 0
type: Comment
type: QuestionComment
has text: I deleted my answer because a convex hull algorithm seems like an overkill (and also you don't want a convex polygon).
comment on: http://stackoverflow.com/q/20997254

http://stackoverflow.com/a/20960817
answers question: http://stackoverflow.com/q/20960653
has body: You need to put both the files in abstractclass folder because you have put package abstractclass; for both the classes
score: 0
type: Answer

http://stackoverflow.com/comment/31591257
type: Comment
type: QuestionComment
has text: in the previous sample the marshalling process results in the following xml: `code` <?xml version="1.0" encoding="UTF-8" standalone="yes"?> getcredits 12523 aptalaser `code`
score: 0
comment on: http://stackoverflow.com/q/21005841

http://stackoverflow.com/a/20977257
type: Answer
answers question: http://stackoverflow.com/q/20976930
downvote count: 0
score: 1
upvote count: 1
has body: Why exactly do you want to use a regular expression to do this? I would do it like this: String url = "http://localhost:1111/search?id=13&amp;time=3200&amp;type=abc"; String[] split = url.split("&amp;"); String id = ""; for (String s : split){ if (s.contains("id")){ id = s.substring(s.indexOf("id=")+3, s.length()); } } System.out.println(id); 13

http://stackoverflow.com/q/20872355
downvote count: 1
has comment: http://stackoverflow.com/comment/31319077
has comment: http://stackoverflow.com/comment/31319125
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/31319108
type: Question
has comment: http://stackoverflow.com/comment/31319072
upvote count: 0
has comment: http://stackoverflow.com/comment/31319087
has comment: http://stackoverflow.com/comment/31319133
answer count: 1
tagged with: operator-precedence
has answer: http://stackoverflow.com/a/20872409
favorite count: 0
has body: I was playing around with java code, until I hit this hard wall: int m = 5; System.out.println(m++); System.out.println(++m); System.out.println(m = ++m * 2); System.out.println(m = m++ * 2); System.out.println(m); and the output ( which I really can't explain) is as follows: 5 7 16 32 32 This is really driving me crazy ! Why is the compiler skipping the last m++ before multiplication ? is it that the compiler adds 1 to another instance of m than the original ... I really doubt even that does make any sense at all!
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31319621
has title: Java operator precedence

http://stackoverflow.com/comment/31401666
has text: Right, fixed that thanks.
comment on: http://stackoverflow.com/q/20915991
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31470175
comment on: http://stackoverflow.com/a/20952368
score: 0
type: AnswerComment
type: Comment
has text: @MarkoTopolnik thanks i didn't know that `#` was for instance, and `.` to class level methods (static)

http://stackoverflow.com/q/20955398
has title: Is it a bad idea to pass an HttpRequest Object as a parameter to other objects methods?
score: 1
favorite count: 0
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/65219430
tagged with: java
downvote count: 1
answer count: 1
tagged with: httprequest
has body: Is it a bad behavior to pass Http Request Object as a parameter to other class on Java?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20955524
has comment: http://stackoverflow.com/comment/31475436

http://stackoverflow.com/comment/31557249
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20998951
has text: @Paul If you want one polygon like in your picture, then you can't remove that vertex. Without that vertex, you'd end up with angles connecting the remaining vertices. Can you even express the desired polygon with your code? If so, then I would replace pairs of vertices with a single vertex.
score: 0

http://stackoverflow.com/q/20953875
accepted answer: http://stackoverflow.com/a/20956432
has comment: http://stackoverflow.com/comment/31472580
linked to: http://stackoverflow.com/q/1115413
has comment: http://stackoverflow.com/comment/31472391
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20953950
has comment: http://stackoverflow.com/comment/31473341
has answer: http://stackoverflow.com/a/20953950
tagged with: java
has comment: http://stackoverflow.com/comment/31474174
type: Question
has comment: http://stackoverflow.com/comment/31472646
has body: I am making a simple calculator as my first made by me app and I have two EditTexts and if I press any of the 4 calculation buttons the app crashes, I have set a toast message to display if EditText1 &amp; EditText2 are empty and if not do calculation according to button pressed...how can I prevent it from crashing? Here's my MainActivity.java: public class MainActivity extends Activity { EditText number1text; EditText number2text; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); number1text = (EditText) findViewById(R.id.num1text); number2text = (EditText) findViewById(R.id.num2text); } public void calcadd(View v) { // here if (number1text.getText().toString().isEmpty() || number2text.getText().toString().isEmpty()) { Toast msg = Toast.makeText(getBaseContext(), "You Should Put Numbers To Do Calculation", Toast.LENGTH_LONG); msg.show(); } else{ } Integer num1text = Integer.parseInt(number1text.getText().toString()); Integer num2text = Integer.parseInt(number2text.getText().toString()); Integer ans = num1text + num2text; TextView answer = (TextView) findViewById(R.id.ans); answer.setText("Answer:" + ans.toString()); } public void calcminus(View v) { // here if (number1text.getText().toString().isEmpty() || number2text.getText().toString().isEmpty()) { Toast msg = Toast.makeText(getBaseContext(), "You Should Put Numbers To Do Calculation", Toast.LENGTH_LONG); msg.show(); } else{ } Integer num1text = Integer.parseInt(number1text.getText().toString()); Integer num2text = Integer.parseInt(number2text.getText().toString()); Integer ans = num1text - num2text; TextView answer = (TextView) findViewById(R.id.ans); answer.setText("Answer:" + ans.toString()); } public void calcdivide(View v) { // here if (number1text.getText().toString().isEmpty() || number2text.getText().toString().isEmpty()) { Toast msg = Toast.makeText(getBaseContext(), "You Should Put Numbers To Do Calculation", Toast…
has comment: http://stackoverflow.com/comment/31472958
has comment: http://stackoverflow.com/comment/31472536
has comment: http://stackoverflow.com/comment/31473085
has comment: http://stackoverflow.com/comment/31474225
score: 0
has comment: http://stackoverflow.com/comment/31472433
answer count: 3
tagged with: android
has title: When I press a button and the EditTexts are empty it crashes
has comment: http://stackoverflow.com/comment/31472382
favorite count: 0
has answer: http://stackoverflow.com/a/20956432
has comment: http://stackoverflow.com/comment/31472411
upvote count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/31472424
has answer: http://stackoverflow.com/a/20955587

http://stackoverflow.com/a/36815191
type: Answer
answers question: http://stackoverflow.com/q/20987214
downvote count: 1
upvote count: 80
has comment: http://stackoverflow.com/comment/101431703
score: 79
has body: Java 8 provides a nice way for that: Files.walk(path) This method returns Stream&lt;Path&gt;.

http://stackoverflow.com/a/20908134
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/31412733
has comment: http://stackoverflow.com/comment/31387297
has body: You should really be using MVC frameworks like Spring MVC or struts2. You should always have clear abstractions: Dao Layer Service Layer Business Layer Model Objects DTO's Helpers/Utils Whenever possible use EL languages like JSTL/OGNL on JSP pages. Never ever use scriptlets. If you use any of the above MVC frameworks, you'd probably never need to use Servlets directly! Displaying grids with data from database use something like DisplayTag or Jqgrid (with Ajax calls)
upvote count: 1
has comment: http://stackoverflow.com/comment/31386792
has comment: http://stackoverflow.com/comment/31387094
answers question: http://stackoverflow.com/q/20907608
has comment: http://stackoverflow.com/comment/31386701
accepted answer of: http://stackoverflow.com/q/20907608
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/31325066
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20875403
has text: Well, give us a sample of your JSON that would reproduce this error.
type: Comment

http://stackoverflow.com/comment/31297892
has text: Then the best thing for you to do is to use a library to parse the CSV for you. [See this question.](http://stackoverflow.com/questions/4751539/parsing-a-csv-file-in-java)
comment on: http://stackoverflow.com/q/20861426
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/31402506
has text: So let us see its body, and what is your DB?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20916479
score: 0

http://stackoverflow.com/q/20849936
tagged with: java
type: Question
has body: Let's say I have these handler flow in netty pipeline: UpHandler1 -> UpHandler2 -> UpHandler3 -> ... -> DownHandler1 -> DownHandler2 -> DownHandler3 Based on certain condition (i.e. already found response to request without doing further processing), is there anyway, in my UpHandler2, I can straight go to DownHandler2 (so skip certain upstream as well as downstream handlers in between)? Is this recommended?
has answer: http://stackoverflow.com/a/20870858
tagged with: proxy
score: 0
has title: How to skip certain handlers and directly go to specific handler in netty
answer count: 1
tagged with: netty
accepted answer: http://stackoverflow.com/a/20870858
type: AnsweredQuestion

http://stackoverflow.com/comment/31403975
has text: @Mani.. I think this is the pattern: `- If any non annotated constructor is present constructors are read in reverse order. - If not then in the natural order.`
comment on: http://stackoverflow.com/a/20913543
type: AnswerComment
score: 0
type: Comment

multithreading
tags question: http://stackoverflow.com/q/20975383
tags question: http://stackoverflow.com/q/20952464
tags question: http://stackoverflow.com/q/20866021
tags question: http://stackoverflow.com/q/20888383
tags question: http://stackoverflow.com/q/20991219
tags question: http://stackoverflow.com/q/20928767
tags question: http://stackoverflow.com/q/20874238
tags question: http://stackoverflow.com/q/20940353
tags question: http://stackoverflow.com/q/20873420
tags question: http://stackoverflow.com/q/20989342
tags question: http://stackoverflow.com/q/20937880
tags question: http://stackoverflow.com/q/20958258
tags question: http://stackoverflow.com/q/20899117
tags question: http://stackoverflow.com/q/20950581
tags question: http://stackoverflow.com/q/20973276
tags question: http://stackoverflow.com/q/20905985
type: Tag
tags question: http://stackoverflow.com/q/20966388
tags question: http://stackoverflow.com/q/20921850
tags question: http://stackoverflow.com/q/20915832
tags question: http://stackoverflow.com/q/20891386
tags question: http://stackoverflow.com/q/20931957
tags question: http://stackoverflow.com/q/20951312
tags question: http://stackoverflow.com/q/20935119
tags question: http://stackoverflow.com/q/21014305
tags question: http://stackoverflow.com/q/20999625
tags question: http://stackoverflow.com/q/20942547
tags question: http://stackoverflow.com/q/20969292
tags question: http://stackoverflow.com/q/20893227
tags question: http://stackoverflow.com/q/20851214
tags question: http://stackoverflow.com/q/20987801
tags question: http://stackoverflow.com/q/20955546
tags question: http://stackoverflow.com/q/20977932
tags question: http://stackoverflow.com/q/20990330
tags question: http://stackoverflow.com/q/20878902
tags question: http://stackoverflow.com/q/20962239
tags question: http://stackoverflow.com/q/20986070
tags question: http://stackoverflow.com/q/20998977
tags question: http://stackoverflow.com/q/20890561
tags question: http://stackoverflow.com/q/20906255
tags question: http://stackoverflow.com/q/20943327
tags question: http://stackoverflow.com/q/20988822
tags question: http://stackoverflow.com/q/20961767
tags question: http://stackoverflow.com/q/20870299
tags question: http://stackoverflow.com/q/20863267
tags question: http://stackoverflow.com/q/20900885
tags question: http://stackoverflow.com/q/20959442
tags question: http://stackoverflow.com/q/20962650
tags question: http://stackoverflow.com/q/20975237
tags question: http://stackoverflow.com/q/20944223
tags question: http://stackoverflow.com/q/20961379
tags question: http://stackoverflow.com/q/20953617
tags question: http://stackoverflow.com/q/20968958
tags question: http://stackoverflow.com/q/20914415
tags question: http://stackoverflow.com/q/20949071
tags question: http://stackoverflow.com/q/20915372
tags question: http://stackoverflow.com/q/20921083
tags question: http://stackoverflow.com/q/20976813
tags question: http://stackoverflow.com/q/21001356
tags question: http://stackoverflow.com/q/20953461
tags question: http://stackoverflow.com/q/20908675
tags question: http://stackoverflow.com/q/20952863
tags question: http://stackoverflow.com/q/20982394
tags question: http://stackoverflow.com/q/20995036
tags question: http://stackoverflow.com/q/20905171
tags question: http://stackoverflow.com/q/20934817
tags question: http://stackoverflow.com/q/20962911
tags question: http://stackoverflow.com/q/20889627
tags question: http://stackoverflow.com/q/21000422
tags question: http://stackoverflow.com/q/20954416
tags question: http://stackoverflow.com/q/20875585
tags question: http://stackoverflow.com/q/20874209
tags question: http://stackoverflow.com/q/20882815
tags question: http://stackoverflow.com/q/20986656
tags question: http://stackoverflow.com/q/20995715
tags question: http://stackoverflow.com/q/20871864
tags question: http://stackoverflow.com/q/20871700
tags question: http://stackoverflow.com/q/20974701
tags question: http://stackoverflow.com/q/20973373
tags question: http://stackoverflow.com/q/20998371

http://stackoverflow.com/a/20913473
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/20913395
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20913395
type: Answer
has body: Not Java, but HTML problem. You're missing ... : <% ... while(rs.next()) { description = rs.getString("description"); out.print(" " + description + " "); ... %>

http://stackoverflow.com/a/20989453
has comment: http://stackoverflow.com/comment/31539871
type: AcceptedAnswer
type: Answer
has body: BorderFactory.createLineBorder(Color color) is a static method, get rid of new and the method will be resolved. Reference: BorderFactory.createLineBorder(java.awt.Color)
accepted answer of: http://stackoverflow.com/q/20988627
answers question: http://stackoverflow.com/q/20988627
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/31539729
score: 4

http://stackoverflow.com/q/20973664
upvote count: 2
has title: Java check style : Final Parameter reference variable assignment
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20973700
has body: I am working on resolving Checkstyle warnings in a Java project. Suppose this is the method i have: public SomeObject someObjectBehavior(SomeObject oldSomeObject, SomeObject newSomeObject) { if(oldSomeObject == null) { oldSomeObject = newSomeObject; } } When I enable the Checkstyle, it notifies Parameter oldSomeObject should be final Parameter newSomeObject should be final When I convert both the parameters like this: public SomeObject someObjectBehavior(final SomeObject oldSomeObject, final SomeObject newSomeObject) { if(oldSomeObject == null) { oldSomeObject = newSomeObject; //Assignment operation } } So, now assignment operation is not possible, there is a error in Java code The final local variable oldSomeObject cannot be assigned. It must be blank and not using a compound assignment. If any one of you have faced this, so please help, as I am trying to resolve all the Checkstyle issues. Thank You Regards Ankur Sharma
answer count: 4
has comment: http://stackoverflow.com/comment/31529615
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/51275133
type: Question
has answer: http://stackoverflow.com/a/20973778
has comment: http://stackoverflow.com/comment/32922877
has comment: http://stackoverflow.com/comment/34225243
has answer: http://stackoverflow.com/a/20973886
downvote count: 0
favorite count: 0
tagged with: checkstyle

http://stackoverflow.com/a/20935268
accepted answer of: http://stackoverflow.com/q/20931057
has body: Resolved the ProbleBy Just Adding One more Variable and Calling the ClearRect() at the Start of painting and to ensure that This will be Called only once , by the Help of Newly Added Variable. public void init(){ setBackground(Color.black); clearCounter = 0; Timer t = new Timer(1000, this); t.start(); check = 0; &lt;------------ New Variable } public void paint(Graphics g) { if (check==0){ g.clearRect(0, 0, 500, 400); &lt;------------ To Ensure That it will Excute Only Once , beacuse check is incremented later in Code } clearCounter++; check++; Graphics2D g2 = (Graphics2D) g; if (clearCounter == 5){ g2.clearRect(0, 0, 500, 400); clearCounter=0; } for (int i = 1; i &lt;= 40; i++) { Color c = chooseColor(); g2.setColor(c); Font f = chooseFont(); g2.setFont(f); drawJava(g2); } }
score: 1
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/20931057

http://stackoverflow.com/q/20862869
answer count: 1
has body: I have the following scenario: The program can find the file and can read the first line (-120) (from arenas_be1.txt) The program can add 1 to -120 and write it into f1.txt Nothing happens then, the method will be called one second later with the same numbers (-120) and (-120+1) I think that the problem is that the main-file cant be deleted, but why? public void defaultGameStart() { this.getServer().getScheduler() .scheduleSyncRepeatingTask(this, new Runnable() { public void run() { setCountdownLess(); } }, 20, 20); } public void setCountdownLess() { File zuÄnderndeDatei = new File("plugins/DB/join_signs.txt"); try { BufferedReader reader = new BufferedReader(new FileReader( zuÄnderndeDatei)); String line; while ((line = reader.readLine()) != null) { String[] spLine = line.split(";"); if (spLine[2].startsWith("BE")) { File zuÄnderndeDatei11 = new File("plugins/DB/arenas/arenas_"+spLine[2].toLowerCase()+".txt"); File buffer = new File("plugins/DB/arenas/f1.txt"); try { BufferedReader reader1 = new BufferedReader(new FileReader( zuÄnderndeDatei11)); BufferedWriter writer = new BufferedWriter(new FileWriter(buffer)); String line1; System.out.println("-&gt; "+spLine[2]); line1 = reader1.readLine(); System.out.println("-&gt; "+line1); writer.write((Integer.parseInt(line1) + 1)+""); writer.write(System.getProperty("line.separator")); countDownToStart((Integer.parseInt(line1) + 1), spLine[2]); System.out.println("-&gt; "+(Integer.parseInt(line1) + 1)); reader1.close(); writer.flush(); writer.close(); zuÄnderndeDatei11.setWritable(true); if (zuÄnderndeDatei11.delete()) { buffer.renameTo(zuÄnderndeDatei11); } } catch (Exception e) { System.out .println("Fehler beim Anpassen der Template-Datei&lt;&gt;setcountdownless"); e.printStackTrace(); } } } reader.close(); } catch (Exception e) { e.printStackTrace(); } } By the way, this is a Bukkit plugin.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31301410
tagged with: file
has comment: http://stackoverflow.com/comment/31301592
has title: File cannot be deleted and renamed
downvote count: 0
score: 1
tagged with: java
type: Question
upvote count: 1
has comment: http://stackoverflow.com/comment/31301132
favorite count: 0
has answer: http://stackoverflow.com/a/21070066
has comment: http://stackoverflow.com/comment/31303633
tagged with: delete-file

http://stackoverflow.com/q/20971439
has answer: http://stackoverflow.com/a/20971746
type: AnsweredQuestion
upvote count: 1
type: Question
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/20971746
answer count: 2
tagged with: api
possible better answer: http://stackoverflow.com/a/20976362
downvote count: 0
has answer: http://stackoverflow.com/a/20976362
has body: I'm currently building an app towards an API. Whenever I want to gather a list of objects from the API, the following lifecycle applies: Start activity Invoke GET request on BASE_URI/objects Fill in the objects in a ListView The activities are built up from the same components: ArrayAdapter, ProgressBar, an asynchronous task etc. The only things that may differ is the activity that gets called when I click on an object in the list, because the objects sometimes have different properties, I want to display them with a different style. Now I'm wondering: Is it possible to make a generic activity repository? Such as... public ActivityStore&lt;T&gt; extends ListActivity { ... } where I pass nothing but the API path and the reference type of the objects to deserialize?
favorite count: 0
tagged with: android
has title: Generic activities for different objects
tagged with: android-activity
tagged with: generics

http://stackoverflow.com/q/20977488
downvote count: 1
favorite count: 0
tagged with: arraylist
score: 0
answer count: 3
tagged with: file-io
upvote count: 1
tagged with: regex
has title: Read file, replace a word and write to a new file in Java
has answer: http://stackoverflow.com/a/20977717
accepted answer: http://stackoverflow.com/a/20977717
has answer: http://stackoverflow.com/a/20977728
has body: I am trying to read a text file which I then put into an ArrayList and then go through that ArrayList and replace any occurrences of the word "this" with "**". I then want to put this modified ArrayList back into a new file with the newly edited text. The applications currently reads the lines into the ArrayList correctly and writing to the new file works. However, replaceWords method doesn't appear to be functioning as expected i.e. this is not being replaced by **. Any help would be greatly appreciated! package com.assignment2s162305.answers; import java.io.FileWriter; import java.io.IOException; import java.io.BufferedReader; import java.io.FileReader; import java.util.ArrayList; import java.util.List; import java.util.Collections; public class Question27 { private List&lt;String&gt; lines = new ArrayList&lt;String&gt;(); // read original file to an ArrayList public String[] readOriginalFile(String filename) throws IOException { FileReader fileReader = new FileReader(filename); BufferedReader bufferedReader = new BufferedReader(fileReader); String line = null; while ((line = bufferedReader.readLine()) != null) { lines.add(line); } bufferedReader.close(); return lines.toArray(new String[lines.size()]); } // replace words with **** public void replaceWords() { Collections.replaceAll(lines, "this", "****"); System.out.println(lines); } // write modified ArrayList to a new file public void writeToNewFile() throws IOException { FileWriter writer = new FileWriter("output.txt"); for (String str : lines) { writer.write(str); } writer.close(); } } package com.assignment2s162305.answers; import java.io.IOException; public class Question27Test { public static void main(String[] args) { Question27 question27object = new Question27(); String filename = "Hamlet2.txt"; try { String[] lines = question27object.readOriginalFile(filename); System.out.println("______ORIGINAL DOCUMENT______\n"); for (String line : lines) { System.out.println(line); } System.out.println("\n\n"); quest…
has answer: http://stackoverflow.com/a/20977727
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/20977727
type: Question

http://stackoverflow.com/q/20862143
has comment: http://stackoverflow.com/comment/31299668
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31300414
favorite count: 0
has comment: http://stackoverflow.com/comment/31299465
tagged with: encryption
tagged with: android
has answer: http://stackoverflow.com/a/20862674
has body: I am creating an APP and need to encript only the content of an image. I need that the file was still an image after conversion, but the image showed does not show as the original. For example, I will send the image encrypted to other user and this one will be able to show and image (but not the original), but the original image was encrypted in that file. With the following algorythm I encrypted the entire file, and this cannot be opened as image due the header is encrypted as well. I am using this algorythm but I do not know how to only encrypt data or how to add/modify the headers of an image in java/android: public byte[] encrypt_image(Bitmap bm, String password_) { byte[] encryptedData = null; try{ ByteArrayOutputStream baos = new ByteArrayOutputStream(); bm.compress(Bitmap.CompressFormat.PNG, 100, baos); byte[] b = baos.toByteArray(); byte[] keyStart = password_.getBytes(); KeyGenerator kgen = KeyGenerator.getInstance("AES"); SecureRandom sr = SecureRandom.getInstance("SHA1PRNG", "Crypto"); sr.setSeed(keyStart); kgen.init(128, sr); SecretKey skey = kgen.generateKey(); byte[] key = skey.getEncoded(); // Encrypt encryptedData = Security.encrypt(key,b); }catch (Exception e) { Log.e("encrpyt_image()", e.getMessage()); } return encryptedData; } Anyone has an idea about how to codify that, I've been searching in internet with no success.
has comment: http://stackoverflow.com/comment/31299691
has title: Encrypt only the content of an image file not entire file
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/55903967
score: 1
tagged with: java
tagged with: bit-manipulation
upvote count: 1
has comment: http://stackoverflow.com/comment/31300852
type: Question
has comment: http://stackoverflow.com/comment/31299724
accepted answer: http://stackoverflow.com/a/20862674
has comment: http://stackoverflow.com/comment/31299746
has comment: http://stackoverflow.com/comment/31299726
has comment: http://stackoverflow.com/comment/55898703
tagged with: security
has comment: http://stackoverflow.com/comment/31300411

http://stackoverflow.com/q/20952863
type: Question
has body: I have a GUI(JFrame), with two Buttons and 1 Panel to show the result. One Button is to start the algorithm, one for stopping it. By pressing start, a method is called and it starts running. The runtime of this method varies from couple of seconds to 2-3 minutes, depending on the input. The problem I have hereby is, by pressing the start-button, the GUI gets completely locked. I cannot press any button till the algorithm terminates. It would be great to be able to stop the algorithm and to visualize parts of the solution after a certain amound of time. I checked every single line of the Frame, there is nothing that disables it. //If needed I can provide code, but its pretty long and just some hints and reasons for the problem would be great and I try to fix it by myself. thanks in advance.
answer count: 2
has answer: http://stackoverflow.com/a/20952953
score: 0
has title: JFrame gets locked completely while method is running
tagged with: jframe
possible better answer: http://stackoverflow.com/a/20952953
tagged with: multithreading
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20952895
accepted answer: http://stackoverflow.com/a/20952895

http://stackoverflow.com/comment/31574443
score: 0
comment on: http://stackoverflow.com/q/21006155
has text: You have it back to front. It iterates through the truststore to find *trusted* certificates; sends those `subjectDNs` to the server as trusted CAs in the first message of the SSL handshake; the server sends back a certificate that is supposed to be signed by one of those CAs; then the client checks that in the keystore. There's no question of 'picking the right certificate for the server', unless you're still talking about client authentication.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20888313
has comment: http://stackoverflow.com/comment/31391483
has comment: http://stackoverflow.com/comment/31394399
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31394692
upvote count: 2
has body: but this variable should be modified by the user using a JFrame that pops out when this method is called before it's returned An application should only have a single main JFrame (see: The Use of Multiple JFrames: Good or Bad Practice?). Child windows should be a model JDialog. Then when show the dialog, the code after the setVisible() statement will not execute until the dialog is close. You can create you own custom JDialog or it may be easier to use a JOptionPane. See the section from the Swing tutorial on How to Make Dialogs for more information and examples.
type: Answer
accepted answer of: http://stackoverflow.com/q/20888205
score: 2
answers question: http://stackoverflow.com/q/20888205

http://stackoverflow.com/q/20928699
score: 0
tagged with: user-interface
answer count: 1
has comment: http://stackoverflow.com/comment/31425563
has comment: http://stackoverflow.com/comment/31425319
has answer: http://stackoverflow.com/a/20928793
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31425288
tagged with: swing
type: Question
tagged with: java
has body: For a school project, I created the following program: BlckJckUI.java import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; public class BlckJckUI { public static void main(String args[]) { JFrame GUI = new JFrame("Blackjack Advisor"); GUI.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GUI.setSize(800,800); GUI.setVisible(true); ImageIcon Ace = new ImageIcon("C:\\Users\\Hieu Vo\\workspace\\Deck-2014-01-03\\Deck\\Ace.jpg"); JButton ace = new JButton(Ace); ace.setSize(300, 100); ace.setLocation(100, 100); ace.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Arrays array = new Arrays(); Math math = new Math(); if (array.playerhandtotal &lt;= 21) { math.cardvalue = 11; } else { math.cardvalue = 1; } array.clicktracker++; JOptionPane.showMessageDialog(null,array.result); } }); GUI.add(ace); ImageIcon Two = new ImageIcon("C:\\Users\\Hieu Vo\\workspace\\Deck-2014-01-03\\Deck\\2.jpg"); JButton two = new JButton(Two); two.setSize(300, 100); two.setLocation(100, 200); two.addActionListener(new ActionListener () { public void actionPerformed(ActionEvent e) { Arrays array = new Arrays(); Math math = new Math(); math.cardvalue = 2; array.clicktracker++; JOptionPane.showMessageDialog(null,array.result); } }); GUI.add(two); ImageIcon Three = new ImageIcon("C:\\Users\\Hieu Vo\\workspace\\Deck-2014-01-03\\Deck\\3.jpg"); JButton three = new JButton(Three); three.setSize(300, 100); three.setLocation(100, 300); three.addActionListener(new ActionListener () { public void actionPerformed(ActionEvent e) { Arrays array = new Arrays(); Math math = new Math(); math.cardvalue = 3; array.clicktracker++; ; JOptionPane.showMessageDialog(null,array.result); } }); GUI.add(three); ImageIcon Four = new ImageIcon("C:\\Users\\Hieu Vo\\workspace\\Deck-2014-01-03\\Deck\\4.jpg"); JButton four = new JButton(Four); four.setSize(300, 100); four.setLocation(100, 400); four.addActionListener(new ActionListener () { public void acti…
has title: Black Jack Java Project

deserialization
type: Tag
tags question: http://stackoverflow.com/q/20966204
tag name: deserialization
tags question: http://stackoverflow.com/q/20965658

http://stackoverflow.com/comment/31499080
type: QuestionComment
has text: It should delegate to the default servlet which renders the JSP. It could be a JBoss specific thing that it doesn't work, works like a charm with Tomcat or Jetty.
comment on: http://stackoverflow.com/q/20967397
score: 0
type: Comment

http://stackoverflow.com/comment/31498176
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20854585
has text: @Jason Spring Boot creates the datasource automatically based on the property names. There is no need to define the datasource manually.
score: 0

http://stackoverflow.com/a/20887754
has body: Java doesn't allow you to write statements outside of constructor or methods. Move your line to cinstructor or any method you want. Timer timer= new Timer(); //declaration allows timer.schedule(); // not allowed. Only declarations allows outside of methods and constructor. As a side note, there is static blocks which allows you to do the same, I don't think you need that. I strongly believe you are going to write that in constructor as when Road is constructing you are scheduling timer.
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/20887721
type: Answer
upvote count: 4

http://stackoverflow.com/comment/31430669
score: 2
comment on: http://stackoverflow.com/q/20931619
type: Comment
type: QuestionComment
has text: You write a helper method.

search-engine
type: Tag
tag name: search-engine
tags question: http://stackoverflow.com/q/21001618
tags question: http://stackoverflow.com/q/20889256

http://stackoverflow.com/q/21000777
linked to: http://stackoverflow.com/q/16882768
tagged with: java
has comment: http://stackoverflow.com/comment/31560327
has comment: http://stackoverflow.com/comment/31562532
type: Question
has title: Tomcat server failure error
has comment: http://stackoverflow.com/comment/31588986
has comment: http://stackoverflow.com/comment/31560393
has comment: http://stackoverflow.com/comment/31561048
has comment: http://stackoverflow.com/comment/31561685
tagged with: struts2
score: 0
has comment: http://stackoverflow.com/comment/31560458
linked to: http://stackoverflow.com/q/21016585
tagged with: tomcat
has comment: http://stackoverflow.com/comment/31559727
has body: Hi I am trying to learn Struts ans Tomcat with java ans every tutorial exemple is crashing. I have not found anything yet and I am searching for two days the solution. It says: Infos: Parsing configuration file [struts-default.xml] janv. 08, 2014 5:01:08 PM com.opensymphony.xwork2.config.providers.XmlConfigurat ionProvider info Infos: Parsing configuration file [struts-plugin.xml] janv. 08, 2014 5:01:08 PM org.apache.struts2.dispatcher.Dispatcher error Grave: Dispatcher initialization failed Unable to load configuration. - bean - jar:file:/K:/StefanOprean/sop/java/code/. metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Events/WEB-INF/lib /struts2-gxp-plugin-2.3.16.jar!/struts-plugin.xml:8:162 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(Configu rationManager.java:70) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatche r.java:445) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:489) at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperation s.java:74) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(S trutsPrepareAndExecuteFilter.java:57) at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilte rConfig.java:281) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilter Config.java:262) at org.apache.catalina.core.ApplicationFilterConfig.&lt;init&gt;(ApplicationFilterCon fig.java:107) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:47 75) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java: 5452) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:15 59) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:15 49) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorke…
has comment: http://stackoverflow.com/comment/31560672
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31559772
has comment: http://stackoverflow.com/comment/31560242
has comment: http://stackoverflow.com/comment/31560752
answer count: 0

http://stackoverflow.com/comment/31428869
type: AnswerComment
comment on: http://stackoverflow.com/a/20930539
type: Comment
score: 1
has text: @MenoHochschild : agreed

http://stackoverflow.com/comment/31469189
type: AnswerComment
comment on: http://stackoverflow.com/a/20914457
has text: I like your idea, but is there a way I can also get the server type?, like: localhost via TCP/IP ?
score: 0
type: Comment

http://stackoverflow.com/q/20929933
type: UnansweredQuestion
has title: How to access JSF templates, classes of one maven module from another maven module
score: 1
favorite count: 0
has body: I have a Maven project which consists of 2 Maven modules. One module has some common UI functionality which the Other module can reuse. The common UI module has its own classes,dependencies,JSF templates and organized as per maven webapp structure. It doesn't work if we add the common module in the dependency of calling module. How can we call the Templates and related classes from the Other maven module?
type: Question
tagged with: web-applications
tagged with: maven
answer count: 1
tagged with: jsf
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/20932562
downvote count: 0

http://stackoverflow.com/a/20869938
has body: double number = 0; number = Integer.parseInt(in.nextLine()); if (number &lt;= 0); The ";" at the end of if statement is the end of it. You are not doing anything with the result of number &lt;=0. I believe you meant it to be like: if (number &lt;= 0){ //operations…. } Notice that you create number of type double, then assign an int (parsed from String) to it. You can use nextDouble method to get a double directly, and if you plan this number to be an Integer anyway then use type int instead of double and nextInt instead of parsing. For more information about parsing from input, check Scanner documentation.
upvote count: 4
downvote count: 0
score: 4
type: Answer
answers question: http://stackoverflow.com/q/20869885

http://stackoverflow.com/comment/31517321
comment on: http://stackoverflow.com/a/20977599
type: Comment
type: AnswerComment
score: 1
has text: Why is your answer littered with ` `? Just start a new line in the editor if you want a new line. And place your code in a code block. See the [editing help](http://stackoverflow.com/editing-help) for more info.

http://stackoverflow.com/comment/31588750
comment on: http://stackoverflow.com/q/21016294
score: 0
type: QuestionComment
has text: maybee you can creat event objects with a date and a number and make a String,Object hashmap?
type: Comment

http://stackoverflow.com/q/20999003
has comment: http://stackoverflow.com/comment/31561992
type: AnsweredQuestion
has body: Assuming the following action class. @Namespace("/admin_side") @ResultPath("/WEB-INF/content") @ParentPackage(value="struts-default") public final class TestAction extends ActionSupport implements Serializable, ValidationAware, Preparable { private Long currentPage=1L; //This method is called on page load. //Validation is skipped, location is set to a valid action, not "redirectAction", the request is dispatched. //It is mapped to an action of &lt;s:form&gt;. public String load() throws Exception { //Nothing to see here. Leave it empty. return ActionSupport.SUCCESS; } //Assuming necessary validators and action whose result type is set to "redirectAction". //It is mapped to an action of &lt;s:submit&gt;. public String insert() { //Do something to either add or update data in a model based on a conditional check. return ActionSupport.SUCCESS; } //Assuming necessary validators and action whose loction is set to a valid action. not "redirectAction". //The request is dispatched/forwarded. //It is mapped to an action of &lt;s:a&gt;. public String edit() { //Nothing to see here. Leave it empty. return ActionSupport.SUCCESS; } //Assuming necessary validators and action whose result type is set to "redirectAction". //It is mapped to an action of &lt;s:submit&gt;. public String delete() { //Do something to delete data from a model. return ActionSupport.SUCCESS; } @Override public void prepare() throws Exception { list= service.getList((int)(currentPage-1)*pageSize, pageSize); } } I have excuded annotations and other things to avoid code noise. The actions mapped to these methods use the paramsPrepareParamsStack interceptor. Here, when an action associated with the insert() method, for example is triggered (it done by &lt;s:submit&gt;), the result will be redirect action. Accordingly, a new instance of the action class will be created which causes the load() method to be executed which in turn causes the prepare() method to be executed once again. The same thing will happen wh…
accepted answer: http://stackoverflow.com/a/21363436
type: Question
has comment: http://stackoverflow.com/comment/31560732
tagged with: java
score: 4
tagged with: struts2
upvote count: 4
tagged with: struts2-interceptors
tagged with: validation
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21363436
has title: Performing CRUD operations in an action class along with the prepare() method in Struts2
tagged with: crud

http://stackoverflow.com/comment/31381965
has text: Yes that does, looks like a much clearer way of reading the file than what I was doing, thanks very much. So, for example if you needed to access country code in a separate class, is there a way of going about that?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20905551
type: Comment

http://stackoverflow.com/q/20953943
answer count: 1
favorite count: 0
type: UnansweredQuestion
has body: List&lt;List&lt;String&gt;&gt; titleID = null; List&lt;String&gt; child = null; String name = ""; int j = 0; for (int i = 0; i &lt; ArraylistClass.indexAllEntrySearch.size(); i++) { if (child == null) { child = new ArrayList&lt;String&gt;(); } if (titleID == null) { titleID = new ArrayList&lt;List&lt;String&gt;&gt;(); } if (!ArraylistClass.indexAllEntrySearch.get(i) .startsWith(" ")) { name = ArraylistClass.indexAllEntrySearch.get(i).toString(); if (!child.isEmpty()) { titleID.add(j, child); j++; Log.v("startsWith ", child.toString()); Log.v(" !! startsWith ", titleID.toString()); child.clear(); child = null; } } else { child.add(ArraylistClass.indexAllEntrySearch.get(i) .toString()); } } Log.v(" !! startsWith ", titleID.toString()); it shows result.. 01-06 10:58:44.726: V/!! startsWith(7079): [[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [ Pain Assessment, Heart Failure, Heart Failure, Alternative Strong Opioids, Analgesic Prescribing, Opioid side effects &amp; toxicity, Pain Assessment, Heart Failure, Breakthrough pain, Analgesic Prescribing, Heart Failure]] previous item becomes empty..why...? //*************// My Arraylist is public static ArrayList indexAllEntrySearch = new ArrayList(); and items are [5 HT-3 antagonists, Nausea &amp; Vomiting, Acetaminophen. See Paracetamol, Acetylcholinesterase inhibitors, Delirium &amp; Confusion, Action plan, Referral to Hospital, Acupuncture, Nausea &amp; Vomiting, Pruritus (Itching), Sweats &amp; Hot Flushes, Multiple Sclerosis, Other Pain Interventions, Pruritus (Itching), Acute inflammatory episode (AIE), Lymphoedema, Adcortyl in Orabase, Oral problems (Overview), Adjuvant analgesics, Neuropathic pain, Analgesic Prescribing, Admission to hospital, Referral to Hospital, Adrenaline, Bleeding &amp; haemorrhage, Advance Decisions, Resuscitation Guidelines (DNAR's), Advance care planning, Parkinson's disease, Advance Directives, Mental Capacity, Advance care p…
upvote count: 0
tagged with: java
type: Question
score: -2
tagged with: arraylist
has title: Arraylist within Arraylist not working
downvote count: 2
has comment: http://stackoverflow.com/comment/31472892
has answer: http://stackoverflow.com/a/20954254
has comment: http://stackoverflow.com/comment/31472946

http://stackoverflow.com/comment/31445546
score: 0
has text: Yes. No. Yes. Bonus text.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20938976

http://stackoverflow.com/comment/31475952
type: Comment
has text: thanks for your kind reply with helpful code. 1.I want to know that is it really app issue because if net was slow? 2.Actually 6000 or more element will be loaded when page scroll down it is as per lazy loading feature.So I need to implement this loop.Do you want to say that if i not implement this loop and find the element it can find the element? Actually I am new on this so this may be some childish question.
comment on: http://stackoverflow.com/a/20955466
type: AnswerComment
score: 0

lock-free
tag name: lock-free
type: Tag
tags question: http://stackoverflow.com/q/20890554

http://stackoverflow.com/comment/49489078
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21004368
type: AnswerComment
has text: I had the same problem while scanning the file from webapp. it does not scan it from the workspace directory. it takes it from the Eclipse webapp

http://stackoverflow.com/a/21006100
answers question: http://stackoverflow.com/q/21006061
downvote count: 0
type: Answer
has body: You can do it like this public static class Person { public String name; public String[] friends; } public static void main(String[] args) { Person newPerson = new Person(); newPerson.name = "Max"; newPerson.friends = new String[] {"Tom", "Mike"}; }
score: 1
upvote count: 1

http://stackoverflow.com/comment/31325146
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20875441
type: Comment
has text: This wasn't my question. My question was about a backtracking algoritm. Without this algorithm, step (1) is not possible.

http://stackoverflow.com/comment/31412976
comment on: http://stackoverflow.com/q/20876046
type: Comment
type: QuestionComment
has text: Shouldn't `Permissions` and `Codebase` be in the main section rather than an individual section of their own? (i.e. move them up to `Manifest-Version` without a blank line preceding.)
score: 0

http://stackoverflow.com/a/20950351
has body: Put &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/&gt; &lt;uses-library android:name="com.google.android.maps"/&gt; in Manifest.xml
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20949052

http://stackoverflow.com/q/20940715
has comment: http://stackoverflow.com/comment/31448472
upvote count: 6
has comment: http://stackoverflow.com/comment/31448437
score: 6
has comment: http://stackoverflow.com/comment/31448937
tagged with: design-patterns
type: AnsweredQuestion
has body: How does Singleton behave when two threads call the "getInstance()" at the same time? What are the best practices to protect it?
tagged with: java
has answer: http://stackoverflow.com/a/20941510
has answer: http://stackoverflow.com/a/20940791
type: Question
has comment: http://stackoverflow.com/comment/54432825
has answer: http://stackoverflow.com/a/20940724
has answer: http://stackoverflow.com/a/20949431
accepted answer: http://stackoverflow.com/a/20940791
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/20940738
has answer: http://stackoverflow.com/a/20940738
answer count: 5
tagged with: singleton
linked to: http://stackoverflow.com/q/7855700
has title: How does Singleton behave when two threads call the "getInstance()" at the same time?
linked to: http://stackoverflow.com/q/70689

http://stackoverflow.com/comment/31481642
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20952364
has text: Clever, but ultimately less readable IMO. It makes the `if` condition look cleaner but then you're left looking around for anything that has mutated `stuff`. I could probably be convinced otherwise though.
score: 0

http://stackoverflow.com/comment/31422999
has text: I don't get your question but if you wrap your event in with `SwingUtilities.invokeLater()` then it's gonna to be executed when all other events were processed in the EDT. And your question title is not related to what you wrote
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20927618

http://stackoverflow.com/q/21007926
has comment: http://stackoverflow.com/comment/31573928
has comment: http://stackoverflow.com/comment/31574017
accepted answer: http://stackoverflow.com/a/21029393
tagged with: java
has comment: http://stackoverflow.com/comment/31573868
linked to: http://stackoverflow.com/q/7062954
type: Question
linked to: http://stackoverflow.com/q/20957621
answer count: 1
favorite count: 0
has title: grep command equivalent in Java
score: 0
has comment: http://stackoverflow.com/comment/31576100
tagged with: grep
has body: So, I have this question here, which has been answered. I'm looking to replicate the marked answer in Java. Is there any way I can do some/most/all of it in Java?
tagged with: regex
has answer: http://stackoverflow.com/a/21029393
has comment: http://stackoverflow.com/comment/31574256
has comment: http://stackoverflow.com/comment/31574352
upvote count: 2
downvote count: 2
linked to: http://stackoverflow.com/q/13592236
type: AnsweredQuestion

http://stackoverflow.com/q/20929248
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31426343
has answer: http://stackoverflow.com/a/20929274
tagged with: java
possible better answer: http://stackoverflow.com/a/20929261
has comment: http://stackoverflow.com/comment/31426457
type: Question
has title: Passing ArrayList<String[]> between activities
has answer: http://stackoverflow.com/a/20929261
has comment: http://stackoverflow.com/comment/31426380
tagged with: arraylist
score: 0
answer count: 3
tagged with: bundle
tagged with: android-activity
has comment: http://stackoverflow.com/comment/31426465
has comment: http://stackoverflow.com/comment/31426581
has answer: http://stackoverflow.com/a/20929423
accepted answer: http://stackoverflow.com/a/20929423
tagged with: android
has body: I am trying to pass an ArrayList&lt;String[]&gt; between two activities, but can't seem to figure out how to do it. I've tried putParcelable and cast the ArrayList&lt;String[] to a Parcelable but that gave me the error java.lang.ClassCastException: java.util.ArrayList cannot be cast to android.os.Parcelable. I've also tried putStringArrayList, but that didn't work either. Your input is appreciated! Main Activity Intent i = new Intent(context, NewChecklistActivity.class); i.putExtra("checklists", checklistsArray); Secondary Activity checklistsArray = (ArrayList&lt;String[]&gt;) getIntent().getSerializableExtra("checklists"); StackTrace 01-04 18:49:09.140: E/AndroidRuntime(2246): FATAL EXCEPTION: main 01-04 18:49:09.140: E/AndroidRuntime(2246): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.medusa.checkit/com.medusa.checkit.NewChecklistActivity}: java.lang.NullPointerException 01-04 18:49:09.140: E/AndroidRuntime(2246): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956) 01-04 18:49:09.140: E/AndroidRuntime(2246): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981) 01-04 18:49:09.140: E/AndroidRuntime(2246): at android.app.ActivityThread.access$600(ActivityThread.java:123) 01-04 18:49:09.140: E/AndroidRuntime(2246): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147) 01-04 18:49:09.140: E/AndroidRuntime(2246): at android.os.Handler.dispatchMessage(Handler.java:99) 01-04 18:49:09.140: E/AndroidRuntime(2246): at android.os.Looper.loop(Looper.java:137) 01-04 18:49:09.140: E/AndroidRuntime(2246): at android.app.ActivityThread.main(ActivityThread.java:4424) 01-04 18:49:09.140: E/AndroidRuntime(2246): at java.lang.reflect.Method.invokeNative(Native Method) 01-04 18:49:09.140: E/AndroidRuntime(2246): at java.lang.reflect.Method.invoke(Method.java:511) 01-04 18:49:09.140: E/AndroidRuntime(2246): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 01-04…

http://stackoverflow.com/comment/31347002
comment on: http://stackoverflow.com/q/20887685
type: Comment
type: QuestionComment
has text: How big is `Ashish.txt`?
score: 2

http://stackoverflow.com/q/20899306
has title: Loading game onto Android with LibGDX throws NoClassDefFoundError: menu.StateManager
has comment: http://stackoverflow.com/comment/31370828
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31368891
has answer: http://stackoverflow.com/a/20917051
has answer: http://stackoverflow.com/a/20904469
upvote count: 1
downvote count: 1
tagged with: libgdx
has body: I am using LibGDX on Eclipse to build a game, but when I tried to run it on my Android device, it fails with the following error. 01-02 23:56:16.649: E/AndroidRuntime(26921): FATAL EXCEPTION: main 01-02 23:56:16.649: E/AndroidRuntime(26921): java.lang.NoClassDefFoundError: menu.StateManager 01-02 23:56:16.649: E/AndroidRuntime(26921): at com.androiddevice.Device.onCreate(Device.java:11) 01-02 23:56:16.649: E/AndroidRuntime(26921): at android.app.Activity.performCreate(Activity.java:5244) 01-02 23:56:16.649: E/AndroidRuntime(26921): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1082) 01-02 23:56:16.649: E/AndroidRuntime(26921): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2034) 01-02 23:56:16.649: E/AndroidRuntime(26921): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2095) 01-02 23:56:16.649: E/AndroidRuntime(26921): at android.app.ActivityThread.access$600(ActivityThread.java:135) 01-02 23:56:16.649: E/AndroidRuntime(26921): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1201) 01-02 23:56:16.649: E/AndroidRuntime(26921): at android.os.Handler.dispatchMessage(Handler.java:99) 01-02 23:56:16.649: E/AndroidRuntime(26921): at android.os.Looper.loop(Looper.java:137) 01-02 23:56:16.649: E/AndroidRuntime(26921): at android.app.ActivityThread.main(ActivityThread.java:4849) 01-02 23:56:16.649: E/AndroidRuntime(26921): at java.lang.reflect.Method.invokeNative(Native Method) 01-02 23:56:16.649: E/AndroidRuntime(26921): at java.lang.reflect.Method.invoke(Method.java:511) 01-02 23:56:16.649: E/AndroidRuntime(26921): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795) 01-02 23:56:16.649: E/AndroidRuntime(26921): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562) 01-02 23:56:16.649: E/AndroidRuntime(26921): at dalvik.system.NativeStart.main(Native Method) The Main project builds successfully as a standalone program, only this Android extensi…
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/31370493
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31370398
has comment: http://stackoverflow.com/comment/31372337
favorite count: 0
has comment: http://stackoverflow.com/comment/31372304
tagged with: exception
tagged with: android

android-gridview
type: Tag
tag name: android-gridview
tags question: http://stackoverflow.com/q/20921901

http://stackoverflow.com/q/21016447
has comment: http://stackoverflow.com/comment/31591289
answer count: 1
has comment: http://stackoverflow.com/comment/31589341
has comment: http://stackoverflow.com/comment/31589265
has answer: http://stackoverflow.com/a/21016529
has comment: http://stackoverflow.com/comment/31589076
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31591405
type: Question
has title: Servlets:java.lang.ClassNotFoundException: Welcome
tagged with: java
has comment: http://stackoverflow.com/comment/31588724
tagged with: servlets
has body: I am trying to make a simple Servlet Code.Initially it used to work fine but now posing a problem. kindly help index.html: Insert title here web.xml: <?xml version="1.0" encoding="UTF-8"?> 9-01-2014 index.html Welcome Welcome Welcome /welcome Welcom.java: import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class Welcome */ @WebServlet("/Welcome") public class Welcome extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public Welcome() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub PrintWriter out = response.getWriter(); out.println("Welcome"); } } Error Report: Jan 09, 2014 2:41:27 PM org.apache.catalina.core.AprLifecycleListener init INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files (x86)\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre7/bin/server;C:/Program Files/Java/jre7/bin;C:/Program Files/Java/jre7/lib/amd64;C:\Program Files\Java\jre7\bin;C:\Program Files (x86)\MySQL\MySQL Utilities 1.3.4\;C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin;D:\eclipse-jee-indigo-SR2-win32-x86_64\eclipse;;. Jan 09, 2014 2:41:28 PM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:9-01-2014' did not find a matching property. Jan…
score: 0

http://stackoverflow.com/a/20914381
downvote count: 0
type: Answer
upvote count: 1
has body: I would do something like this: Integer theint = is_integer(thestr) ? Integer.parseInt(thstr) : null; You cannot assign NULL to an intrinsic int but you can to an Integer object. Typically, of course, you'd simply rely on the parseInt() call throwing an exception rather than explicitly testing for integerness of the string beforehand.
score: 1
answers question: http://stackoverflow.com/q/20914293

http://stackoverflow.com/comment/31396911
score: 0
type: QuestionComment
has text: @SnakeDoc I just was hot swappable, which would discount just dropping in the Jars...Spent a lot of time writing a update process that could overcome this for our (very badly) written app - I'm just saying ;). Our solution is, stop, copy, start, which I assume is similar to what you are suggesting
type: Comment
comment on: http://stackoverflow.com/q/20913149

http://stackoverflow.com/comment/31332398
comment on: http://stackoverflow.com/q/20878456
type: QuestionComment
score: 0
has text: Henry agreed. Not getting the use.
type: Comment

http://stackoverflow.com/q/20964484
favorite count: 0
has body: In one of my Eclipses I got error when launching plugin as Eclipse application from plugin.xml Overview. No installed JREs satisfy this Execution Environment: "JavaSE-1.7". Launch aborted. Where "JavaSE-1.7" could come from? In MANIFEST.MF there is Bundle-RequiredExecutionEnvironment: JavaSE-1.6 In Eclipse Preferences Java -&gt; Installed JREs I have only jre6, and no other. Sources at https://github.com/Nodeclipse/nodeclipse-1/tree/master/org.nodeclipse.debug/
has answer: http://stackoverflow.com/a/20990546
has title: Eclipse plugin dev - No installed JREs satisfy this Execution Environment: "JavaSE-1.7". Launch aborted
type: AnsweredQuestion
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/20990546
type: Question
has comment: http://stackoverflow.com/comment/31494246
has comment: http://stackoverflow.com/comment/31496496
has comment: http://stackoverflow.com/comment/31494271
tagged with: eclipse
tagged with: eclipse-rcp
has comment: http://stackoverflow.com/comment/31494551
answer count: 1
downvote count: 0
score: 1
tagged with: eclipse-plugin

http://stackoverflow.com/a/23023330
downvote count: 0
type: Answer
score: 3
upvote count: 3
has body: I've faced the same problem when i've started to write unit tests for my project and had to deal with numerous of arrays, lists, integer inputs, strings etc. So I decided to use QuickCheck and create a generator util class. Using Generators in this library, you can generate primitive data types and String easily. For example, when you want to Generate an integer; simply use IntegerGenerator class.You can define maximum and minimum values in the constructor of the generator.You can also use CombinedGeneratorSamples class to generate data structures like lists, maps and arrays. Another feature of this library is implementing Generator interface for custom class generators.
answers question: http://stackoverflow.com/q/20966143

http://stackoverflow.com/comment/31339676
type: QuestionComment
has text: @MarkoTopolnik Thanks for the explanation. Subjective details aside, it sounds like we basically all agree here.
comment on: http://stackoverflow.com/q/20871763
score: 0
type: Comment

http://stackoverflow.com/q/20966566
type: Question
has body: I am new to lifI have installed liferay 6.2 with jboss-7.1.1 . I am able to login into liferay by localhost:8080 but not with IP address and port (basically its HTTPS e.g https://172.16.91.202:10000/) . I tried to debug and I came to know that liferay is not rendering the port . Hence after login , I am being redirected to a link with no port in it . The result is browser refuses to connect the server. I have attached the screenshot for help.
accepted answer: http://stackoverflow.com/a/20967505
score: 0
answer count: 1
tagged with: jboss7.x
tagged with: liferay-6
has answer: http://stackoverflow.com/a/20967505
has title: Not able to login in liferay 6.2 with IP address with port
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/31381926
type: Comment
comment on: http://stackoverflow.com/a/20873115
has text: each case is a different JVM :) so you either you profile your app or your maven build.
score: 0
type: AnswerComment

http://stackoverflow.com/q/20887406
has answer: http://stackoverflow.com/a/20893367
has comment: http://stackoverflow.com/comment/31347200
has title: Getting null error when running a simple JAX-RS app on Websphere Application Server 7
score: 2
has comment: http://stackoverflow.com/comment/31351035
has answer: http://stackoverflow.com/a/20888010
upvote count: 2
type: UnansweredQuestion
tagged with: java
type: Question
has body: I have no compilation errors and my app launches fine on my testing server. However, I get an error when trying a GET request: [1/2/14 10:23:13:248 EST] 00000022 RequestProces I org.apache.wink.server.internal.RequestProcessor logException The following error occurred during the invocation of the handlers chain: WebApplicationException (404 - Not Found) with message 'null' while processing GET request sent to http://localhost:9081/IDMWorkflowServices/resources/workflow Here is my web.xml: <?xml version="1.0" encoding="UTF-8"?> IDMWorkflowServices JAX-RS Tools Generated - Do not modify JAX-RS Servlet com.ibm.websphere.jaxrs.server.IBMRestServlet javax.ws.rs.core.Application com.psg.itim.workflow.WorkflowResourceApplication 1 JAX-RS Servlet /resources/* Here is WorkflowResource: import javax.ws.rs.GET; import javax.ws.rs.Produces; import javax.ws.rs.Path; // The Java class will be hosted at the URI path "/workflow" @Path("/workflow") public class WorkflowResource { @GET @Produces("text/plain") public String getClichedMessage() { // Return some cliched textual content return "Hello World"; } } Here is WorflowResourceApplication: import javax.ws.rs.core.Application; import java.util.HashSet; import java.util.Set; public class WorkflowResourceApplication extends Application{ @Override public Set<Class<?>> getClasses() { Set<Class<?>> classes = new HashSet<Class<?>>(); classes.add(WorkflowResource.class); return classes; } } If it's not painfully obvious, this is my first attempt using JAX-RS. I'm not exactly sure what I do or do not need from the above code to get this to work. It seems simple, but when I go to this url http://localhost:9081/IDMWorkflowServices/resources/workflow the 404 happens. Any ideas of what I am doing wrong?
tagged with: websphere-7
answer count: 2
downvote count: 0
tagged with: jax-rs
favorite count: 0

http://stackoverflow.com/comment/31453951
comment on: http://stackoverflow.com/a/20943438
has text: Yes. We have to do this entirely by our hand. Without using inbuilt api packages.. Thank You...
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31815275
comment on: http://stackoverflow.com/a/20922140
score: 0
type: AnswerComment
type: Comment
has text: Thanks for all the help everyone. I really like this answer; creating an override method for the click is a lot neater than placing it in onCreate.

http://stackoverflow.com/comment/31444058
score: 0
comment on: http://stackoverflow.com/q/20937409
type: QuestionComment
type: Comment
has text: Your `mergeSort_srt` is not O(n log n) because you take more time as O(n) for one merge pass. A typical implementation would use two arrays and merge from one into the other so that you don't have to move elements around.

jaxb2
tags question: http://stackoverflow.com/q/20940631
tags question: http://stackoverflow.com/q/20896645
tag name: jaxb2
type: Tag
tags question: http://stackoverflow.com/q/20899119

http://stackoverflow.com/comment/31569129
type: QuestionComment
has text: @MiserableVariable If you read my response to FoggyDay it seems to be some strange and annoying behavior of applications doing massive (8K) buffering on things that are not consoles. I guess they expect something thats not-a-console to be a file... Apparently fast "fast and constant rate of printing" still isn't good enough for 8K.
comment on: http://stackoverflow.com/q/21003632
score: 0
type: Comment

http://stackoverflow.com/a/52663539
score: 18
has comment: http://stackoverflow.com/comment/93730686
has comment: http://stackoverflow.com/comment/93768719
has comment: http://stackoverflow.com/comment/95358522
downvote count: 0
has comment: http://stackoverflow.com/comment/95640195
has body: We should definitely use Graphics2D if we want to have decent performance (~10x faster comparing to copying pixels directly): public static BufferedImage rotateClockwise90(BufferedImage src) { int width = src.getWidth(); int height = src.getHeight(); BufferedImage dest = new BufferedImage(height, width, src.getType()); Graphics2D graphics2D = dest.createGraphics(); graphics2D.translate((height - width) / 2, (height - width) / 2); graphics2D.rotate(Math.PI / 2, height / 2, width / 2); graphics2D.drawRenderedImage(src, null); return dest; }
has comment: http://stackoverflow.com/comment/95425006
upvote count: 18
type: Answer
has comment: http://stackoverflow.com/comment/106113011
has comment: http://stackoverflow.com/comment/95395746
answers question: http://stackoverflow.com/q/20959796

http://stackoverflow.com/comment/31372281
type: Comment
comment on: http://stackoverflow.com/a/20890090
has text: Why should i convert an int value to a string value and viceversa? The problem it's located here: while( i<a.length && search.equals(a[i].getCourseTitle()) ).How can i compare the string value of user input with the coursetitle var in the Exam object?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31449531
score: 1
has text: This is most likely a security feature to prevent apps from dialing codes that could harm the phone... I unfortunately wasn't able to find anything to confirm this though
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20939994

http://stackoverflow.com/q/20976422
tagged with: hyperlink
has comment: http://stackoverflow.com/comment/31515176
favorite count: 0
has comment: http://stackoverflow.com/comment/31518295
has comment: http://stackoverflow.com/comment/31546907
has title: Passing a valule to JSF Managed bean from h:dataTable results in the same value passed over
has comment: http://stackoverflow.com/comment/31517091
has comment: http://stackoverflow.com/comment/31515424
answer count: 0
type: UnansweredQuestion
has body: I went through similar questions asked here, but it did not solve the my problem. I have an object UserDetails whose attributes I display in h:dataTable;I also have a h:commandLink in each row that is used to deactivate user. When I click on 'Deactivate' link, I pass the userId in the UserDetails to the controller. class UserDetails { int userId; String userName; } My ManagedBean has the following code public String deactivateUser(int userId) { //Use the user id and do deactivate operation return "userpage"; } Here UserDetails is an array declared in controller. And this is the code in JSF page : &lt;h:dataTable width="100%" value="#{myController.userDetails}" var="userDetails"&gt; &lt;h:column&gt; &lt;f:facet name="header"&gt; userId &lt;/f:facet&gt; &lt;h:outputText value="#{userDetails.userId}" /&gt; &lt;/h:column&gt; &lt;h:column&gt; &lt;f:facet name="header"&gt; userName &lt;/f:facet&gt; &lt;h:outputText value="#{userDetails.userName}" /&gt; &lt;/h:column&gt; &lt;h:column&gt; &lt;f:facet name="header"&gt; Deactivate User &lt;/f:facet&gt; &lt;h:commandLink value="#{msg['link.edit']}" action="#{myController.deactivateuser(userDetails.userId)}" /&gt; | &lt;/h:column&gt; &lt;/h:dataTable&gt; The Problem : Imagine The following data is present in datatable userId Name 50 Taylor Deactivate 55 Anna Deactivate 59 Rock Deactivate 64 Hudson Deactivate 71 Batman Deactivate Now if I click on Deactivate link for 'Anna' , userId 71 is passed instead of 55. In short, the user Id at the end is passed whichever link is clicked. Why is this happening ? Am I missing something ?
score: 2
tagged with: facelets
downvote count: 0
tagged with: java
type: Question
upvote count: 2
tagged with: jsf-2

http://stackoverflow.com/comment/31277928
has text: I did not know that. :D .. Learnt something new today.. :P
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20850686
score: 0

http://stackoverflow.com/comment/31495921
comment on: http://stackoverflow.com/a/20918570
score: 0
type: Comment
has text: printing large contents makes the problem
type: AnswerComment

http://stackoverflow.com/comment/31492495
type: QuestionComment
has text: if your test1 will contain integer, why it is declared as String?
comment on: http://stackoverflow.com/q/20964127
score: 0
type: Comment

http://stackoverflow.com/comment/31583739
score: 1
has text: Ah yes - that's terminology I recognize (from years back ;))
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21012943

http://stackoverflow.com/a/20952757
score: 2
answers question: http://stackoverflow.com/q/20949437
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31470519
has body: The above piece of code is a bunch of crap. Unfortunately it is frequently used as a code snippet for Android related code (Android code uses the same API as Java, so there is no need for an Android specific example, andt unfortunately it specifically fails on Android). I'll explain the issues: Using a SecureRandom as Password Based Key Derivation Function (PBKDF) is completely idiotic. The underlying implementation of the SecureRandom implementation may change. Furthermore, it is not specified by the SecureRandom that calling setSeed() as the first method will replace the seed; it may actually add the seed to the current state - and this is what certain newer android versions do. Cipher.getInstance("AES") actually uses the provider defaults instead of specifying the mode of operation and padding mode for the given cipher. By default the Sun provider will use ECB mode which is not suitable for encrypting most data. String.getBytes() - which is used for the password - returns the platform default encoding. Different platforms may have different default encodings. This means that different platforms will generate different keys. Above code does not add a message authentication code (MAC or HMAC). This may lead to an attacker changing random ciphertext blocks, which leads to random plain text blocks. This may lead to loss of confidentiality as well if padding Oracle attacks apply. It seems to me that you are a beginner in cryptography. Please use a higher level standard such as RNCryptor compatible code, or use a standard such as Cryptographic Message Syntax (CMS).
upvote count: 2

http://stackoverflow.com/a/20927519
score: 2
upvote count: 2
has body: The simplest form is just // generic method to calculate an average of an Iterable/List of Double. public static double average(Iterable&lt;Double&gt; nums) { double sum = 0; for (double d : nums) sum += d; return sum / nums.size(); }
answers question: http://stackoverflow.com/q/20927374
type: Answer
downvote count: 0

http://stackoverflow.com/q/20993870
has title: most suitable OSGi platform?
upvote count: 5
has body: We are currently developing a new software for which we decided OSGi modularity would be quite useful, as the software itself can be pretty well decomposed into modular structure in order to avoid code mess in the future and be able to easily add new features and hook into existing ones. I have been playing with two (probably most popular) OSGi platforms, Eclipse Equinox (with Gemini Blueprint) and Apache Felix (with Aries). Basically I am now at the point of making a decision, which one we should use. We have pretty much experience with Spring, so we would like to continue using that, along with annotations (such as @Autowired for autowiring beans WITHIN the SAME bundle, @ServiceReference for autowiring across bundles), some particular Spring addons (such as Data JPA), Hibernate as a JPA provider (so far, we have experience only with Hibernate as an JPA implementation, it has all features we need so we want to avoid having to switch to something else), JMS messaging (with ActiveMQ client) and few other features. Later on, we also want to be able to implement our own security manager (to control access to certain bundles, based on e.g. their digital signatures, certificates with Permissions embedded in them) So far, I have been able to make two testing bundles (one was using a service from the other) and treat them as Spring Beans on Equinox with Gemini BP. However, I've had some problems with annotations, though (and I don't really like wiring beans in XMLs, especially with not so complicated architecture - most of them are Singletons). I've tried Aries as well (but not succeeded with enabling Spring there; probably just haven't spent enough time on that yet :) ). Which OSGi platform do you recommend for such use case?
answer count: 2
tagged with: jpa
downvote count: 0
has answer: http://stackoverflow.com/a/21013910
favorite count: 0
has answer: http://stackoverflow.com/a/20994643
tagged with: osgi
tagged with: spring
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
type: Question
score: 5

http://stackoverflow.com/a/20911628
answers question: http://stackoverflow.com/q/20911321
type: Answer
has comment: http://stackoverflow.com/comment/31392921
downvote count: 0
score: 1
has body: My educated guesstimate is that the problem is here: The_Post_Request_Write_Stream.write(TemporaryByteArray, CurrentPostByte, TemporaryByteArray.length); The parameters to write(byte[], int, int) are: a byte[] buffer which contains the data to be written an int offset that tells where in the buffer the data you want starts an int length which indicates how many bytes you want to write The problem lies in the value you pass to the offset parameter. It's CurrentPostByte, so in the second iteration you tell it to start reading TemporaryByteArray from index 1. However, TemporaryByteArray is always a one-element array, it only has one item int it at index 0. You should correct that to: The_Post_Request_Write_Stream.write(TemporaryByteArray, 0, TemporaryByteArray.length); Or, more simply, to: The_Post_Request_Write_Stream.write(TemporaryByteArray);
upvote count: 1

http://stackoverflow.com/q/20891198
has body: I am learning WSDL using online documentation, for WSDL Ports it is mentioned that: A port MUST NOT specify more than one address. A port MUST NOT specify any binding information other than address information. and the example given is: &lt;portType name="StockQuotePortType"&gt; &lt;operation name="GetLastTradePrice"&gt; &lt;input message="tns:GetLastTradePriceInput"/&gt; &lt;output message="tns:GetLastTradePriceOutput"/&gt; &lt;/operation&gt; &lt;/portType&gt; What is address in this example? also what it means that A port MUST NOT specify any binding information other than address information.? Please help me in understanding the concepts.
tagged with: wsdl
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
has title: Details on WSDL Ports
upvote count: 3
tagged with: java
tagged with: web-services
type: Question
score: 3
has answer: http://stackoverflow.com/a/20896599

http://stackoverflow.com/comment/31399465
type: AnswerComment
type: Comment
has text: Also, wouldn't I call alpha in toEnglish? just making sure..
comment on: http://stackoverflow.com/a/20914447
score: 0

http://stackoverflow.com/q/20980966
has answer: http://stackoverflow.com/a/20981049
tagged with: android
linked to: http://stackoverflow.com/q/15524221
type: UnansweredQuestion
has body: I'm new to this but I have some understanding. Currently I have an app that consists of lots of TextViews with a specific size , however i want to be able to implement a Button able change the TextView size of a TextView or all TextViews. Can I have some help please with this with examples of codes (I prefer java) Thank You!
has title: Using Button To Change TextView Size
has comment: http://stackoverflow.com/comment/31524662
tagged with: java
has comment: http://stackoverflow.com/comment/31533949
type: Question
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31523867

http://stackoverflow.com/a/20984612
answers question: http://stackoverflow.com/q/20880325
type: Answer
has body: I tried to reproduce the blocking http-get (also as an exercise for myself) but even without closing responses I could not get it to block. The ONLY time I managed to make the http-get block is by doing a response.getEntity().getContent() without reading from the returned InputStream and without closing the returned InputStream. For my tests I used Tomcat 7.0.47 with two very simple servlets (one responding "OK" to a get, the other echoing a post) as a server. The client started 50 threads with each thread performing 30 alternating http-get and http-post request (total of 1500 requests). The client did not use the RegistryBuilder, instead the default one is used (created by the PoolingHttpClientConnectionManager itself). About the NoConnectionReuseStrategy: by default (HttpClient created with HttpClients.createDefault(), I used org.apache.httpcomponents:httpclient:4.3.1) a connection pool is used with a maximum of 2 connections to 1 server. E.g. even if 5 threads are doing all kinds of requests at the same time to 1 server, the connection pool opens only 2 connections, re-uses them for all requests and ensures that 1 connection is used by 1 thread at any given time. This can have a very positive impact on client performance and significantly reduces load on the server. The only thing you must make sure is to call response.close() in a finally-block (this ensures the connection is returned to the connection pool). By using the NoConnectionReuseStrategy you basically disable the connection pool: for each request a new connection will be created. I recommend you enable debug-logging for category org.apache.http.impl.conn.PoolingHttpClientConnectionManager, it is very informative. A note about httpPut.releaseConnection(): this does not actually release a connection, it only ensures that you can re-use the "httpPut" object in a next request (see the apidocs, follow the shown link). Also note that in your code for the "httpGet", you call releaseConnection() on "httpPut" i…
upvote count: 4
downvote count: 0
score: 4

http://stackoverflow.com/q/20859684
type: Question
upvote count: 4
has title: difference between 2d array and hashmap
downvote count: 0
has body: I am relatively new to Java and I just want to make sure I get the basic concepts correctly. So my question is how is hashmap different to 2d array. I will illustrate an example and if someone could possibly correct me if I am wrong that would be great. So You cannot access/change the 1st array of the 2d array directly in contrast to hashmap. So for example if you have got arr[2][5] the first arr[2] you cannot change it to something else.In other words if we have int arr[2][2] you cannot change it to say arr[Cars][2] whereas with hashmap you can. You cannot even access this at all whereas with hashmap you can. If you have got map Martin, 25 you can possibly make this to Joe, 22 easily. You can search quite easily in hashmap on the first value. Say if you want to find the age of martin from the previous example you can easily search on Martin and the age 25 will appear. I have been taught that 2d arrays represent a table. Something like. arr[2][3] 1 [1 , 2 , 3] 2 [1 , 2 , 3] But in reality you cannot access/change 1 and 2 outside the [] grid. This should serve only as an imaginary help to illustrate the concept of 2d arrays. Could you please correct me if I am wrong or make any additional comments on that. Thank you
answer count: 2
has answer: http://stackoverflow.com/a/20859895
favorite count: 0
has answer: http://stackoverflow.com/a/20859781
score: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20859895
tagged with: java
possible better answer: http://stackoverflow.com/a/20859781

http://stackoverflow.com/a/21013737
answers question: http://stackoverflow.com/q/20956538
has body: You can dynamically add a new control to the existing layout, but make sure you call the layout() on the parent Composite, where you have set the layout. If you want to place a SWT control relative to another control, you can use org.eclipse.swt.layout.FormLayout.
score: 0
type: Answer

for-loop
tags question: http://stackoverflow.com/q/20953459
tags question: http://stackoverflow.com/q/20931207
tags question: http://stackoverflow.com/q/20928228
tags question: http://stackoverflow.com/q/20888571
tags question: http://stackoverflow.com/q/20949451
tags question: http://stackoverflow.com/q/20927873
tags question: http://stackoverflow.com/q/20905913
tags question: http://stackoverflow.com/q/20987097
tags question: http://stackoverflow.com/q/20933000
tag name: for-loop
tags question: http://stackoverflow.com/q/20911990
tags question: http://stackoverflow.com/q/21007762
tags question: http://stackoverflow.com/q/20988304
tags question: http://stackoverflow.com/q/20924149
tags question: http://stackoverflow.com/q/20896432
tags question: http://stackoverflow.com/q/20874285
type: Tag
tags question: http://stackoverflow.com/q/20998793

http://stackoverflow.com/q/20908771
tagged with: webview
upvote count: 1
has answer: http://stackoverflow.com/a/20908918
linked to: http://stackoverflow.com/q/19446510
score: 1
tagged with: java
tagged with: javafx
has body: Suppose I have loaded some HTML into WebView. And suppose this HTML contains some DIV element. Can I detemine geometric location of this DIV element after rendering? So that I can track if mouse point is over it or not. UPDATE Yes, the question is about external web pages of not mine. I want to make some thorough exploration of a page with Java. I have read that WebView is implemented with WebKit. Is it possible to access any WebKit internals from Java then? Also. Is it possible to download, say, jquery, in addition to already loaded page and call offset() function for it?
tagged with: dom
type: Question
answer count: 2
has title: Is it possible to detemine element location in WebView in JavaFX?
downvote count: 0
tagged with: webkit
favorite count: 0
has answer: http://stackoverflow.com/a/20908839
has comment: http://stackoverflow.com/comment/31482519
type: UnansweredQuestion

http://stackoverflow.com/q/20884521
tagged with: file
score: 6
has comment: http://stackoverflow.com/comment/31371283
type: Question
answer count: 8
has body: due to some reason i have to remove older file and create new file according to our client Date Modified is change to current time but Date Created is not change to current time. my code is as follows public static void main(String args[]) throws Exception { FileUtils.deleteQuietly(new File("d:\\inbox\\json\\test.txt")); FileWriter fileWriter = new FileWriter("d:\\inbox\\json\\test.txt", false); fileWriter.append(new Date().toString()); fileWriter.close(); } this code remove older data and write new data but why date created time is not changed.. please help me to figure out what's in wrong with my code. thanks in advance.
has answer: http://stackoverflow.com/a/21059633
has answer: http://stackoverflow.com/a/20982052
has comment: http://stackoverflow.com/comment/31586124
downvote count: 0
has answer: http://stackoverflow.com/a/20884567
favorite count: 0
has answer: http://stackoverflow.com/a/20964006
has answer: http://stackoverflow.com/a/20884554
has answer: http://stackoverflow.com/a/20884561
accepted answer: http://stackoverflow.com/a/21059633
possible better answer: http://stackoverflow.com/a/20994551
has comment: http://stackoverflow.com/comment/31341017
upvote count: 6
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20994551
has comment: http://stackoverflow.com/comment/31363820
has answer: http://stackoverflow.com/a/20884602
tagged with: java
has title: Date Created is not going to change while delete file and then create file

http://stackoverflow.com/q/20965256
upvote count: 1
has comment: http://stackoverflow.com/comment/31494523
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31494573
downvote count: 0
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/20965426
accepted answer: http://stackoverflow.com/a/20965426
tagged with: eclipse
has answer: http://stackoverflow.com/a/20965413
type: Question
has title: Tomcat 7 Server won't load class: ClassNotFoundException
answer count: 2
possible better answer: http://stackoverflow.com/a/20965413
tagged with: tomcat
has body: SEVERE: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Employee_12_30_AngularJS]] at java.util.concurrent.FutureTask.report(Unknown Source) at java.util.concurrent.FutureTask.get(Unknown Source) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask.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) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Employee_12_30_AngularJS]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) ... 6 more Caused by: java.lang.NoClassDefFoundError: net/sf/json/JSONException at java.lang.Class.getDeclaredFields0(Native Method) at java.lang.Class.privateGetDeclaredFields(Unknown Source) at java.lang.Class.getDeclaredFields(Unknown Source) at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:87) at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:261) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:140) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:67) at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:405) at org.apache.catalina.startup.Co…

http://stackoverflow.com/comment/31440741
score: 0
type: Comment
type: QuestionComment
has text: It gives me lowest to highest.
comment on: http://stackoverflow.com/q/20936818

http://stackoverflow.com/comment/31427414
comment on: http://stackoverflow.com/q/20929681
has text: I want to do it mostly as an option for a program that I am making. I want to give users the option to use one without the JRE bundled in it, but for users that do not know how to install the JRE, I want to give them the option to get it as a part of the program.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/31347996
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20887541
has text: Every time first element of users array is user1?

http://stackoverflow.com/a/20978613
answers question: http://stackoverflow.com/q/20978550
has comment: http://stackoverflow.com/comment/31519413
score: 0
type: Answer
has body: Put the MySQL JDBC driver JAR in the Tomcat server /lib directory, not your context WEB-INF/lib folder. You also have an extra space in the Resource name: &lt;Resource name="jdbc/ AccessoBD " auth="Container" Remove it and see if those help.

http://stackoverflow.com/q/20873004
has comment: http://stackoverflow.com/comment/31320965
has comment: http://stackoverflow.com/comment/31320479
score: 0
has comment: http://stackoverflow.com/comment/31320763
tagged with: android-asynctask
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31320632
has body: I am attempting to follow this tutorial: http://developer.android.com/training/displaying-bitmaps/process-bitmap.html and what I am trying to understand is how to actually load a bitmap using this class. I copied and pasted the code for the BitmapWorkerTask class, and it says to create a new task and execute it using this code: public void loadBitmap(int resId, ImageView imageView) { BitmapWorkerTask task = new BitmapWorkerTask(imageView); task.execute(resId); } I want to load a bitmap in a different java file and then set an imageview to that loaded bitmap, but I don't understand how I actually use the BitmapWorkerTask to actually do that. Activity where I want to load the bitmap: public class SecondTab extends Fragment { ImageView p1; ImageView p2; ImageView p3; ImageView p4; ImageView p5; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_secondtab, container, false); p1 = (ImageView) rootView.findViewById(R.id.p1); p2 = (ImageView) rootView.findViewById(R.id.p2); p3 = (ImageView) rootView.findViewById(R.id.p3); p4 = (ImageView) rootView.findViewById(R.id.p4); p5 = (ImageView) rootView.findViewById(R.id.p5); ; loadBitmap(R.drawable.plane1, p1); loadBitmap(R.drawable.plane2, p2); loadBitmap(R.drawable.plane3, p3); loadBitmap(R.drawable.plane4, p4); loadBitmap(R.drawable.plane5, p5); return rootView; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //To change body of overridden methods use File | Settings | File Templates. } public void loadBitmap(int resId, ImageView imageView) { BitmapWorkerTask task = new BitmapWorkerTask(imageView); task.execute(resId); } }
has comment: http://stackoverflow.com/comment/31320987
tagged with: android
has comment: http://stackoverflow.com/comment/31320371
tagged with: bitmap
has comment: http://stackoverflow.com/comment/31320903
has title: Loading bitmaps with async task and setting imageview
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31320531
has comment: http://stackoverflow.com/comment/31320726

http://stackoverflow.com/q/20915892
has answer: http://stackoverflow.com/a/20963732
tagged with: loops
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31401330
tagged with: while-loop
has comment: http://stackoverflow.com/comment/31401092
has title: While loop executing once before prompt
has comment: http://stackoverflow.com/comment/31401167
favorite count: 0
has answer: http://stackoverflow.com/a/20916125
has answer: http://stackoverflow.com/a/20915939
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20915954
tagged with: input
has answer: http://stackoverflow.com/a/20915917
score: 2
upvote count: 3
tagged with: java
has body: This was a difficult question to research, so please forgive me if this is a duplicate. Basically, I have a while loop that'll only break if a code the user scans is an integer. I check this by trying Integer.parseInt(integer) and only breaks the loop if a NumberFormatException isn't thrown. My problem, is that when the loop executes for the first time, the exception is thrown, without any user input. Here's my code: Scanner input = new Scanner(System.in); while (true) { System.out.print("Please scan barcode: "); int inCode = 0; try { inCode = Integer.parseInt(input.next()); } catch (NumberFormatException e) { System.out.println("Numbers only, please."); } if (inCode != 0) { // Do Stuff } else { System.out.println("Code can't be zero!"); } } What should happen, is this: Please scan barcode: // And here they enter the barcode But instead this happens: Please scan barcode: Numbers only, please. Please scan barcode: EDIT: As per Bohemian's answer, I added the continue keyword to my code. That solves the issue, but only halfway. As per the request of the people who put my question on hold (With good reason, as I now see) I'll post a SSCCE for you guys. I'm going to remove the methods for interfacing with the database, though, only keeping the path that has the problem: creating a new account based on the code. Scanner input = new Scanner(System.in); while (true) { System.out.print("Please scan barcode: "); int inCode = 0; try { inCode = Integer.parseInt(input.next()); } catch (NumberFormatException e) { System.out.println("Numbers only, please."); continue; } if (true) // Here it checks if an account associated with the code entered exists in the database. Because I'm having issues when it creates a new account, I've made this true. { System.out.println("No account associated with that code! Create one?"); System.out.print("(yes/no): "); String answer = input.next(); if (answer.equalsIgnoreCase("yes")) { System.out.println("Alright."); System.out.print("Please enter a n…

http://stackoverflow.com/comment/31473102
type: AnswerComment
score: 0
type: Comment
has text: In the `UserControl_Resize` event, put the following code: `ButtonPlay.Width = lowerPanel.Width / 2;` and `ButtonStop.Width = lowerPanel.Width / 2;`
comment on: http://stackoverflow.com/a/20953679

http://stackoverflow.com/comment/31321963
type: AnswerComment
has text: I agree and aware of this. I was just pointing out that similar things were the reason of introducing the switch with Strings statement.
type: Comment
comment on: http://stackoverflow.com/a/20863040
score: 0

http://stackoverflow.com/a/20941528
has body: By defaults an IDE will use a layout manager to position components on the frame. When you drag the panel you are manually setting the location of the panel and overriding the location determined by the layout manager. However, when you resize the frame the layout manager code is again executed and the panel is set back to its original position. You need to change your code so that the parent panel of the panel you drag uses a "null layout". However, when you do this you are now responsible for setting the size and location of the panel.
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/31478645
answers question: http://stackoverflow.com/q/20940913
accepted answer of: http://stackoverflow.com/q/20940913

http://stackoverflow.com/comment/31443097
has text: i mean its returning wrong value. for a key value there is 15 values but its returning 2, the number of keys
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20937969

http://stackoverflow.com/q/20858517
downvote count: 0
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/20858598
tagged with: android
has title: printing error for an empty input
has comment: http://stackoverflow.com/comment/31292047
type: AnsweredQuestion
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/20858598
has body: I am trying to do a calculator app for android where i take two inputs for 2 numbers and output the result along with the function it does(i.e. addition or subtraction...). public void Add(View view) { float a=0,b=0,res=0; EditText num1 = (EditText) findViewById(R.id.editText1); EditText num2 = (EditText) findViewById(R.id.editText2); TextView function = (TextView) findViewById(R.id.textView4); TextView ans = (TextView) findViewById(R.id.textView5); a=Float.parseFloat(num1.getText().toString()); b=Float.parseFloat(num2.getText().toString()); String str1 = Float.toString(a); String str2 = Float.toString(b); if(str1=="") { function.setText("Enter both Numbers"); ans.setText(""); return; } if(str2=="") { function.setText("Enter both Numbers"); ans.setText(""); return; } res=a+b; String str = Float.toString(res); function.setText("addition"); ans.setText(str); } so this is what i am doing. i take 2 inputs. convert them to float variables a and b. now my issue is if the user did not input an input and try for the solution, then i must produce some error saying 'enter both the numbers'. on doing it as above it's not working. nor does it works in this manner if(str1=='\0') { function.setText("Enter both Numbers"); ans.setText(""); return; } this produces error when the input is zero. So please help how to identify if there is no input given and to produce the error at that time.
possible better answer: http://stackoverflow.com/a/20858586
has comment: http://stackoverflow.com/comment/31291994
has answer: http://stackoverflow.com/a/20858586
answer count: 2

limit
tags question: http://stackoverflow.com/q/20972310
type: Tag
tag name: limit

http://stackoverflow.com/comment/72651367
score: 0
type: Comment
type: QuestionComment
has text: in your BroadcastReceiver onReceive methode you need a unregister like Activity.this.unregister(this)
comment on: http://stackoverflow.com/q/20986245

http://stackoverflow.com/a/21004845
has body: If it's truly a Java List (and not an Array), it should automatically relink the elements in the List when you remove an element. So in { A, B, C, D } if I call list.remove(C), the list should now look like { A, B, D }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21004775

http://stackoverflow.com/comment/31371764
type: Comment
comment on: http://stackoverflow.com/a/20900446
score: 1
has text: @azeemj. An empty string is `""`. I'm not exactly sure why the match includes index 6, perhaps someone else can elaborate on that.
type: AnswerComment

http://stackoverflow.com/a/20951805
upvote count: 1
has comment: http://stackoverflow.com/comment/31469223
has body: You can use a handler to solve this problem so that you don't block the main thread. I'm not sure if this is the ideal implementation though: private static final long INTERVAL = 3000;//3 seconds private Handler handler; protected void onCreate(Bundle b) { super(b); handler = new Handler(); //post an action to execute after an INTERVAL has elapsed. handler.postDelayed(new Runnable(){ public void run(){ //do your stuff doYourStuff(); //post the event again until a stopCondition is met. if(stopCondition==false){ handler.postDelayed(this,INTERVAL); } } },INTERVAL); }
has comment: http://stackoverflow.com/comment/31469916
has comment: http://stackoverflow.com/comment/31469313
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/20951359

http://stackoverflow.com/comment/31378524
type: QuestionComment
has text: The `contains` method looks for a character appearing anywhere in the string, so if you've typed "1a" then `.contains("1")` will return `true`. Is that what you want?
comment on: http://stackoverflow.com/q/20904588
score: 0
type: Comment

task
tags question: http://stackoverflow.com/q/20850881
type: Tag
tag name: task
tags question: http://stackoverflow.com/q/20986528
tags question: http://stackoverflow.com/q/20875009

http://stackoverflow.com/comment/31588212
type: Comment
has text: home.jsp is in WEB-INF/views/
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21016151

http://stackoverflow.com/comment/68531912
type: AnswerComment
type: Comment
has text: I know it's old but I also caught the same thing as 'dharam' did. The question was to calculate depth but solution provided returns the height, not depth.
comment on: http://stackoverflow.com/a/20916809
score: 0

string
tags question: http://stackoverflow.com/q/20874792
tags question: http://stackoverflow.com/q/20946950
tags question: http://stackoverflow.com/q/20978031
tags question: http://stackoverflow.com/q/21014891
tags question: http://stackoverflow.com/q/20890023
tags question: http://stackoverflow.com/q/20898805
tags question: http://stackoverflow.com/q/20999193
tags question: http://stackoverflow.com/q/20962615
tags question: http://stackoverflow.com/q/20957596
tags question: http://stackoverflow.com/q/20982283
tags question: http://stackoverflow.com/q/20952787
tags question: http://stackoverflow.com/q/20983834
tags question: http://stackoverflow.com/q/20915469
tags question: http://stackoverflow.com/q/20944724
tags question: http://stackoverflow.com/q/21000611
tags question: http://stackoverflow.com/q/20950105
tags question: http://stackoverflow.com/q/21012543
tags question: http://stackoverflow.com/q/20873177
tags question: http://stackoverflow.com/q/20943166
tags question: http://stackoverflow.com/q/20930511
tags question: http://stackoverflow.com/q/20999861
tags question: http://stackoverflow.com/q/20932247
tags question: http://stackoverflow.com/q/21007431
tags question: http://stackoverflow.com/q/20936818
tags question: http://stackoverflow.com/q/20897550
tags question: http://stackoverflow.com/q/20971381
tags question: http://stackoverflow.com/q/20864184
tags question: http://stackoverflow.com/q/20970088
tags question: http://stackoverflow.com/q/20874285
tags question: http://stackoverflow.com/q/20877366
tags question: http://stackoverflow.com/q/20977286
tags question: http://stackoverflow.com/q/20891551
tags question: http://stackoverflow.com/q/20859008
tags question: http://stackoverflow.com/q/20869779
tags question: http://stackoverflow.com/q/21002930
tags question: http://stackoverflow.com/q/20941650
tags question: http://stackoverflow.com/q/20877399
tags question: http://stackoverflow.com/q/21014051
tags question: http://stackoverflow.com/q/20948083
tags question: http://stackoverflow.com/q/20919856
tags question: http://stackoverflow.com/q/20879256
tags question: http://stackoverflow.com/q/20983658
tags question: http://stackoverflow.com/q/20860330
tags question: http://stackoverflow.com/q/20875578
tags question: http://stackoverflow.com/q/20872034
tags question: http://stackoverflow.com/q/20854665
tag name: string
tags question: http://stackoverflow.com/q/20956406
tags question: http://stackoverflow.com/q/20869748
tags question: http://stackoverflow.com/q/21004375
tags question: http://stackoverflow.com/q/20889310
tags question: http://stackoverflow.com/q/20979172
tags question: http://stackoverflow.com/q/20938874
tags question: http://stackoverflow.com/q/20863935
tags question: http://stackoverflow.com/q/20920448
tags question: http://stackoverflow.com/q/21010951
tags question: http://stackoverflow.com/q/20917623
type: Tag
tags question: http://stackoverflow.com/q/20945049
tags question: http://stackoverflow.com/q/20866676
tags question: http://stackoverflow.com/q/20958668
tags question: http://stackoverflow.com/q/20985719
tags question: http://stackoverflow.com/q/20880545
tags question: http://stackoverflow.com/q/20853198
tags question: http://stackoverflow.com/q/20904922
tags question: http://stackoverflow.com/q/20946008
tags question: http://stackoverflow.com/q/20879368
tags question: http://stackoverflow.com/q/20915478
tags question: http://stackoverflow.com/q/20944874
tags question: http://stackoverflow.com/q/20965360
tags question: http://stackoverflow.com/q/20914165
tags question: http://stackoverflow.com/q/21006718
tags question: http://stackoverflow.com/q/20961689
tags question: http://stackoverflow.com/q/20940567
tags question: http://stackoverflow.com/q/20864967
tags question: http://stackoverflow.com/q/20937225
tags question: http://stackoverflow.com/q/20933211
tags question: http://stackoverflow.com/q/20926561
tags question: http://stackoverflow.com/q/20852144
tags question: http://stackoverflow.com/q/20917616

http://stackoverflow.com/a/20889161
answers question: http://stackoverflow.com/q/20888975
type: Answer
has body: Look up the documentation of the AffineTransform class as well as any number of sources on Wolfram MathWorld or Wikipedia (e.g. http://mathworld.wolfram.com/RotationFormula.html). In Java, your sprite will probably be rendered in a rotated frame using the AffineTransform class, so if you apply your transformations carefully, you may not even have to do any extra math yourself to get the position of the trailing point.
score: 0

http://stackoverflow.com/comment/31506628
score: 0
type: Comment
has text: It seems he already tried all that... All his speech got lost in the code!
comment on: http://stackoverflow.com/a/20971881
type: AnswerComment

http://stackoverflow.com/q/20853856
has answer: http://stackoverflow.com/a/20853879
has answer: http://stackoverflow.com/a/20853920
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20853882
type: Question
has answer: http://stackoverflow.com/a/20853910
tagged with: java
has comment: http://stackoverflow.com/comment/31283054
has title: Java beginner- Can somebody debug my code?
has comment: http://stackoverflow.com/comment/31283018
downvote count: 4
has comment: http://stackoverflow.com/comment/31283604
upvote count: 0
answer count: 7
score: -4
favorite count: 0
has comment: http://stackoverflow.com/comment/31283009
has answer: http://stackoverflow.com/a/20853904
has answer: http://stackoverflow.com/a/20853896
has body: import java.util.*; import javax.swing.*; public class Practice { public static void main(String[] args){ int[] numbers = {1, 2, 3, 14, 15, 16, 17}; getSmall(numbers); } public static void getSmall(int[] ar){ int small=0; for(int i=0; i&lt;ar.length; i++){ if(ar[i]&lt;small) small = ar[i]; } System.out.println(small); } } The program is to find the smallest number in the array, there is no compiler error but it doesn't show the correct result. Thank you in advance!
has comment: http://stackoverflow.com/comment/31283301
has answer: http://stackoverflow.com/a/20853873

http://stackoverflow.com/a/20942682
has body: int n=10000; while(n--&gt;0) { int n=100000; while(n--&gt;0) { turnOnLight(); try{ Thread.sleep(300); }catch(InterruptedException e) { e.printStackTrace();`enter code here` } turnOffLight(); Log.d("tagname","runs 10 times c"); } }
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31466740
type: Answer
has comment: http://stackoverflow.com/comment/31452304
answers question: http://stackoverflow.com/q/20942547
accepted answer of: http://stackoverflow.com/q/20942547
has comment: http://stackoverflow.com/comment/31463946
has comment: http://stackoverflow.com/comment/31452242

http://stackoverflow.com/comment/31294046
has text: What are you doing on the player end? I would consider sending a message saying that you're shutting down and restarting so the players can do something useful such as trying to connect again.
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/20859493

http://stackoverflow.com/q/20864184
tagged with: hashmap
has answer: http://stackoverflow.com/a/20864419
tagged with: java
has answer: http://stackoverflow.com/a/20864439
upvote count: 2
has comment: http://stackoverflow.com/comment/31303726
has comment: http://stackoverflow.com/comment/31303610
tagged with: string
has comment: http://stackoverflow.com/comment/31303928
favorite count: 0
answer count: 3
has body: I have a class of fields that is like the following: public class EmployeeInformationNames { private String firstName; private String lastName; 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; } If I have a string String str = "First Name: George\nLast Name: Brown"; I want to parse the string and store it in a map such that Map&lt;String, String&gt; myMap = new HashMap&lt;String, String&gt;(); Where my key would be George and my value would be Brown. I am not to sure how I would go about doing this.
has title: How to split a string in two and store it in a field
score: 2
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31303656
type: Question
has answer: http://stackoverflow.com/a/20864216

http://stackoverflow.com/comment/31589758
score: 0
has text: @Marwief You can do the check without the regex too: `if (test.toLowerCase().contains(keyword.toLowerCase()))`
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21015716

http://stackoverflow.com/q/20951938
has answer: http://stackoverflow.com/a/20953008
type: Question
tagged with: regex
has body: I want to select the following text with my regex /*{2}(.*)*/ /** * * and writes file to {@link #writeToFile(String, java.util.Map) writeToFile} \\n * ddddddddddddd * * bla bla * * and get from class. * * @param filePath * @param classes * @return * @throws Exception */ But it does't match. I don't know what I am doing wrong . That is how I read, find \ followed my two instance of * and then match to anything until find * followed by /. But it only matches to the /** everything else is ignored.
has answer: http://stackoverflow.com/a/20952008
tagged with: java
has answer: http://stackoverflow.com/a/20953037
upvote count: 1
type: UnansweredQuestion
has title: Why id doesn't match /\*{2}(.*)\*/
answer count: 4
has answer: http://stackoverflow.com/a/20952319
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/comment/31472732
type: Comment
comment on: http://stackoverflow.com/q/20950689
type: QuestionComment
has text: It will be prefix with project name
score: 0

http://stackoverflow.com/a/20991720
answers question: http://stackoverflow.com/q/20991660
upvote count: 2
has comment: http://stackoverflow.com/comment/31543109
type: Answer
has body: imagebutton.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); try this before imagebutton.getTop()?
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43707959

http://stackoverflow.com/q/20980418
favorite count: 0
has comment: http://stackoverflow.com/comment/31523315
has answer: http://stackoverflow.com/a/20980488
has answer: http://stackoverflow.com/a/20980687
type: UnansweredQuestion
has title: what is difference between persistence and serialization?
has comment: http://stackoverflow.com/comment/31522978
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/20980525
type: Question
upvote count: 4
tagged with: jakarta-ee
has body: I have gone through this link but i'm looking for convincing answer. Visit http://www.coderanch.com/t/270170/java-programmer-SCJP/certification/Difference-serialization-persistence
downvote count: 0
has comment: http://stackoverflow.com/comment/31522893
score: 4
has comment: http://stackoverflow.com/comment/31523232
answer count: 3
has comment: http://stackoverflow.com/comment/31523337

http://stackoverflow.com/comment/31582620
type: QuestionComment
has text: @R.J what do you mean by live state. As city contains only state id. Does it matter wether state object is changed or not(except deletion case)
score: 0
comment on: http://stackoverflow.com/q/21012293
type: Comment

http://stackoverflow.com/comment/31428508
has text: Do not modify any UI elememts in doInBackgroundThread thread instead return a result form doInBackgroundThread about successful login. And do all the UI updates in onPostExecute.
comment on: http://stackoverflow.com/a/20930223
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/20946362
type: Question
tagged with: jstl
tagged with: jsp
score: 0
answer count: 1
has title: Checking if the object is new or holds value in JSP
has body: Flow is forwarded from two controllers to a JSP. From one controller a new Object of Class A is being passed whereas from the second controller a persisted object of class A which is obtained from the db is being passed. In JSP I need to check if the object has values or new &amp; perform operations respectively. Can anyone tell me how do I check? I tried this &lt;c:if test="${empty A}"&gt; Print &lt;/c:if&gt; but it's not working.
has comment: http://stackoverflow.com/comment/31458400
accepted answer: http://stackoverflow.com/a/20946425
tagged with: jakarta-ee
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/20943797
tagged with: java
has comment: http://stackoverflow.com/comment/31458447
has answer: http://stackoverflow.com/a/20946425

http://stackoverflow.com/comment/31331355
comment on: http://stackoverflow.com/q/20876880
has text: For Jersey, you need a servlet engine. My understanding of MINA was it was lower-level than a servlet engine (but my knowledge of MINA is extremely cursory).
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31458115
type: Comment
comment on: http://stackoverflow.com/a/20921259
has text: Well, you don't need to do special encoding here,since your server and client can read the content properly. However if you need to do some kind of compression on your message transfer you can use axis2 GZIP compression support. Refer (http://people.apache.org/~chinthaka/articles/axis2-parameters.html#GZIP)
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31497817
has text: According to the article that you linked to :-) the name was changed from "centigrade" to "Celsius" to avoid confusion with the word in various languages for a measure of angle. The meaning is identical. And the difference between Kelvins and degrees Celsius is 273.15. It is NOT 273.16.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/20967038
type: AnswerComment

http://stackoverflow.com/a/20997273
has body: Here is the documentation on Java variable conversions including casting. You might find this discussion on Java casting easier to understand. As long as you use a cast operator or expression and the specific variable type conversion is allowed by the rules of Java then you can cast primitive types. You do need to follow the conversion rules however. I am not sure about other object oriented languages however in C++ you can do all kinds of nasty casts if you want to go there using the C style casts. Because you can end up in a world of hurt, the use of C++ style casts are much preferred over C style casts since the compiler will check the cast.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20996992
upvote count: 1

http://stackoverflow.com/comment/31370106
type: QuestionComment
type: Comment
score: 0
has text: What are you anticipating as valid characters? Note that not all languages have the concept of "lower case" (ie, Japanese, Chinese), and some upper/lower changes depend on language (English versus Turkish, I think it was). Probably what you're really looking for is some sort of Unicode canonicalization, which would help clear up some related issues too. If you're going to be doing these comparisons a bunch, you may want to also store the "comparison" form, so it doesn't have to be derived each time.
comment on: http://stackoverflow.com/q/20899799

http://stackoverflow.com/q/20956104
linked to: http://stackoverflow.com/q/21673696
has comment: http://stackoverflow.com/comment/31476707
answer count: 0
has comment: http://stackoverflow.com/comment/31477445
has title: Getting Screen-On Time in Android by API?
tagged with: java
tagged with: screen
downvote count: 1
type: Question
upvote count: 4
has body: is there a way to get the Screen-On Time of an Android Phone by an Application? Better Battery Stats get the Time but i don't know how? Is there an API?
score: 3
has comment: http://stackoverflow.com/comment/31479038
favorite count: 0
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/a/20989234
has comment: http://stackoverflow.com/comment/31548558
type: Answer
answers question: http://stackoverflow.com/q/20972527
has body: i'm not entirely following what you do and why but likely related to issue https://netbeans.org/bugzilla/show_bug.cgi?id=221781. when compile on save is turned on, the save action doesn't regenerate non class content in annotation processors. you haveto either do clean build (build alone won't cut it) or disable compile on save
has comment: http://stackoverflow.com/comment/31549754
score: 0

http://stackoverflow.com/comment/31432389
type: Comment
comment on: http://stackoverflow.com/a/20932488
score: 0
type: AnswerComment
has text: Dont do that at work :) Locale independent code is bad thing.

http://stackoverflow.com/a/20854328
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/20854301
type: Answer
has body: Parameter -t of shutdown needs a number (seconds to wait until shutdown/restart)
has comment: http://stackoverflow.com/comment/31283780
score: 3

http://stackoverflow.com/q/21002746
tagged with: libgdx
has title: libGDX - make footsteps in a effective way
downvote count: 0
answer count: 1
tagged with: android
has answer: http://stackoverflow.com/a/21003875
has body: In a 2D game, that is being developed with libGDX, what is the most effective way to make the footsteps of the player, for example - if(player.isWalking) { Timer.schedule(new Task(){ public void run(){ play(single_footstep); } }, 0.5f); } This code isn't effective at all.. actually it's not working, the sound comes in a bad way, and no matter how much you will play with the delay value its still not effective. BTW - I am using the Timer class of libgdx, which is very similiar to the util one. So maybe you have a better idea to implement? I am kinda new to libGDX, so maybe I am missing something. Thanks in advance :)
favorite count: 0
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21003875
score: 1
tagged with: java
type: Question

http://stackoverflow.com/q/20850575
type: UnansweredQuestion
tagged with: android
score: 6
upvote count: 6
has answer: http://stackoverflow.com/a/22130981
has comment: http://stackoverflow.com/comment/31277467
tagged with: java
has title: Beat Matching Algorithm
has body: I've recently begun trying to create a mobile app (iOS/Android) that will automatically beat match (http://en.wikipedia.org/wiki/Beatmatching) two songs. I know that this exists out there, and there have been others who have had some success, but I'm running into issues related to the accuracy of the players. Specifically, I run into "sync" issues where the "beats" don't line up. The various methods used to date are: Calculate the BPM in advance, identify a "beat" (using something like sonicapi.com), and trying to line up appropriately, and begin a mix in with its playback rate adjusted (tempo adjustment) Utilizing a bunch of meta data to trigger specific starts and stops What does NOT work: Leveraging echonest's API (it beat matches on the server, we want to do it on the client) Something like pydub (does not do it in realtime) Who uses this algorithm today: iwebdj Traktor Does anyone have any suggestions on how to solve this problem? I've seen lots of people do it, but doing it in real time on a mobile device seems to be an issue.
type: Question
tagged with: ios
answer count: 1
has comment: http://stackoverflow.com/comment/31294536
downvote count: 0
tagged with: objective-c
has comment: http://stackoverflow.com/comment/31277548
favorite count: 0
has comment: http://stackoverflow.com/comment/31294567

http://stackoverflow.com/q/20931381
tagged with: java
has comment: http://stackoverflow.com/comment/31430270
has answer: http://stackoverflow.com/a/20931924
tagged with: updates
type: Question
has comment: http://stackoverflow.com/comment/31430265
answer count: 1
score: 0
has title: Using JProgressBar in Java
linked to: http://stackoverflow.com/q/20739488
tagged with: event-dispatch-thread
has body: I am making a app that takes data from an API, but it takes some time(like some 1 or 2 seconds), I want to use JProgressBar to show how much of the data is downloaded, here is my code: private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { String snum; try { curfrom=(String)fromList.getSelectedItem(); curto=(String)toList.getSelectedItem(); snum=curval.getText(); address="http://rate-exchange.appspot.com/currency?from="+curfrom+"&amp;to="+curto+"&amp;q="+snum; url=new URL(address); connect=url.openConnection(); br=new BufferedReader(new InputStreamReader(connect.getInputStream())); output=br.readLine(); String[] split = output.split("\""); res=split[12]; res=res.replace(" ", ""); res=res.replace(":", ""); res=res.replace("}", ""); result.setText(snum+" "+curfrom+" = "+res+" "+curto); } catch(Exception e) { result.setText("Error! Please check the Problem(e.g. Net)"); JOptionPane.showMessageDialog(null, "An Error has Occured!", "Error!", JOptionPane.ERROR_MESSAGE); } } I thought of making a progress bar that will load and show it value using JProgressBar.setStringPainted(true), but when I update it using afor loop like: for(i=0;i&lt;=100;i+=10) { bar.setValue(i); try { Thread.sleep(100); } catch (InterruptedException ex) { Logger.getLogger(MainApp.class.getName()).log(Level.SEVERE, null, ex); } } But when I run this code, and it starts loading, it appears hung for 100 miliseconds and then loads, I cannot see the animation which I think should have be shown by this code. I want to see the animation happening. Thanks in advance.
type: UnansweredQuestion
tagged with: jprogressbar
tagged with: swing

http://stackoverflow.com/comment/31303262
type: Comment
type: QuestionComment
has text: I don't remember offhand how to configure this (I never got my head really around the Spring Security namespace), but the `sec:http` stanza implicitly creates a Spring bean. Having multiple copies registers multiple beans, as you see. Can you link to the docs that suggest this is workable?
comment on: http://stackoverflow.com/q/20863943
score: 0

http://stackoverflow.com/comment/31289093
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20852141
has text: @BrianClozel Thanks for reply but in this example they use javascript to connect to server,this approach works fine, but i want to connect server using java on client side.

http://stackoverflow.com/comment/31423204
score: 0
type: Comment
has text: Thank you! I am quite embarrassed by making such a simple mistake. I may have more questions once I get to the GUI, haha. I am very grateful for the help everyone has provided!
type: AnswerComment
comment on: http://stackoverflow.com/a/20927591

http://stackoverflow.com/comment/31578670
type: Comment
comment on: http://stackoverflow.com/q/21010316
score: 0
type: QuestionComment
has text: i don't knwo if is the certain error that you want? 01-09 04:28:24.787: E/cutils-trace(15921): Error opening trace file: Permission denied (13) on the code it get pass from the first log.i but not from the second log.i

http://stackoverflow.com/comment/31519779
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20978614
score: 0
has text: I can not. I have to use it since I'm using some modelling implementation project under eclipse.

http://stackoverflow.com/comment/31555204
type: Comment
type: QuestionComment
has text: when you implement thread using Runnable u need to pass object of that class to thread.... here do the following.... **new Thread(this)**
score: 0
comment on: http://stackoverflow.com/q/20998371

http://stackoverflow.com/comment/53756519
type: Comment
has text: @stanleyerror This might be of some help: http://stackoverflow.com/questions/4732544/why-are-only-final-variables-accessible-in-anonymous-class
score: 1
comment on: http://stackoverflow.com/a/20938132
type: AnswerComment

http://stackoverflow.com/a/21014770
has comment: http://stackoverflow.com/comment/31585806
accepted answer of: http://stackoverflow.com/q/21014699
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/21014699
score: 6
has comment: http://stackoverflow.com/comment/97904684
type: AcceptedAnswer
downvote count: 0
has body: You need to use the following method to add multiple reciepient public void addRecipients(Message.RecipientType type, Address[] addresses) Also instead of the following line transport.sendMessage(message,message.getRecipients(Message.RecipientType.TO)); Try this transport.sendMessage(message,message.getAllRecipients());

http://stackoverflow.com/comment/31417828
type: Comment
comment on: http://stackoverflow.com/a/20924614
has text: @solvator I'll leave that as an exercise to the reader - it's trivial.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31313907
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20869885
score: 1
has text: What is the error message or issue?

http://stackoverflow.com/q/20993264
has body: I am working on a project where internationalized messages are retrieved using the @Value annotation. e.g.: @Value("${email.newUser.subject}") private String NEW_USER_SUBJECT; @Value("${email.newUser.message}") private String NEW_USER_MESSAGE; However, as part of my investigation, it appears that the @Value annotation is used to get a property from a property file and does not link into to automatic lookup of the correct version of the message.properties. Therefore as I understand it, this is only working by coincidence because we have currently only a single message.properties file. Can anyone in the know tell me if I have the correct understanding of the situation?
type: Question
has comment: http://stackoverflow.com/comment/32376730
tagged with: spring
tagged with: internationalization
accepted answer: http://stackoverflow.com/a/21455396
tagged with: java
tagged with: annotations
has comment: http://stackoverflow.com/comment/31546960
upvote count: 1
answer count: 1
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/21455396
score: 1
has title: Is Spring's @Value annotation part of internationalization?
favorite count: 0

http://stackoverflow.com/q/20984965
has answer: http://stackoverflow.com/a/20985091
favorite count: 0
accepted answer: http://stackoverflow.com/a/20985091
tagged with: itunes
upvote count: 1
has title: iTunes RSS Feed in JSON - Read in JAVA Webapps
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I am building a web application in which I want to display iTunes top 10 Songs and iTunes top 10 albums. I have used https://rss.itunes.apple.com/ link to generate it and changed from XML to json. http://itunes.apple.com/au/rss/topsongs/limit=10/json I am getting JSON from the above link. And can view in JSON Viewer http://jsonviewer.stack.hu/#http://itunes.apple.com/au/rss/topsongs/limit=10/json However, I am confuse on how to read the JSON Object so that I can get the required fields. (entry > title) I am able to get to the entry and loop through the array to get all the title. However I am not sure about how to get label. URL url = new URL("http://itunes.apple.com/au/rss/topsongs/limit=10/json"); URLConnection connection = url.openConnection(); String line; StringBuilder builder = new StringBuilder(); BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); while((line = reader.readLine()) != null) { builder.append(line); } JSONObject itunesJsonObject = new JSONObject(builder.toString()); JSONObject feedJsonOject = itunesJsonObject.getJSONObject("feed"); JSONArray arrayJsonObject = feedJsonOject.getJSONArray("entry"); List&lt;String&gt; list = new ArrayList&lt;&gt;(); for(int i = 0 ; i &lt; arrayJsonObject.length() ; i++){ list.add(arrayJsonObject.getJSONObject(i).getString("title")); } for(String e: list){ log.debug("JSON Object : " + e.toString()); } In log.debug I am geeting following which includes label. JSON Object : {"label":"Happy (from \"Despicable Me 2\") - Pharrell Williams"} JSON Object : {"label":"Trumpets - Jason Derulo"} JSON Object : {"label":"Rude - MAGIC!"} JSON Object : {"label":"All of Me - John Legend"} JSON Object : {"label":"Free (feat. Emeli SandÃ©) - Rudimental"} JSON Object : {"label":"I See Fire - Ed Sheeran"} JSON Object : {"label":"Timber (feat. Ke$ha) - Pitbull"} JSON Object : {"label":"God Only Knows - MKTO"} JSON Object : {"label":"Like a Drum - Guy Sebastian"} JSON Object : {"label":"Hey Brot…
type: Question
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/31350798
score: 0
comment on: http://stackoverflow.com/q/20889601
has text: There. It's an exercise about garbage collection.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20936818
type: Question
answer count: 2
tagged with: arrays
tagged with: string
tagged with: sorting
score: 0
has title: need to make top 10 strings and int's
has answer: http://stackoverflow.com/a/20936931
has comment: http://stackoverflow.com/comment/31440741
has answer: http://stackoverflow.com/a/20936968
possible better answer: http://stackoverflow.com/a/20936931
has comment: http://stackoverflow.com/comment/31440692
type: AnsweredQuestion
tagged with: java
has body: im making plugin to game. I need to get 10 values from Config, and sort it in top 10. it should print top 10 like: 1. Name + points 2. Name + points . . . 10. Name + points With code which I pasted below, I received: [name1, name2, name3, name4][points1,points2,points3] and it is not sorted like i would like to. It should be from highest to lowest [10 resoults] for (String g : Rpgg.getConfig().getConfigurationSection("Stats").getKeys(false)){ // Set&lt;String&gt; g = Rpgg.getConfig().getConfigurationSection("Stats").getKeys(false); // int[] i1 = new int[]{i}; int i = Rpgg.getConfig().getInt("Stats."+g+".pkt"); l.add(i); a.add(g); Collections.sort(a); Collections.sort(l); map.put(g,i); } sorted_map.putAll(map); Bukkit.broadcastMessage("lp:"+ "§4G:§6 " + a + " §4pkt§6 " + l);
accepted answer: http://stackoverflow.com/a/20936968

http://stackoverflow.com/q/20959796
has answer: http://stackoverflow.com/a/53441427
has answer: http://stackoverflow.com/a/45903345
has body: I can not rotate image 90 degree to right . I need to be able to rotate images individually in java. The only thing. Unfortunately, I need to draw the image at a specific point, and there is no method with an argument that 1.rotates the image separately and 2. allows me to set the x and y. any help is appreciated public class Tumbler extends GraphicsProgram{ public void run() { setSize(1000,1000); GImage original = new GImage("sunset.jpg"); add(original, 10, 10); int[][] pixels = original.getPixelArray(); int height = pixels.length; int width = pixels[0].length; // Your code starts here int newheight = width; int newwidth = height; int[][] newpixels = new int[newheight][newwidth]; for (int i = 0; i &lt; height; i++) { for (int j = 0; j &lt; width; j++) { newpixels[j][height-1-i] = pixels[i][j]; } } GImage image = new GImage(newpixels); add(image, width+20, 10); // Your code ends here }
linked to: http://stackoverflow.com/q/5722058
tagged with: graphics2d
has answer: http://stackoverflow.com/a/52663539
has answer: http://stackoverflow.com/a/20961355
accepted answer: http://stackoverflow.com/a/20961355
linked to: http://stackoverflow.com/q/4156518
tagged with: swing
has answer: http://stackoverflow.com/a/55636560
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/52663539
score: 4
tagged with: image
has comment: http://stackoverflow.com/comment/31484664
type: Question
upvote count: 4
has title: Rotate 90 degree to right image in java
tagged with: rotation
has answer: http://stackoverflow.com/a/40707024
downvote count: 0
answer count: 6
linked to: http://stackoverflow.com/q/3405799
favorite count: 0

http://stackoverflow.com/comment/31320491
score: 0
type: Comment
has text: Then that should be a comment, not an answer.
type: AnswerComment
comment on: http://stackoverflow.com/a/20873076

http://stackoverflow.com/a/20958067
has comment: http://stackoverflow.com/comment/31481000
has body: I agree with SotiriosDelimanolis. I tried to run this code in JDK 7. public class Test { public static void main(String arg[]) { TreeSet&lt;String&gt; set = new TreeSet&lt;String&gt;(); set.add(null); set.add("Test"); System.out.println(set); } } But got the following error: Exception in thread "main" java.lang.NullPointerException I think using your requirement will be fulfilled.
answers question: http://stackoverflow.com/q/20957407
has comment: http://stackoverflow.com/comment/31480955
score: 0
type: Answer

http://stackoverflow.com/comment/31535655
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20987214
score: 0
has text: possible duplicate of [List all files from a directory recursively with Java](http://stackoverflow.com/questions/2534632/list-all-files-from-a-directory-recursively-with-java)

http://stackoverflow.com/comment/31331753
score: 0
has text: Ultimately, I want to be able to create a virtual representation of the network in the first diagram.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20879124

http://stackoverflow.com/comment/74632703
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20903328
has text: either it should be <WebDriver> or it should be <> if you are using java 8 <driver> would give you compilation error.
score: 0

http://stackoverflow.com/comment/31403430
type: QuestionComment
has text: I think @JonKiparsky's deleted answer is right.
comment on: http://stackoverflow.com/q/20917088
score: 0
type: Comment

http://stackoverflow.com/a/20969234
score: 1
upvote count: 1
type: Answer
downvote count: 0
has body: For UTF-16 encoding use str.getBytes("UTF-16"); but it gives 14 length for byte[] please refer [link] http://rosettacode.org/wiki/String_length for more details.
answers question: http://stackoverflow.com/q/20966802

http://stackoverflow.com/q/20937103
has body: I am making a sudoku-style program with JPanel and the program must a legal starting position of the game, the game has to start with 3 to 7 (random) numbers already inserted in the panel in random positions (from 1 to 5). I have a 5x5 grid with 25 JButtons, I have my random numbers and my random locations of these numbers, except I also have to follow the rules of the game which state that no number can repeat itself in its row and column. I know I have to select each button (the number that is on the button) and go through the row and column and check if there is a repetition, if there is go back and change number, but I was unable to do so with the many codes I've tried. public class Sudoku implements ActionListener { JButton[][] gumbi = new JButton[5][5]; public Sudoku() { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(500, 500); JPanel panel = new JPanel(new GridLayout(5, 5)); Random st = new Random(); int stevila = st.nextInt(5) + 4; // initial random number to be inserted int counter = 0; for (int i = 0; i &lt; 5; i++) { for (int j = 0; j &lt; 5; j++) { Random flag = new Random(); int f = flag.nextInt(2); // random location of number Random rnd = new Random(); int r = rnd.nextInt(5) + 1; // random number, range 1-5 if (counter &lt; stevila &amp;&amp; f == 0) { gumbi[i][j] = new JButton("0"); } else if (counter &lt; stevila &amp;&amp; f == 1) { gumbi[i][j] = new JButton(Integer.toString(r)); counter++; gumbi[i][j].setEnabled(false); } else { gumbi[i][j] = new JButton("0"); } gumbi[i][j].addActionListener(this); panel.add(gumbi[i][j]); } } frame.add(panel); frame.setVisible(true); } I have to insert something resembling this (recursive or otherwise) to check if there are repetitions in rows and columns. public boolean checkRow(int row, String num) { for (int col = 0; col &lt; 5; col++) if (gumbi[row][col].getText() == num) return false; return true; } public boolean checkCol( int col, String num ) { for( int row…
tagged with: java
has title: Java/ Sudoku algorithm/ JPanel/ JButtons
has comment: http://stackoverflow.com/comment/31441368
tagged with: swing
has comment: http://stackoverflow.com/comment/31441521
has comment: http://stackoverflow.com/comment/31441562
downvote count: 1
has comment: http://stackoverflow.com/comment/31441418
type: Question
has comment: http://stackoverflow.com/comment/31441398
tagged with: algorithm
score: -1
has comment: http://stackoverflow.com/comment/31441627
tagged with: random
has comment: http://stackoverflow.com/comment/31441710
answer count: 1
has comment: http://stackoverflow.com/comment/31441448
favorite count: 0
has comment: http://stackoverflow.com/comment/31441114
has answer: http://stackoverflow.com/a/20937482
accepted answer: http://stackoverflow.com/a/20937482
tagged with: sudoku
type: AnsweredQuestion
upvote count: 0

http://stackoverflow.com/comment/31506267
has text: do you want to add .csv/xml automatically without any users action ??? (is simple and possible)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20971785

http://stackoverflow.com/comment/31447561
score: 0
type: AnswerComment
has text: i did that in the while loop but it only printed the first number of each variable
comment on: http://stackoverflow.com/a/20939879
type: Comment

integrity
type: Tag
tags question: http://stackoverflow.com/q/20989448
tag name: integrity

http://stackoverflow.com/comment/31488645
has text: You can use SpannableStringBuilder (http://developer.android.com/reference/android/text/SpannableStringBuilder.html) to create your original SpannableString.
comment on: http://stackoverflow.com/a/20961815
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/20859706
has body: This is my Hole Class class Hole { public int a; public int b; Hole(int a, int b) { this.a = a; this.b = b; } So i adding an ArrayList that contain several several hole public void checkPathLoop(int x, int y) { //rough code ArrayList&lt;Hole&gt; leftFlowInnerHole = new ArrayList&lt;&gt;(); //left holes rules leftFlowInnerHole.add(new Hole(0, 1)); leftFlowInnerHole.add(new Hole(1, 5)); leftFlowInnerHole.add(new Hole(5, 4)); leftFlowInnerHole.add(new Hole(0, 4)); when i add Hole userInputHole = new Hole(0,1); System.out.print(leftFlowInnerHole.contain(userInputHole)); it always return false !! it suppose to return true. Is there anything i miss ?? Thank you in advance
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20859725
has answer: http://stackoverflow.com/a/20860024
has answer: http://stackoverflow.com/a/55353760
downvote count: 0
tagged with: contain
has title: Java ArrayList Contain always return false although it contain the same value
tagged with: arraylist
linked to: http://stackoverflow.com/q/2265503
favorite count: 0
possible better answer: http://stackoverflow.com/a/20860024
has answer: http://stackoverflow.com/a/20859727
accepted answer: http://stackoverflow.com/a/20859727
score: 11
answer count: 4
upvote count: 11
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/1569688

http://stackoverflow.com/comment/31343168
type: Comment
comment on: http://stackoverflow.com/q/20885596
score: 0
type: QuestionComment
has text: Can you explain what exactly the program is supposed to do?

http://stackoverflow.com/comment/31538427
comment on: http://stackoverflow.com/a/20977665
has text: I'm having a hard time referencing the png file. I put it in src/my/package/pen.png and getResourcesAsStream keeps returning null. I fear the pgn file is not in the jar. I'm using an Android.mk file do you happen to know if I need to explicitly include that png file? Also, when opening the jar with eclipse and tar tv - I couldn't see anything but classes.dex and some manifest file
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/20901506
tagged with: java
type: Question
has body: I am getting the following error while uploading a document having a numeric file name. The error does not occur if the file name contains only letters and no digits. Suppose I am uploading a pdf file having file name 1234.pdf then its giving the following error: org.apache.xmlbeans.XmlException: error: Unexpected character encountered (lex state 9): '1' Would really appreciate if someone could give me some light on the issue. I have done some google search on this but not able to solve the issue.
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has title: org.apache.xmlbeans.XmlException: error: Unexpected character encountered (lex state 9): ''
tagged with: http://stackoverflow.com/tag/xml
score: 2
answer count: 0
has comment: http://stackoverflow.com/comment/31372900
upvote count: 2

http://stackoverflow.com/comment/31541182
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20990544
has text: Java only allow declaration within the class and outside any method. Declarations like int b = 1; will be executed when you initialize a new Object.

http://stackoverflow.com/q/20883968
has answer: http://stackoverflow.com/a/20884120
score: 5
has body: I've got something strange happening in a server running Linux, while a windows machine performing the same code behaves normally. It is happening with the following code: public static final SimpleDateFormat sqlDateFormat = new SimpleDateFormat("Y-M-d"); Calendar cal = Calendar.getInstance(); String now = sqlDateFormat.format(cal.getTime()); System.out.println(now); cal.add(Calendar.DAY_OF_MONTH, -4); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); String trsh = sqlDateFormat.format(cal.getTime()); System.out.println(trsh); The output on the windows machine running: java version "1.7.0_07" Java(TM) SE Runtime Environment (build 1.7.0_07-b11) Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode) Output: 2014-01-02 2013-12-29 The above is matching the expected result. The output on the Linux machine running: java version "1.8.0-ea" Java(TM) SE Runtime Environment (build 1.8.0-ea-b108) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b50, mixed mode) Output: 2014-01-02 2014-12-29 This is odd isn't it? Any nice workarounds?
answer count: 2
has answer: http://stackoverflow.com/a/20884159
has comment: http://stackoverflow.com/comment/31340126
has comment: http://stackoverflow.com/comment/31340073
favorite count: 0
tagged with: linux
upvote count: 5
has comment: http://stackoverflow.com/comment/31340029
accepted answer: http://stackoverflow.com/a/20884120
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/20884159
tagged with: java
tagged with: calendar
has title: Is this a bug in Java.Calendar in Linux? Year not updated
type: Question

http://stackoverflow.com/q/20884335
type: Question
tagged with: shortest-path
has comment: http://stackoverflow.com/comment/31488535
score: 0
has title: GremlinPipeline returns different results with Titan and OrientDB
has comment: http://stackoverflow.com/comment/31372771
type: UnansweredQuestion
tagged with: titan
has comment: http://stackoverflow.com/comment/31499672
tagged with: orientdb
has comment: http://stackoverflow.com/comment/33582806
answer count: 0
has body: I am trying to find the shortest path with GremlinPipeline using the following code: final GremlinPipeline&lt;String, List&gt; pathPipe = new GremlinPipeline&lt;String, List&gt;(v1) .as("similar") .both("similar") .loop("similar", new PipeFunction&lt;LoopBundle&lt;Vertex&gt;, Boolean&gt;() { //@Override public Boolean compute(LoopBundle&lt;Vertex&gt; bundle) { return bundle.getLoops() &lt; 5 &amp;&amp; bundle.getObject() != v2; } }) .path(); I have two scenarios. The first is that the data are stored in a Titan graph database and the second in a OrientDB graph database. When I use the above code with the first scenario I get a list that each entry corresponds to the path that connects vertex v1 and v2. The first entry is always the shortest path.. e.g. [v[4], v[8]] [v[4], v[20868], v[8]] [v[4], v[4], v[8]] [v[4], v[25800], v[8]] (4 is the id of v1 and 8 the id of node 2) But when I use the above code with orientDB data I get different results, e.g. [v[#9:0], v[#9:0], v[#9:0]] [v[#9:0], v[#9:0], v[#9:1]] [v[#9:0], v[#9:0], v[#9:45]] [v[#9:0], v[#9:0], v[#9:55]] (#9:0 is the id of the v1 and #9:1 is the id of v2) Note that I print the results using the following code: Iterator iter = pathPipe.iterator(); while(iter.hasNext()) { System.out.println(iter.next()); } EDIT: I use orientdb-1.6.1, titan 0.4.1, blueprints-core-2.5.0 and blueprints-orient-graph-2.5.0
tagged with: java
tagged with: gremlin

http://stackoverflow.com/q/20907488
type: Question
has body: I have objects which I serialize using Jackson. e.g. class A { int id; String value } is serialized to: { "id": 1, "value": "test" } Now I want an additional field in the serialized version: { "id": 1, "value": "test" "__errors__": [ { field: "id", "message": "already in use" }, { field: "value", "message": "field to long" }, ] } This field is composed by a list of class Error: class Error { String field; String message; } This should be done while serializing and work without adding a method / property to the class A. So is there a way to inject additional fields into jackson mapper? Best would be a generic method which would work for all classes passed to the mapper without additional code. (Background: I want to use this to return validation errors to AngularJS within the normal result. Because putting both in a container would complicate the code on the client side.) Thanks in advance! EDIT: I imagine the final usage could look something like this: ObjectMapper mapper = ...; PrintWriter out = ...; // Normally the parsed user input A a = new A( 5, "test" ); // Normally generated by validation of user input List&lt;Error&gt; errors = Arrays.asList( new Error( "id", "already in use" ) ); // No write it as combined json mapper.writeValue( out, a, error ); // ... or ... customWrite( out, a, error ); EDIT2: Currently I'm looking at two possible solutions: Write a custom Serializer. Seems like a clean solution but needs to do all the stuff the default serializer does. But is a complex solution because I first have to figure out how custom serialization and extending the default works. Just use String replacement and concatenation. Write both objects seperately and remove staring/closing curly braces and append one on another. Quick, but very dirty. (I really don't like this but it could work.)
tagged with: jackson
has answer: http://stackoverflow.com/a/20914904
tagged with: rest
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31387483
tagged with: angularjs
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/31385317
accepted answer: http://stackoverflow.com/a/20914904
has title: Injecting additional fields in serialization

http://stackoverflow.com/q/20959961
favorite count: 0
has body: I create java class that include a list of users(called 'usersList' and include username and password for each value), and now I create a JSP file and make scope of JavaBeans : &lt;jsp:useBean id="users" scope = "page" class="Package.VoteDB"&gt; &lt;/jsp:useBean&gt; &lt;jsp:getProperty name="users" property="usersList"/&gt; I want to get the usersList to a variable , and then check if username:admin , and password admin include in this list. with the current code, it's just Print the usersList to the screen. how can I save it in variable (without printing the list to the screen) and check if it's include the admin user? thanks!!!
has title: JavaBeans - getProperty to a variable
has answer: http://stackoverflow.com/a/20960081
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/20960081
downvote count: 0
answer count: 1
tagged with: jsp
tagged with: javabeans

http://stackoverflow.com/q/20961949
has comment: http://stackoverflow.com/comment/31488817
type: Question
has title: How can I remove a rectangle after a collision?
downvote count: 0
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/20962485
has answer: http://stackoverflow.com/a/20962259
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20962289
upvote count: 1
tagged with: collision
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31488721
has body: I have two rectangles that I need to be taken off screen when they intersect. The rectangles I need to disappear are, bulletObject and e1. They do intersect when I run it but nothing happens. I have tried putting "e1 = new Rectangle (0,0,0,0);" after the "if (bulletObject.intersects(e1)){" but then it tells me that it is never used. All help I appreciated. A chunk of my code is below. public void draw(Graphics g){ g.setColor(Color.BLUE); g.fillRect(x, y, 40, 10); g.fillRect(x+18, y-7, 4, 7); Rectangle bulletObject = new Rectangle(x+18, y-7, 4, 7); if (shot){ g.setColor(Color.BLUE); g.fillRect(bullet.x, bullet.y , bullet.width, bullet.height); } //enemies g.setColor(Color.RED); Rectangle e1 = new Rectangle(20,75,35,35); Rectangle e2 = new Rectangle(85,75,35,35); Rectangle e3 = new Rectangle(150,75,35,35); Rectangle e4 = new Rectangle(205,75,35,35); Rectangle e5 = new Rectangle(270,75,35,35); Rectangle e6 = new Rectangle(335,75,35,35); Rectangle e7 = new Rectangle(405,75,35,35); g.setColor(Color.RED); g.fillRect(e1.x,e1.y,e1.width,e1.height); g.fillRect(e2.x,e2.y,e2.width,e2.height); g.fillRect(e3.x,e3.y,e3.width,e3.height); g.fillRect(e4.x,e4.y,e4.width,e4.height); g.fillRect(e5.x,e5.y,e5.width,e5.height); g.fillRect(e6.x,e6.y,e6.width,e6.height); g.fillRect(e7.x,e7.y,e7.width,e7.height); g.fillRect(bulletObject.x,bulletObject.y, bulletObject.width,bulletObject.height); if (bulletObject.intersects(e1)){ g.clearRect(e1.x, e1.y,e1.width, e1.height ); } }

http://stackoverflow.com/comment/31428448
type: AnswerComment
has text: I tried this, Eclipse asked me to add a `return null;` after the `postLoginData();` which I did. Now I get the following error: `FATAL EXCEPTION: AsyncTask #1 01-04 21:10:25.017: E/AndroidRuntime(5599): java.lang.RuntimeException: An error occured while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:299) 01-04 21:10:25.017: E/AndroidRuntime(5599): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)`
comment on: http://stackoverflow.com/a/20930223
type: Comment
score: 0

http://stackoverflow.com/q/20903044
linked to: http://stackoverflow.com/q/3663457
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20904975
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: ognl
downvote count: 0
tagged with: struts2-convention-plugin
tagged with: struts2
has title: How to validate Boolean fields in Struts2 using annotations?
has body: Given a Boolean field in an action class like so. @Namespace("/admin_side") @ResultPath("/WEB-INF/content") @ParentPackage(value="struts-default") public final class TestAction extends ActionSupport implements Serializable, ValidationAware, ModelDriven&lt;Entity&gt; { private Boolean boolField; public Boolean getBoolField() { return boolField; } public Boolean setBoolField(Boolean boolField) { this.boolField=boolField; } @Validations(requiredFields={@RequiredFieldValidator(fieldName="boolField", type= ValidatorType.FIELD, key="delete.row.confirm")}) @Action(value = "testAction", results = { @Result(name=ActionSupport.SUCCESS, type="redirectAction", location="Test.action"), @Result(name = ActionSupport.INPUT, location = "Test.jsp")}, public String testAction() { return ActionSupport.SUCCESS; } // The rest of the action class. } The field in the action class boolField should be validated only when it is set to true. It may be a hidden field &lt;s:hidden&gt; or it may be set via a query-string parameter. This and this questions use XML configurations for boolean field validation but do not say anything about annotations. How to validate such boolean fields using annotations? &rarr; I have avoided interceptors and other things to make the code shorten.
tagged with: validation
answer count: 1
has answer: http://stackoverflow.com/a/20904975
linked to: http://stackoverflow.com/q/18257366
favorite count: 0

http://stackoverflow.com/q/20944724
has answer: http://stackoverflow.com/a/20944782
type: Question
has title: Java Regex BBCode not replacing but
answer count: 1
has body: I am going to use the following method to replace special BB Codes for html links public String replace(String text , String bbcode , String imageLocation ){ StringBuffer imageBuffer = new StringBuffer (""); Pattern pattern = Pattern.compile("\\"+bbcode ); Matcher matcher = pattern.matcher(text); StringBuilder builder = new StringBuilder(); int i = 0; while (matcher.find()) { //String orginal = replacements.get(matcher.group(1)); imageBuffer.append(" "); String replacement = imageBuffer.toString(); builder.append(text.substring(i, matcher.start())); if (replacement == null) { builder.append(matcher.group(0)); } else { builder.append(replacement); } i = matcher.end(); } builder.append(text.substring(i, text.length())); return builder.toString(); } but when it comes to replacing the following bbcodes , :D O:-) :-[ :o) :~( :xx( :-] :-( ^3^ @_@ :O :) :P ;-) ??? ?_? Z_Z It turns out to be not closing bracket and : <-- not recognized How should I override the regex functional code and replace the abovementioned list of icons as html image links? I am currently using this string array but It comes out with the following error error: Error: No resource type specified (at '^index_6' with value '@_@'). [369] #adore# #yup# #ass# :-( ^3^ @_@
tagged with: string
tagged with: android
linked to: http://stackoverflow.com/q/15409296
tagged with: regex
accepted answer: http://stackoverflow.com/a/20944782
score: 0
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/20881302
score: -1
has comment: http://stackoverflow.com/comment/31335206
has answer: http://stackoverflow.com/a/20881354
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/31335712
favorite count: 0
has comment: http://stackoverflow.com/comment/31337648
has title: Http get request not working
tagged with: android
downvote count: 2
has comment: http://stackoverflow.com/comment/31337263
possible better answer: http://stackoverflow.com/a/20881354
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31336131
has answer: http://stackoverflow.com/a/20881455
accepted answer: http://stackoverflow.com/a/20881455
tagged with: http
has comment: http://stackoverflow.com/comment/31336101
type: Question
has body: I got this code, any suggestions why it's not returning any value to the "toBeSplit" String? I call the method this way. new Thread(new Runnable() { @Override public void run() { // TODO Auto-generated method stub getData(); } }).start(); Here is the actual method, i have tried 1000 ways and it just aint working.. private void getData() { StringBuilder builder = new StringBuilder(); HttpParams httpParams = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(httpParams, timeout); HttpConnectionParams.setSoTimeout(httpParams, timeout); HttpClient client = new DefaultHttpClient(httpParams); String yourUrl = "http://www.ratemyplays.com/form.php"; HttpGet httpGet = new HttpGet(yourUrl); { try { HttpResponse response = client.execute(httpGet); StatusLine statusLine = response.getStatusLine(); int statusCode = statusLine.getStatusCode(); if (statusCode == 200) { HttpEntity entity = response.getEntity(); InputStream content = entity.getContent(); BufferedReader reader = new BufferedReader(new InputStreamReader(content)); String line; while ((line = reader.readLine()) != null) { builder.append(line); } } } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } } toBeSplit = builder.toString(); split2 = toBeSplit.split(","); }

http://stackoverflow.com/a/20914864
downvote count: 0
answers question: http://stackoverflow.com/q/20914834
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/31423083
has body: You should keep a reference to the sub frame you open for first time. At second time you first check if you have a reference or not and then decide to create a new frame or to put the focus onto the existing open frame. Example as answer to comment of OP (similar to other answer of @AlexanderTorstling, but not immediately creating the sub frame): class MainFrame extends JFrame { private JFrame subFrame = null; MainFrame() { ... button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (subFrame == null) { subFrame = new JFrame(); ... } subFrame.setVisible(true); } }); } } This example has also the advantage to give you the possibility to close the subframe via a registered WindowAdapter if the main frame is closed.

http://stackoverflow.com/comment/31550678
has text: I don't know anything about this other than what is stated in the bug report.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20918570

http://stackoverflow.com/q/20947358
possible better answer: http://stackoverflow.com/a/20947465
has answer: http://stackoverflow.com/a/20947491
accepted answer: http://stackoverflow.com/a/20947491
has comment: http://stackoverflow.com/comment/31460149
favorite count: 0
downvote count: 3
has body: I am making a calculator and I want to press any calculation button and then check if EditTexts are empty and then display a message within a toast (I already know how to do that). I tried just adding the if(toast) { } else { (calculations) } but it only checks when the app starts. Thanks in advance.
tagged with: android
has answer: http://stackoverflow.com/a/20947672
has title: I want when I press a button to check if edittexts are empty
has comment: http://stackoverflow.com/comment/31460162
has comment: http://stackoverflow.com/comment/31460001
has answer: http://stackoverflow.com/a/20947465
type: Question
type: AnsweredQuestion
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/31460316
has comment: http://stackoverflow.com/comment/31460137
has comment: http://stackoverflow.com/comment/31460023
answer count: 3
upvote count: 1

http://stackoverflow.com/q/20883923
type: Question
has comment: http://stackoverflow.com/comment/31340913
tagged with: eclipse
has answer: http://stackoverflow.com/a/20886449
score: 0
answer count: 1
tagged with: tableviewer
has title: How to build pop up of TableViewer in SWT?
has body: I am new in Java and in SWT. I created TableViewer to show data of tables. class myTable : TableViewer I want when I press on button to open dialog of myTable ( like pop up ) and to choose any item from the TableViewer. The dialog should have two buttons "OK" and cancel. Do you know how to do it in java? I mean to open dialog with TableViewer Does there is standard widget for this? which component do I need to use? Do you have any example?
accepted answer: http://stackoverflow.com/a/20886449
tagged with: jface
has comment: http://stackoverflow.com/comment/31343136
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31341342
tagged with: java
tagged with: swt

http://stackoverflow.com/comment/31336532
comment on: http://stackoverflow.com/a/20871782
has text: Great! Feel free to ask for help here or on the Autobahn mailing list should you run into issues with WebSocket and/or AutobahnAndroid ..
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/20927020
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/16927840
score: 1
tagged with: java
upvote count: 1
has title: JPA Tools/EclipseLink - Generate table from entities - column order
has comment: http://stackoverflow.com/comment/47010111
type: Question
tagged with: eclipse
has body: I'm trying to generate ddl from existing annotated entities using "JPA tools --> Generate Tables from Entities..." in Eclipse Kepler. When I run the task, I get a file with sql scripts to run. The problem is that the order of the columns in the table creation statement fails to comply with the order of the attributes in the class definition. Example: @Entity @Table(name = "news", catalog = "myDatabase") public class News implements java.io.Serializable { private long id; private String newsTitle; private String newsTitle2; private String newsText; private Date created; @Id @GeneratedValue @Column(name = "news_id", unique = true, nullable = false) public long getId() { return this.id; } public void setId(long id) { this.id = id; } @Column(name = "news_title") public String getNewsTitle() { return this.newsTitle; } public void setNewsTitle(String newsTitle) { this.newsTitle = newsTitle; } @Column(name = "news_title2") public String getNewsTitle2() { return this.newsTitle2; } public void setNewsTitle2(String newsTitle2) { this.newsTitle2 = newsTitle2; } @Lob @Column(name = "news_text") public String getNewsText() { return this.newsText; } public void setNewsText(String newsText) { this.newsText = newsText; } @Temporal(TemporalType.TIMESTAMP) @Column(name = "created") public Date getCreated() { return this.created; } public void setCreated(Date created) { this.created = created; } } Script: CREATE TABLE myDatabase.news ( news_id BIGINT NOT NULL UNIQUE, created DATETIME, news_text LONGTEXT, news_title VARCHAR(255), news_title2 VARCHAR(255), PRIMARY KEY (news_id)) How can I get the scripts with the order of the columns aligned with the java class? Thank you very much Stefano
tagged with: eclipselink
tagged with: sql
answer count: 1
tagged with: jpa
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21860176
linked to: http://stackoverflow.com/q/1298322

http://stackoverflow.com/q/20912843
has comment: http://stackoverflow.com/comment/31395428
has comment: http://stackoverflow.com/comment/31395808
score: 0
has comment: http://stackoverflow.com/comment/31395402
answer count: 1
has comment: http://stackoverflow.com/comment/31395489
has comment: http://stackoverflow.com/comment/31396362
linked to: http://stackoverflow.com/q/20908174
has comment: http://stackoverflow.com/comment/31396418
has comment: http://stackoverflow.com/comment/31395404
tagged with: exception
has answer: http://stackoverflow.com/a/20913165
accepted answer: http://stackoverflow.com/a/20913165
has comment: http://stackoverflow.com/comment/31395369
has comment: http://stackoverflow.com/comment/31395347
type: AnsweredQuestion
has body: My java code throws exception e which is null (debug shows e==null) How can the code catch this at: } catch (IOException e) { e.printStackTrace(); } If e is null how can it have a type?
has comment: http://stackoverflow.com/comment/31395677
tagged with: java
type: Question
has title: how can null exception enter try-catch branch?
has comment: http://stackoverflow.com/comment/31395718

http://stackoverflow.com/comment/77180249
score: 0
type: Comment
has text: This is a good solution, but will not work properly for dates before 1/1/1970. -1L is actually a valid value to represent one millisecond before 1/1/1970. So I would rather use a value like Long.MIN_VALUE instead for better safety.
comment on: http://stackoverflow.com/a/31753655
type: AnswerComment

http://stackoverflow.com/comment/31419049
has text: yes this idea is correct in the case that you want to avoiding the flickering on resize, because this event is fired per pixexl, but you have to use Swing Timer(local variable) with small delay 400-600, in componentResized(resize can continue) to call myTimer.restart(), if resize ended then Swing Action/Actionlistener will fire onResize();
comment on: http://stackoverflow.com/q/20925193
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/31547420
comment on: http://stackoverflow.com/q/20994151
score: 0
type: QuestionComment
has text: override onTouch get the co-ordinated x and y and call invalidate to refresh the draw
type: Comment

http://stackoverflow.com/q/20858378
tagged with: java
has body: I have a class called NewClass, and inside this class I have another class called people. I want to make clones of the people class, and have them with different values and names; however, I want these classes named based on a String array. Lets say I have a String array with 5 words: String[] array = new String[] { "first", "second", "third", "fourth", "fifth" }; And I have a class with a few variables like: class people { String name; int id; } Is it possible to clone or create a new class, using "people" as the model with the Strings from array? I've tried this so far and it doesn't work: for (int i = 0; i &lt; array.length; i++) { people array[i] = new people(); } Also, how would these classes be accessed from outside the "NewClass"; would it be possible to access like this: class OtherClass { NewClass myclass = new NewClass(); System.out.println(myclass.first.name); }
downvote count: 1
type: Question
score: -1
tagged with: class
answer count: 3
upvote count: 0
tagged with: arrays
has answer: http://stackoverflow.com/a/20858604
favorite count: 0
has answer: http://stackoverflow.com/a/20858579
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31291863
has title: Java - clone class based on array
has comment: http://stackoverflow.com/comment/31291968
has answer: http://stackoverflow.com/a/20858793

http://stackoverflow.com/comment/31377907
type: QuestionComment
comment on: http://stackoverflow.com/q/20900819
has text: @MichałRybak - Actually, this particular problem is only happening with the ID from one site, as far as I am aware, and is happening correctly on every other occasion. So, yes, it has been tried with other values and is working correctly.
score: 0
type: Comment

http://stackoverflow.com/a/20867737
score: 1
accepted answer of: http://stackoverflow.com/q/20867705
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20867705
has comment: http://stackoverflow.com/comment/31318935
has body: Watch the method getInitiatedClasses: http://docs.oracle.com/javase/7/docs/api/java/lang/instrument/Instrumentation.html
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/31319124

http://stackoverflow.com/comment/31371187
type: QuestionComment
has text: You can use this link to download older versions of firefox : http://www.filehippo.com/download_firefox/history/
score: 0
comment on: http://stackoverflow.com/q/20897368
type: Comment

http://stackoverflow.com/comment/31577737
type: AnswerComment
comment on: http://stackoverflow.com/a/21009341
type: Comment
score: 2
has text: `useTestNG { parallel = ...; threadCount = ...; }` is the TestNG feature to execute tests in multiple threads (one JVM). `test.maxParallelForks` is the generic Gradle feature to execute (JUnit or TestNG) tests in multiple JVMs (one thread per JVM). `--parallel` is the generic Gradle feature to run tasks in parallel. (Currently, only tasks from different projects will run in parallel.)

http://stackoverflow.com/a/20925531
answers question: http://stackoverflow.com/q/20924970
upvote count: 1
downvote count: 0
type: Answer
score: 1
has body: Maybe I didn't really understant your question but if you need a method to catch the exit before the program exit (CTRL-C for instance) you van use an "exit hook", usefull also to free connection see Useful example of a shutdown hook in Java?

c#
tags question: http://stackoverflow.com/q/20868515
tags question: http://stackoverflow.com/q/20915126
tag name: c#
tags question: http://stackoverflow.com/q/20986674
tags question: http://stackoverflow.com/q/20947964
tags question: http://stackoverflow.com/q/20953531
tags question: http://stackoverflow.com/q/20922985
tags question: http://stackoverflow.com/q/20969851
tags question: http://stackoverflow.com/q/20974960
tags question: http://stackoverflow.com/q/20872223
tags question: http://stackoverflow.com/q/20883397
tags question: http://stackoverflow.com/q/20968920
tags question: http://stackoverflow.com/q/20895764
tags question: http://stackoverflow.com/q/20868472
tags question: http://stackoverflow.com/q/20890674
type: Tag
tags question: http://stackoverflow.com/q/20893454
tags question: http://stackoverflow.com/q/20972022
tags question: http://stackoverflow.com/q/20922436
tags question: http://stackoverflow.com/q/21013788
tags question: http://stackoverflow.com/q/21007276

http://stackoverflow.com/q/20953563
has body: This is my code: import java.util.*; import unit4.collectionsLib.*; public class Page255Project_class { static Scanner reader = new Scanner (System.in); /** * @param args */ public static void radixSort(int[] numbers){ Queue[] queues = new Queue[10]; for(int i=0; i&lt;numbers.length; i++){ if(numbers[i]%10 == i) { queues[i].insert(numbers[i]); System.out.println(queues[i]); } } } public static void main(String[] args) { int[] numbers = new int[10]; numbers[0] = 170; numbers[1] = 45; numbers[2] = 75; numbers[3] = 90; numbers[4] = 2; numbers[5] = 24; numbers[6] = 802; radixSort(numbers); } } And I’m getting this error: Exception in thread "main" java.lang.NullPointerException at Page255Project_class.radixSort(Page255Project_class.java:15) at Page255Project_class.main(Page255Project_class.java:33) Please help to solve that error
upvote count: 0
answer count: 1
downvote count: 5
has comment: http://stackoverflow.com/comment/31472508
has comment: http://stackoverflow.com/comment/31472104
has comment: http://stackoverflow.com/comment/31472365
favorite count: 0
has answer: http://stackoverflow.com/a/20953807
type: UnansweredQuestion
has title: Getting error by using Queue[] queues = new Queue[10];
has comment: http://stackoverflow.com/comment/31471797
score: -5
has comment: http://stackoverflow.com/comment/31471821
has comment: http://stackoverflow.com/comment/31471802
tagged with: java
tagged with: queue
type: Question

http://stackoverflow.com/a/21009410
has body: View v = tabHost.getTabWidget().getChildAt(i); if(v instanceof RelativeLayout) { // RelativeLayout } else if (v instanceof LinearLayout){ // LinearLayout } Although you probably should use findViewById() to find the Widget you want. View v = tabHost.getTabWidget().findViewById(R.id.myLinearLayoutView);
downvote count: 0
score: 3
upvote count: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21009299
answers question: http://stackoverflow.com/q/21009299
type: Answer

arrayobject
tags question: http://stackoverflow.com/q/20954958
tag name: arrayobject
type: Tag

pessimistic-locking
tags question: http://stackoverflow.com/q/20882351
type: Tag
tag name: pessimistic-locking

http://stackoverflow.com/comment/31504330
has text: I don't believe any amount of edits will save this train-wreck
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20970565

relative-path
type: Tag
tags question: http://stackoverflow.com/q/20875898
tag name: relative-path

http://stackoverflow.com/q/21015304
has comment: http://stackoverflow.com/comment/31586853
has answer: http://stackoverflow.com/a/21019546
type: Question
has comment: http://stackoverflow.com/comment/31587262
has comment: http://stackoverflow.com/comment/31586986
tagged with: adt
has comment: http://stackoverflow.com/comment/31587734
has body: Screenshot: I found error appearing on packages, but I cannot find it on whole .java files. I am using adt-bundle-windows-x86-20130522 May be someone ever got same problem
linked to: http://stackoverflow.com/q/19787919
has comment: http://stackoverflow.com/comment/31588555
upvote count: 0
answer count: 1
favorite count: 0
has title: Cannot find error on ADT
tagged with: android
score: -2
has comment: http://stackoverflow.com/comment/31586782
type: UnansweredQuestion
tagged with: java
downvote count: 2

http://stackoverflow.com/a/28955288
has body: Another option is to configure the server rather than the test client. Configure the slave node service so that it knows where the firefox is. Install location can change from node to node, or even need multiple services running on a node to support access to different versions of FF. java -jar "selenium-server-standalone-2.2.0.jar" -Dwebdriver.firefox.bin="C:\FirefoxCollection\Mozilla Firefox 36.0\firefox.exe"
has comment: http://stackoverflow.com/comment/51723571
has comment: http://stackoverflow.com/comment/53007629
upvote count: 22
downvote count: 0
score: 22
has comment: http://stackoverflow.com/comment/63297896
answers question: http://stackoverflow.com/q/20950748
type: Answer

http://stackoverflow.com/comment/31463381
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20948899
has text: @ShinTakezou what is r2l and why/how does it switch like that?

http://stackoverflow.com/comment/31448076
comment on: http://stackoverflow.com/q/20940375
type: Comment
type: QuestionComment
has text: It seems that issue is around revalidate. setIcon seems to call revalidate. If I call revalidate then my jButton does not get resized even without icon.
score: 0

http://stackoverflow.com/comment/31468356
has text: Are you sure that you print these values correctly? Your amplitude seems to have the value of frequency, frequency of phase and so on
score: 0
comment on: http://stackoverflow.com/q/20951640
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20997479
has body: I know there is a lot of thread about this topic, but most of them 3-4 years old or not related to my problem. I even do not know if somebody is using vaadin 6 (vaadin 7 seems popular). I have tried a numerous thing (adding dependencies to pom, vaadin version upgrade from 6.7.1, facets to project) I trully appreciate any thoughts, idea about the solutio, attached the exception and the pom.xml, if any more information is needed please do not hesitate. I have already spent an almost a full day to fix this problem: Exception Starting GWT compiler Compiling module applicLiquidator.applicLiquidator.gwt.AppWidgetSet Validating newly compiled units [ERROR] Errors in 'jar:file:/C:/Users/Boss/.m2/repository/com/google/gwt/gwt-user/2.3.0/gwt-user-2.3.0.jar!/com/google/gwt/editor/client/EditorDriver.java' [ERROR] Line 20: The import javax.validation.ConstraintViolation cannot be resolved [ERROR] Line 97: ConstraintViolation cannot be resolved to a type [ERROR] Errors in 'jar:file:/C:/Users/Boss/.m2/repository/com/google/gwt/gwt-user/2.3.0/gwt-user-2.3.0.jar!/com/google/gwt/editor/client/impl/AbstractSimpleBeanEditorDriver.java' [ERROR] Line 28: Name clash: The method setConstraintViolations(Iterable&lt;ConstraintViolation&lt;?&gt;&gt;) of type BaseEditorDriver&lt;T,E&gt; has the same erasure as setConstraintViolations(Iterable&lt;ConstraintViolation&lt;?&gt;&gt;) of type EditorDriver&lt;T&gt; but does not override it [ERROR] Errors in 'jar:file:/C:/Users/Boss/.m2/repository/com/google/gwt/gwt-user/2.3.0/gwt-user-2.3.0.jar!/com/google/gwt/editor/client/impl/BaseEditorDriver.java' [ERROR] Line 31: The import javax.validation.ConstraintViolation cannot be resolved [ERROR] Line 67: ConstraintViolation cannot be resolved to a type [ERROR] Errors in 'jar:file:/C:/Users/Boss/.m2/repository/com/google/gwt/gwt-user/2.3.0/gwt-user-2.3.0.jar!/com/google/gwt/editor/client/impl/SimpleViolation.java' [ERROR] Line 25: The import javax.validation.ConstraintViolation cannot be resolved [ERROR]…
has comment: http://stackoverflow.com/comment/31584979
has comment: http://stackoverflow.com/comment/31557821
accepted answer: http://stackoverflow.com/a/21418872
tagged with: maven
has comment: http://stackoverflow.com/comment/31574245
type: AnsweredQuestion
tagged with: widget
has comment: http://stackoverflow.com/comment/31555064
tagged with: java
tagged with: vaadin
tagged with: eclipse
type: Question
has title: Vaadin 6 widgetset compilation error (maven dependencies)
answer count: 1
has answer: http://stackoverflow.com/a/21418872
score: 0

http://stackoverflow.com/comment/31335674
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/20875770
has text: `char` _is_ a 16-bit data type. It does not store a character; It stores a UTF-16 code-unit. Exactly one or two UTF-16 code-units comprise a UTF-16 codepoint. A codepoint identifies a specific Unicode character. Also, you are looking at the wrong character set. Java generally uses [Unicode](http://en.wikipedia.org/wiki/Unicode#Unicode_in_use), though some stream classes default to the OS-default character set.
type: Comment

http://stackoverflow.com/a/20883086
answers question: http://stackoverflow.com/q/20882947
has body: If ProgressBar's parent is RelativeLayout, use RelativeLayout.LayoutParams. LinearLayout.LayoutParams lp = progbar.getLayoutParams(); int margin = lp.marginBottom; margin += your_value; lp.setMargins(0, 0, 0, margin); progbar.setLayoutParams(lp);
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/31340665

http://stackoverflow.com/a/20936864
score: 1
answers question: http://stackoverflow.com/q/20935617
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20935617
type: Answer
upvote count: 1
has body: Try looking here: http://hc.apache.org/httpcomponents-client-ga/httpclient/examples/org/apache/http/examples/client/ClientExecuteProxy.java It seems as though you need to specify a proxy using setProxy() and not global properties.

http://stackoverflow.com/comment/31385489
score: 0
type: Comment
type: QuestionComment
has text: You should be calling `Log.getStackTraceString(e)`. Please edit your code and your stacktrace once you've corrected this.
comment on: http://stackoverflow.com/q/20902854

http://stackoverflow.com/comment/31409095
type: Comment
comment on: http://stackoverflow.com/a/20920301
has text: Java has no support for top level static classes. Only nested classes may be static.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31443827
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20938189
has text: After you have commented out that line I told you to comment out, any errors (like exceptions) should appear on the console. If you don't have a console visible you won't be able to see the errors. How are you running your GUI?
type: Comment

http://stackoverflow.com/q/21003206
downvote count: 2
has answer: http://stackoverflow.com/a/21003334
has answer: http://stackoverflow.com/a/21003591
has title: Finding the maximum number?
favorite count: 0
upvote count: 0
has body: Ok, so I can't figure out why when I input an array of 1, 2, 100, 3, 9, 22, 58 the following code returns 100: (this is just a snippet, this is part of a larger block of code) double result = numbers[0]; for (int i = 0; i &lt; numbers.length; i++) if (numbers[i] &gt; result) result = numbers[i]; System.out.println("The max value is " + result); But without the curly brackets on the if, it prints a list of numbers leading to the biggest one, starting from the first one, in this case: 1 2 100: double result = numbers[0]; for (int i = 0; i &lt; numbers.length; i++) if (numbers[i] &gt; result) { result = numbers[i]; System.out.println("The max value is " + result); } Thanks for your help in advance, this is driving me crazy and it's probably very stupid.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31564369
has answer: http://stackoverflow.com/a/21003309
has answer: http://stackoverflow.com/a/21003283
tagged with: loops
has answer: http://stackoverflow.com/a/21003445
has answer: http://stackoverflow.com/a/21003446
type: Question
has comment: http://stackoverflow.com/comment/31564781
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/21003372
has answer: http://stackoverflow.com/a/21003290
answer count: 8

http://stackoverflow.com/a/20860468
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: You want to add to the list 10 times. So change your code to add input.nextLine() into the loop. String stoixeia=null; for(int i=0;i&lt;10;i++){ stoixeia = input.nextLine(); materialObj.add(stoixeia); } As a sidenote , classes in java by convention start with upper case so it should be MaterialsStore.
answers question: http://stackoverflow.com/q/20860380

http://stackoverflow.com/a/20899942
answers question: http://stackoverflow.com/q/20898389
has comment: http://stackoverflow.com/comment/31371153
upvote count: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: After great help from everyone, the final solution was to begin a new project, then copy/paste each important file back into it, including updating the AndroidManifest.xml file. However, the order of operations was very important. The rebuild did not work if I copy and pasted the MainActivity.java file first, rebuilding that way gave me that odd HelloWorld folder error with no other errors in all my other files. So I thought maybe rebuilding in a certain order would work, and it did. I had to do the rebuild in this order: strings.xml activity_main.xml MyService.java update the AndroidManifest.xml (with the addition of the MyService.java in &lt;service&gt; tags) then finally the MainActivity.java I then updated all imports and saved everything, and low and behold, R.java was updated with the right ids for all of my strings and other name ids. So while I still don't understand why I had a red error on my HelloWorld project folder in Package Explorer (that did not show a single error or warning anywhere else in any of my edited files), it looks like rebuilding the file by cutting and pasting in a new project, in a careful order, ended up updating the R.java so that I could run successfully in the emulator. Special thanks to @TalhaQ for suggesting my files were okay and to reuse the code. Although I know I did not edit the R.java file at all, it's still a mystery why it never updated like it should have. Might have had something to do with the order of operations in the original file, since the order of operations mattered a lot in the rebuild.
score: 3
accepted answer of: http://stackoverflow.com/q/20898389

http://stackoverflow.com/q/20886486
favorite count: 0
has body: I've just done the following Codility Peaks problem. The problem is as follows: A non-empty zero-indexed array A consisting of N integers is given. A peak is an array element which is larger than its neighbors. More precisely, it is an index P such that 0 &lt; P &lt; N − 1, A[P − 1] &lt; A[P] and A[P] > A[P + 1]. For example, the following array A: A[0] = 1 A[1] = 2 A[2] = 3 A[3] = 4 A[4] = 3 A[5] = 4 A[6] = 1 A[7] = 2 A[8] = 3 A[9] = 4 A[10] = 6 A[11] = 2 has exactly three peaks: 3, 5, 10. We want to divide this array into blocks containing the same number of elements. More precisely, we want to choose a number K that will yield the following blocks: A[0], A[1], ..., A[K − 1], A[K], A[K + 1], ..., A[2K − 1], ... A[N − K], A[N − K + 1], ..., A[N − 1]. What's more, every block should contain at least one peak. Notice that extreme elements of the blocks (for example A[K − 1] or A[K]) can also be peaks, but only if they have both neighbors (including one in an adjacent blocks). The goal is to find the maximum number of blocks into which the array A can be divided. Array A can be divided into blocks as follows: one block (1, 2, 3, 4, 3, 4, 1, 2, 3, 4, 6, 2). This block contains three peaks. two blocks (1, 2, 3, 4, 3, 4) and (1, 2, 3, 4, 6, 2). Every block has a peak. three blocks (1, 2, 3, 4), (3, 4, 1, 2), (3, 4, 6, 2). Every block has a peak. Notice in particular that the first block (1, 2, 3, 4) has a peak at A[3], because A[2] &lt; A[3] > A[4], even though A[4] is in the adjacent block. However, array A cannot be divided into four blocks, (1, 2, 3), (4, 3, 4), (1, 2, 3) and (4, 6, 2), because the (1, 2, 3) blocks do not contain a peak. Notice in particular that the (4, 3, 4) block contains two peaks: A[3] and A[5]. The maximum number of blocks that array A can be divided into is three. Write a function: class Solution { public int solution(int[] A); } that, given a non-empty zero-indexed array A consisting of N integers, returns the maximum number of blocks into whi…
has answer: http://stackoverflow.com/a/21220691
has answer: http://stackoverflow.com/a/72246674
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/26150180
tagged with: java
has answer: http://stackoverflow.com/a/69863612
answer count: 11
has answer: http://stackoverflow.com/a/59442213
score: 12
type: Question
has answer: http://stackoverflow.com/a/63229804
upvote count: 12
tagged with: algorithm
has answer: http://stackoverflow.com/a/35517680
downvote count: 0
has answer: http://stackoverflow.com/a/54634068
has answer: http://stackoverflow.com/a/20887125
has comment: http://stackoverflow.com/comment/86188847
has answer: http://stackoverflow.com/a/58482535
has answer: http://stackoverflow.com/a/68208908
has answer: http://stackoverflow.com/a/26215333
has title: Codility Peaks Complexity

http://stackoverflow.com/comment/31589903
comment on: http://stackoverflow.com/a/20972590
type: Comment
score: 0
type: AnswerComment
has text: I can't do that because one entity may have thousands of related entities. That's why I want to filter those

http://stackoverflow.com/q/21005635
upvote count: 1
tagged with: spring
has comment: http://stackoverflow.com/comment/31569784
type: Question
has comment: http://stackoverflow.com/comment/31570638
has comment: http://stackoverflow.com/comment/31570477
has comment: http://stackoverflow.com/comment/31570662
has comment: http://stackoverflow.com/comment/31569847
has comment: http://stackoverflow.com/comment/31569533
score: 1
has comment: http://stackoverflow.com/comment/31570332
tagged with: java
has comment: http://stackoverflow.com/comment/31569989
has answer: http://stackoverflow.com/a/21008158
has comment: http://stackoverflow.com/comment/31570809
has comment: http://stackoverflow.com/comment/31570460
answer count: 1
has comment: http://stackoverflow.com/comment/31570592
downvote count: 0
has comment: http://stackoverflow.com/comment/31570825
has comment: http://stackoverflow.com/comment/31570520
favorite count: 0
tagged with: groovy
has comment: http://stackoverflow.com/comment/31570368
has comment: http://stackoverflow.com/comment/31572142
has body: Spring framework supports the use of dynamic languages like Groovy. Since Groovy can be now static compiled, a groovy class is supposed to have similar performance compared with a Java class as far as I know. So for example if I write my spring beans in Groovy by importing the class files or by using the lang:groovy element like: &lt;lang:groovy id="myBean" script-source="classpath:mypackage/MyClass.groovy" /&gt; or an inline definition like: &lt;lang:groovy id="myBean"&gt; &lt;lang:inline-script&gt; package mypackage class MyClass { String helloWorld() { "Hello World" } } &lt;/lang:inline-script&gt; &lt;/lang:groovy&gt; My question is if this affects the performance of the application in comparison with using only java classes, also I wonder if there will be issues when working with beans with different scopes than singleton like prototype, session, request. Has anyone experience on developing Spring apps with this approach? I mean real world professional projects.
accepted answer: http://stackoverflow.com/a/21008158
has comment: http://stackoverflow.com/comment/31570911
has comment: http://stackoverflow.com/comment/31569724
has comment: http://stackoverflow.com/comment/31570490
has comment: http://stackoverflow.com/comment/31743639
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31570568
has title: Is there a performance downside of using Groovy with Spring?

http://stackoverflow.com/comment/31436659
type: QuestionComment
has text: Don't do that. Use an HTML or XML parser.
score: 3
comment on: http://stackoverflow.com/q/20934885
type: Comment

http://stackoverflow.com/q/20931994
has answer: http://stackoverflow.com/a/20932307
answer count: 3
downvote count: 0
has title: Update DrawString at certain interval
favorite count: 0
tagged with: timer
tagged with: paintcomponent
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20932144
has body: I'm trying to make a digital clock which then adds to a JPanel, Now when I call DrawString outside of the taskPerformer method it draws but when inside, it does not draw the String! Why is this and how would I go about implementing this class so that it redraws every second? import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JComponent; import javax.swing.JPanel; import java.util.Date; import java.util.Calendar; import java.util.GregorianCalendar; import javax.swing.Timer; class DrawDate extends JPanel { public Date ddate; public Calendar ccalendar = new GregorianCalendar(); Date time; public DrawDate() { this.ddate = new Date(); time = this.ccalendar.getTime(); } public void paint(Graphics g) { final Graphics2D g2 = (Graphics2D)g; Font font = new Font("Arial", Font.PLAIN, 50); g2.setFont(font); //THIS DRAWS THE STRING g2.drawString(time.toString() , 100, 100); ActionListener taskPerformer = new ActionListener() { public void actionPerformed(ActionEvent evt) { Calendar ccalendar = new GregorianCalendar(); Date time = ccalendar.getTime(); //THIS DOES NOT DRAW A STRING. g2.drawString(time.toString() , 200, 100); } }; final Timer timer = new Timer(1000, taskPerformer); timer.start(); } protected void paintComponent(Graphics g) { super.paintComponent(g); super.setBackground(new Color(100,100,100)); paint(g); } }
has comment: http://stackoverflow.com/comment/31431532
score: 1
tagged with: java
upvote count: 1
tagged with: swing
tagged with: calendar
accepted answer: http://stackoverflow.com/a/20932144
type: Question
possible better answer: http://stackoverflow.com/a/20932341
has answer: http://stackoverflow.com/a/20932341

http://stackoverflow.com/a/21011300
type: Answer
has body: try this code : public class ShoppingListName extend Application{ private String shoppingListName; public String getShoppingListName() { return shoppingListName; } public void setShoppingListName(String shoppingListName) { this.shoppingListName = shoppingListName; } } in Android Manifest.xml : <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> in MainMenu.java : ShoppingListName shoppinglistname = (ShoppingListName) MainMenu.this.getApplicationContext(); // Now you can get and set shoppinglistname object
answers question: http://stackoverflow.com/q/21011123
score: 0

http://stackoverflow.com/comment/31507046
score: 0
has text: See: http://www.tutorialspoint.com/java/io/objectinputstream_readobject.htm
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20972176

http://stackoverflow.com/comment/31420210
score: 1
has text: @Akshat Singhal - sounds like you're in accord with Robin Green; I wasn't aware that I was only making a reference, I was sure initializing an array with another array was the same as copying. Thanks for your input.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20926039

http://stackoverflow.com/a/20866690
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20866676
answers question: http://stackoverflow.com/q/20866676
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/31308131
has body: String weekdaygen(String s) { if (s.equals("Mon")) { s=s.replace("mon", "MONDAY"); } if (s.equals("Tue")) { s= s.replace("Tue", "TUESDAY"); } if (s.equals("Wed")) { s=s.replace("Wed", "WEDNESDAY"); } if (s.equals("Thu")) { s=s.replace("Thu", "THURSDAY"); } if (s.equals("Fri")) { s=s.replace("Fri", "FRIDAY"); } if (s.equals("Sat")) { s=s.replace("Sat", "SATURDAY"); } if (s.equals("Sun")) { s=s.replace("Sun", "SUNDAY"); } return s; } Use this code Strings in Java are immutable - when you call replace, it doesn't change the contents of the existing string - it returns a new string with the modifications. So you want: s=s.replace("mon", "MONDAY");

http://stackoverflow.com/comment/31442065
type: Comment
has text: I mean coordinate space.whatever you need to do to move the centre to be at 0 0
score: 0
comment on: http://stackoverflow.com/a/20936621
type: AnswerComment

http://stackoverflow.com/comment/31476013
score: 0
type: AnswerComment
has text: I believe this doesn't address what the OP asked. The OP (probably) wanted an alternative to the expression `s.equals("x") || ...`, not getting rid of `if` simply putting the condition inside a method as a black box. Using a method for a complex condition is a good idea *but* you should also address how to write that condition in a readable way to completely answer the question.
type: Comment
comment on: http://stackoverflow.com/a/20954060

http://stackoverflow.com/a/20928336
type: Answer
upvote count: 1
score: 1
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20928293
answers question: http://stackoverflow.com/q/20928293
type: AcceptedAnswer
has body: If you have HashMap&lt;String, String&gt; mp = new HashMap&lt;String, String&gt;(); which is properly populated (basically in the way you described), you can do the following in order to iterate through it (this way you have both the key and the value in your loop): for (String word : mp.keySet()){ System.out.println("Word: [" + word + "]; Word Description: [" + mp.get(word) + "]."); }

http://stackoverflow.com/q/20972223
downvote count: 0
has answer: http://stackoverflow.com/a/20999613
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
tagged with: spring-test
score: 3
upvote count: 3
tagged with: java
has body: I am currently experimenting with the support for WebSockets added in Spring 4.0, as described in this guide. As demonstrated in the guide, methods annotated with @MessageMapping can be added to any Spring MVC controller, which may also contain @RequestMapping methods. The spring-test module has support for writing integration tests for @RequestMapping methods (as described here) in a very simple and fluid way: @Test public void getAccount() throws Exception { this.mockMvc.perform(get("/accounts/1").accept(MediaType.parseMediaType("application/json;charset=UTF-8"))) .andExpect(status().isOk()) .andExpect(content().contentType("application/json")) .andExpect(jsonPath("$.name").value("Lee")); } Is there similar support for testing @MessageMapping methods using WebSockets? I have not found anything in any of the Spring modules, and none of the WebSocket guides contain any tests. If not, would I need to actually deploy the application and use a WebSocketConnectionManager to connect a test client? Or is there some API I can build on from spring-test? This sample project contains such a small test client, but I would prefer to integrate this into the actual tests without requiring me to deploy the application and hardcode the deployed path in the tests.
type: Question
has title: Testing @MessageMapping WebSocket methods of Spring MVC controllers

http://stackoverflow.com/a/20880169
has body: RedirectAttributes are for setting flash attributes before redirection. They are merged into model after the redirection so there is no reason to access them again via RedirectAttributes again as you have suggested. Being able to work with the attributes just like with a map might be useful. You can check what have you set (containsKey, isEmpty, ...). However the use of the wildcard generic parameter Map&lt;String, ?&gt; getFlashAttributes() prevents writing into map and it is strange why they have used it instead of a plain Object parameter.
type: Answer
has comment: http://stackoverflow.com/comment/37666506
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/20878389
downvote count: 0

http://stackoverflow.com/comment/31550917
score: 0
has text: That is quite easy - two threads are allowed to create new instance of `Multiton` object. It is obvious that only one of them will be placed in map, but if construction of `Multiton` object is expensive or it uses some kind of other common resources, you should (I want to) avoid it.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20995715

http://stackoverflow.com/comment/31571621
type: Comment
type: QuestionComment
has text: You may wish to take a look at the examples in the Oracle tutorials: http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
comment on: http://stackoverflow.com/q/21006776
score: 0

http://stackoverflow.com/comment/31370508
has text: And the webservice is working correctly if used from the web interface.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20899917

http://stackoverflow.com/q/20929077
has comment: http://stackoverflow.com/comment/31426098
has comment: http://stackoverflow.com/comment/31426013
type: Question
has comment: http://stackoverflow.com/comment/31426080
tagged with: algorithm
tagged with: data-structures
has title: Printing the friend connections level by level
answer count: 1
has comment: http://stackoverflow.com/comment/31426254
linked to: http://stackoverflow.com/q/20902223
favorite count: 0
has body: I recently encountered this question in an interview and did pretty bad at it. Setup: Assume primitive Facebook. FB has Members. class Member { String name; String email; List&lt;Member&gt; friends; } Question: Code printSocialGraph(Member m). Direct friends of m are Level 1 friends. Friends of friends are level 2 friends.....and so on Print level 1 friends first. Then print level 2 friends....and so on void printSocialGraph (Member m){ //Your code here } I tried to maintain a queue for storing the friends at each level but I did not get it very far. Any idea how we could go about solving it with all error checking conditions ?
has comment: http://stackoverflow.com/comment/31426006
has answer: http://stackoverflow.com/a/20929214
has comment: http://stackoverflow.com/comment/31425974
has comment: http://stackoverflow.com/comment/31426173
has comment: http://stackoverflow.com/comment/31426122
has comment: http://stackoverflow.com/comment/31426005
upvote count: 2
type: UnansweredQuestion
score: 0
tagged with: java
downvote count: 2

http://stackoverflow.com/q/20931957
accepted answer: http://stackoverflow.com/a/20932237
has title: repaint not working in thread
tagged with: java
linked to: http://stackoverflow.com/q/1234343
type: AnsweredQuestion
type: Question
tagged with: paintcomponent
tagged with: repaint
has body: I'm new to Java and I'm trying to make a simple snake game, but the paint method only gets called once and never again, even though the thread keeps running. I tried another fix on this site that used another class, but that did not work. public class Snake extends JPanel implements Runnable { boolean gamerunning = true; int snake_x = 50, snake_y = 50, snake_dir = 2; //for snake_dir 1=up 2=right 3=down 4=left int[] snake_xt, snake_yt; public static void main(String args[]) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(600,600); frame.setVisible(true); frame.add(new Snake()); (new Thread(new Snake())).start(); System.out.println("Running"); } @Override public void run() { try { while (gamerunning) { Thread.sleep(500); System.out.println(snake_x); tick(); repaint(); } } catch (InterruptedException e) {} } @Override public void paintComponent(Graphics g) { super.paintComponent(g); System.out.println("painting"); g.setColor(Color.black); g.fillRect(snake_x, snake_y, 10,10); } public void tick() { System.out.println("tick"); switch(snake_dir) { case 1: snake_y -= 10; break; case 2: snake_x += 10; break; case 3: snake_y += 10; break; case 4: snake_x -= 10; break; } } }
score: 0
has answer: http://stackoverflow.com/a/20932237
tagged with: multithreading
tagged with: swing
has comment: http://stackoverflow.com/comment/31432077
has comment: http://stackoverflow.com/comment/31436624
answer count: 1

http://stackoverflow.com/comment/95171270
type: Comment
has text: For hadoop 2 it called `mapreduce.job.counters.max`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/39895860

http://stackoverflow.com/a/20891718
score: 3
has comment: http://stackoverflow.com/comment/31452444
downvote count: 0
has body: There is an Eulers Theorem that applies to every planar graph. Definiton: A Planar Graph is a graph that can be drawn on the plane so that the edges do not cross each other. Any planar graph partitions the plane into a number of disjoint regions called the faces of the graph. Euler's Theorem: V-E+F=2 where: – V is the number of vertices, – E is the number of edges, – F is the number of faces However, I can not provide a solution in java since its not clear the way you want to implement that. For instance, if you want to transform a graph into planar graph; visually, you might need a canvas and elements rearrangement, which will be kind of complicated to implement. In general think algorithmic wise, creating the solution first in pseudocode. For example, since we have Euler's theorem that applies to every planar graph, you need to find a way to apply this theorem to your existing non planar graph and then test it. Steps: (probably some of them will require coordinates) Determine what are the vertices Determine what are the edges Determine what are the faces Find a way to count the vertices Find a way to count the edges Find a way to count the faces Rearrange all those in a canvas Test the theorem, if it applies then your graph is planar, otherwise, rearrange again. Note that, by the use of coordinates you can determine from the beginning if the graph can be drawn planar, however, when you draw it you should not allowed any line edges to cross.
has comment: http://stackoverflow.com/comment/31368722
has comment: http://stackoverflow.com/comment/31357878
has comment: http://stackoverflow.com/comment/31362123
has comment: http://stackoverflow.com/comment/31452458
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/20891390
has comment: http://stackoverflow.com/comment/31356357

http://stackoverflow.com/comment/31327352
comment on: http://stackoverflow.com/q/20876684
type: QuestionComment
type: Comment
has text: The display says "unreachable". What makes you think they're "retained"?
score: 1

http://stackoverflow.com/q/20898280
answer count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31386017
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31385962
has comment: http://stackoverflow.com/comment/31389827
has answer: http://stackoverflow.com/a/20912288
has title: GLSL Uniforms will not be set
tagged with: opengl
tagged with: glsl
tagged with: java
tagged with: lwjgl
has comment: http://stackoverflow.com/comment/31368194
type: Question
has body: I'm trying to understand how GLSL works, so I've been following a person on youtube: thebennnybox. I'm stuck on setting uniforms for my program. First off, here are the 2 shaders I'm currently using. vertex shader: #version 430 layout (location = 0) in vec3 position; out vec4 color; uniform float uniformFloat; void main(){ color = vec4(clamp(position, 0.0, uniformFloat), 1.0); gl_Position = vec4(0.25 * position, 1.0); } fragment shader: #version 430 in vec4 color; out vec4 fragColor; void main(){ fragColor = color; } They are both very simple, but I can't seem to set the uniformFloat variable to anything. After linking and validating both of these shaders to the shader program. I immediately try and set a value of 1.0f to uniformFloat(just for testing purposes)... and when I do this, I just get a black screen with nothing drawn on it. If I replace the uniformFloat with a 1.0f (in the shader itself), I will get exactly what I need. The code for adding and setting the uniforms is listed below: public void addUniform(String uniform) { int uniformLocation = glGetUniformLocation(shaderProgram, uniform); if(uniformLocation == -1) { System.err.println("Error: Could not find uniform: " + uniform); new Exception().printStackTrace(); System.exit(1); } uniforms.put(uniform, uniformLocation); } public void setUniformf(String uniformName, float value){ glUniform1f(uniforms.get(uniformName), value); } (uniforms is a HashMap that holds a location value for each different uniform value names) I literally, put the addUniform and setUniformf methods right after validating the if the program has been validated. Is there anything I'm missing here? Below is the code for adding the creating the shaders, linking them, and then adding the uniforms. public ProgramShader(String vertexShaderLocation, String fragmentShaderLocation) { shaderProgram = glCreateProgram(); vertexShader = glCreateShader(GL_VERTEX_SHADER); fragmentShader = glCreateShader(GL_FRAGMENT_SHADER); vertexShaderSource = new …
has comment: http://stackoverflow.com/comment/31390083
has comment: http://stackoverflow.com/comment/31371179
score: 0
upvote count: 1

http://stackoverflow.com/q/20985604
tagged with: twitter
type: Question
tagged with: stanford-nlp
downvote count: 0
has title: Using the Stanford Dependency Parser on a previously tagged sentence
has body: I'm currently using the Twitter POS tagger available here to tag out tweets into the Penn-Tree Bank tags. Here is that code: import java.util.List; import cmu.arktweetnlp.Tagger; import cmu.arktweetnlp.Tagger.TaggedToken; /* Tags the tweet text */ List&lt;TaggedToken&gt; tagTweet(String text) throws IOException { // Loads Penn Treebank POS tags tagger.loadModel("res/model.ritter_ptb_alldata_fixed.txt"); // Tags the tweet text taggedTokens = tagger.tokenizeAndTag(text); return taggedTokens; } Now I need to identify where the direct objects are in these tags. After some searching, I've discovered that the Stanford Parser can do this, by way of the Stanford Typed Dependencies, (online example). By using the dobj() call, I should be able to get what I need. However, I have not found any good documentation about how to feed already-tagged sentences into this tool. From what I understand, before using the Dependency Parser I need to create a tree from the sentence's tokens/tags. How is this done? I have not been able to find any example code. The Twitter POS Tagger contains an instance of the Stanford NLP Tools, so I'm not far off, however I am not familiar enough with the Stanford tools to feed my POS-tagged text into it in order to get the dependency parser to work properly. The FAQ does mention this functionality, but without any example code to go off of, I'm a bit stuck.
answer count: 1
tagged with: nlp
favorite count: 0
tagged with: part-of-speech
upvote count: 2
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21009773
accepted answer: http://stackoverflow.com/a/21009773
tagged with: java

http://stackoverflow.com/comment/31445775
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20939206
has text: You are not put EACH student in array, you put all data in array splitted by , (dot).

http://stackoverflow.com/comment/31588898
has text: @user3138776 - because if the numbers are between -128 and 127, Integer stores these numbers in a local cache and uses them. if numbers are >127 / <(-128), then it returns a new integer.
comment on: http://stackoverflow.com/a/21016434
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31307131
comment on: http://stackoverflow.com/q/20866021
score: 0
type: Comment
has text: @svenoaks From the logs, the Thread state is TERMINATED after unpause().
type: QuestionComment

http://stackoverflow.com/a/21016823
score: 0
type: Answer
has body: Javassist library is missing. You can download it from maven below is the link. This is mentioned in the exception itself :) http://mvnrepository.com/artifact/javassist/javassist
has comment: http://stackoverflow.com/comment/31590297
has comment: http://stackoverflow.com/comment/31590238
has comment: http://stackoverflow.com/comment/31590324
answers question: http://stackoverflow.com/q/21016585
has comment: http://stackoverflow.com/comment/31590415
has comment: http://stackoverflow.com/comment/31590202
accepted answer of: http://stackoverflow.com/q/21016585
has comment: http://stackoverflow.com/comment/31590764
has comment: http://stackoverflow.com/comment/31590599
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31590359
has comment: http://stackoverflow.com/comment/31590641

http://stackoverflow.com/a/20925922
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/20895911
accepted answer of: http://stackoverflow.com/q/20895911
has comment: http://stackoverflow.com/comment/103547940
type: AcceptedAnswer
downvote count: 0
has body: I got it to work. The mistake I made was when I got the TiffOutputDirectory, I called getOrCreateExifDirectory, but it should have been getOrCreateRootDirectory. Here is the correct code: TiffImageMetadata tmeta = (TiffImageMetadata) metadata; TiffOutputSet outputSet = tmeta.getOutputSet(); byte iccBytes[] = Util.getAdobe98ProfileBytes(); TagInfoUndefined ICC_INFO = TiffConstants.EXIF_TAG_INTER_COLOR_PROFILE; TiffOutputField field = new TiffOutputField(ICC_INFO, FieldType.UNDEFINED, iccBytes.length, iccBytes); TiffOutputDirectory rootDirectory = outputSet.getOrCreateRootDirectory(); rootDirectory.removeField(ICC_INFO); rootDirectory.add(field); TiffImageWriterLossless writerLossless = new TiffImageWriterLossless(imageBytes); writerLossless.write(new FileOutputStream(resultingFilePath), outputSet); This is how you embed an ICC_Profile in TiffOutputSet.

http://stackoverflow.com/comment/31359729
has text: Try using Number instead of Integer. Other than that I'd expect this to work although it's a while since I've done something like that. See if you can get anything useful from: http://developer.classpath.org/doc/javax/swing/SpinnerNumberModel-source.html
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20887453

http://stackoverflow.com/a/20913522
has body: processInput(); instead try some thing like this. Make sure function name starts with small letter. public void onTextChanged(CharSequence s, int start, int before, int count) { ProcessInput(s.toString()); }
accepted answer of: http://stackoverflow.com/q/20913461
score: 0
answers question: http://stackoverflow.com/q/20913461
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31396940
type: Answer
has comment: http://stackoverflow.com/comment/31396908
has comment: http://stackoverflow.com/comment/31405348

http://stackoverflow.com/comment/31431185
type: QuestionComment
comment on: http://stackoverflow.com/q/20931900
score: 1
has text: this doesn't compile `java.sql.Statement statement.execute(q);` is not a valid statement [ :) ]
type: Comment

http://stackoverflow.com/q/20985622
has comment: http://stackoverflow.com/comment/31532983
type: UnansweredQuestion
tagged with: boolean
has comment: http://stackoverflow.com/comment/31547474
has body: The class "board" wants to know if any of his objects in the array is clicked. So he have a function private void CheckButtons() { for(int y = 0; y &lt; yheight; y++) { for(int x = 0; x &lt; xwith; x++) { if(_boardNodes[x][y].NodeClick()) { MoveIfICan(x,y); } } } } This "board" class have a function that is called by its own thread to always check if a button is clicked. It does that by the above function that calls a inner function of the class Node What i want to do, is a way to return true if the label is clicked. The function in the node class looks like this public boolean NodeClick() { _isClicked = false; _clickAbleLabel.addMouseListener(new MouseAdapter(){ public void mouseClicked(MouseEvent e) { _isClicked = true; System.out.println("Clicked button respons"); } }); System.out.println("Is Clicked: " + _isClicked); return _isClicked; } This dont work at all. So i need tips on a better solution than this failed one. Note: I always get a "Clicked button respons" but the _isClicked will remain false at all time. //Thanks
tagged with: button
answer count: 0
type: Question
has comment: http://stackoverflow.com/comment/31532913
has title: Return boolean from Mouselistener
tagged with: jframe
score: 0
tagged with: swing
has comment: http://stackoverflow.com/comment/31532919
tagged with: java

http://stackoverflow.com/q/20917777
tagged with: c++
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/20918022
type: Question
has comment: http://stackoverflow.com/comment/31404665
tagged with: java-native-interface
score: 18
has comment: http://stackoverflow.com/comment/31404406
upvote count: 18
has comment: http://stackoverflow.com/comment/31404601
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31404640
favorite count: 0
has answer: http://stackoverflow.com/a/20918022
has title: JNI error : Local reference table overflow 512 entries
tagged with: android
has body: My function looks like below. And it is getting executed for a number of times.At certain point it is crashing at jobject nvarObject = env->GetObjectField (var1, nvar1) giving error JNI error : Local reference table overflow 512 entries. Could anyone look into this issue and throw some light.

http://stackoverflow.com/comment/31547503
has text: @San join chat @ http://chat.stackoverflow.com/rooms/44769/discussion-between-raghunandan-and-san
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20993108

http://stackoverflow.com/a/20958911
type: Answer
accepted answer of: http://stackoverflow.com/q/20952662
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/20952662
type: AcceptedAnswer
downvote count: 0
has body: Even test emails need to be signed with DKIM/SPF in order to prevent spoofing, and I'm not sure if there's a way to do that with SMTP. If you don't want to use Apps Script, a Google Apps domain (with proper DKIM/SPF configuration) is probably your best bet.

http://stackoverflow.com/q/21007594
has comment: http://stackoverflow.com/comment/31573679
has comment: http://stackoverflow.com/comment/31573505
has comment: http://stackoverflow.com/comment/31573979
has comment: http://stackoverflow.com/comment/31573282
has comment: http://stackoverflow.com/comment/31573855
linked to: http://stackoverflow.com/q/24551
has answer: http://stackoverflow.com/a/21007981
has answer: http://stackoverflow.com/a/21007839
has comment: http://stackoverflow.com/comment/31573751
answer count: 4
has comment: http://stackoverflow.com/comment/31573583
has comment: http://stackoverflow.com/comment/31573821
favorite count: 0
type: UnansweredQuestion
has title: Java - When making objects, where should they be put in the code
has comment: http://stackoverflow.com/comment/31573573
has comment: http://stackoverflow.com/comment/31573555
downvote count: 1
score: 3
has comment: http://stackoverflow.com/comment/31573587
has comment: http://stackoverflow.com/comment/31573466
has comment: http://stackoverflow.com/comment/31573898
has comment: http://stackoverflow.com/comment/31573705
tagged with: java
has answer: http://stackoverflow.com/a/21008181
has body: Im still learning and have noticed many inconsistencies when it comes to coding. I take it Java is pretty much like Photoshop in the way that a single task can be done many different ways and still have the job done. One of my main questions is when it comes to Scanner and Random. In one source they have Scanner in the scope of the whole class public class test { private static Scanner input = new Scanner(System.in); } In another source they have it like this public class test { private static Scanner input; public static void main(String[] args) { input = new Scanner(System.in); } } What is the difference with this? Is there a right way and a wrong way?
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/31573381
has answer: http://stackoverflow.com/a/21007970

http://stackoverflow.com/q/20893295
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/31358500
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/20893971
tagged with: threadpool
tagged with: java
has body: I have this program which is a window with 20 bouncing balls (threads) which have randomly generated size, speed, direction and location. They also have a randomly generated maximum number of bounces against the walls they can take. When that number is exceeded the Thread stops its work. My question would be how could I incorporate a ThreadPool into the program so that when one Thread stops its work a new one is started instead of it? public class BouncingBalls extends JPanel{ private ArrayList&lt;Ball&gt; balls = new ArrayList&lt;Ball&gt;(); private static final long serialVersionUID = 1L; private static final int box_width = 1000; private static final int box_height = 800; public BouncingBalls() { this.setPreferredSize(new Dimension(box_width, box_height)); createBalls(); gameStart(); } public void createBalls(){ for(int i=0;i&lt;20;i++){ Ball ball = new Ball(this); balls.add(ball); } } public void gameStart() { Thread gameThread = new Thread() { public void run() { for(Ball b : balls){ b.start(); } } }; gameThread.start(); } @Override public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; for(Ball b : balls){ b.draw(g2d); } } public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { JFrame frame = new JFrame("Bouncing Balls"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setContentPane(new BouncingBalls()); frame.pack(); frame.setVisible(true); } }); } } public class Ball extends Thread{ private Ellipse2D.Double thisBall; private int posX; private int posY; private int radius; private int maxBounces; private int bounces = 0; private int deltaX, deltaY; private BouncingBalls mainWindow; public Ball(BouncingBalls mainWindow){ this.posX = 0 + (int)(Math.random() * ((975 - 0) + 1)); this.posY = 0 + (int)(Math.random() * ((775 - 0) + 1)); this.radius = 6 + (int)(Math.random() * ((20 - 6) + 1)); this.deltaX = -10 + (int)(Math.random() * 21); this.deltaY…
has title: How to use Java ThreadPool in a bouncing balls program?
has comment: http://stackoverflow.com/comment/31358917
score: 0
has comment: http://stackoverflow.com/comment/31368555
answer count: 1
has comment: http://stackoverflow.com/comment/31368525
linked to: http://stackoverflow.com/q/11832943

http://stackoverflow.com/comment/31898937
comment on: http://stackoverflow.com/a/20989647
score: 0
type: AnswerComment
type: Comment
has text: @Nitesh When you tried with the catch block did execution go into the catch block?

http://stackoverflow.com/comment/31565265
has text: That seems like exactly what I need thanks. Can you also provide code as to how I would request that in my app? Permissions are set as my app also posts data to my server using httprequest but how do I receive? I would replace the hardcoded lat, lngs with variables like this: "http://maps.googleapis.com/maps/api/directions/json?origin="+lat+","+lng+"&destination=51,19&sensor=false" Just what method and/or technique should I use? Thanks
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21003021

http://stackoverflow.com/q/20865669
has title: Spring ROO chained (dynamic) combobox
tagged with: java
type: Question
tagged with: spring-roo
answer count: 1
has answer: http://stackoverflow.com/a/20867164
score: 0
has body: I am starting with Spring ROO now, and I need to add a couple chained comboboxes. I have the Country and State comboboxes inside one page. I would like the STATE select to be populated based on the COUNTRY previously selected value. Is there a way to do that? Thanks in advance!
tagged with: dynamic
type: UnansweredQuestion
tagged with: select

http://stackoverflow.com/a/20967894
type: Answer
has comment: http://stackoverflow.com/comment/31499636
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31499525
has body: You can't guarantee that new Date() will give you the current time accurately. Often it can be wrong by up to about 10ms. Calling new Date() uses System.currentTimeMillis(). The Javadoc for currentTimeMillis() says Returns the current time in milliseconds. Note that while the unit of time of the return value is a millisecond, the granularity of the value depends on the underlying operating system and may be larger. For example, many operating systems measure time in units of tens of milliseconds. So it's OS dependent. My experience is that Windows is particularly bad at giving you accurate dates. And you certainly can't guarantee that you'll get different dates from successive calls to new Date().
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20967606
answers question: http://stackoverflow.com/q/20967606

http://stackoverflow.com/q/20986685
tagged with: jruby
favorite count: 0
upvote count: 1
tagged with: swing
has title: JRuby/Java Swing Tooltip Overlapping Window frame slows display to 4 Hz
has comment: http://stackoverflow.com/comment/32051406
type: AnsweredQuestion
tagged with: performance
has answer: http://stackoverflow.com/a/20988844
accepted answer: http://stackoverflow.com/a/20988844
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32059580
type: Question
has comment: http://stackoverflow.com/comment/31543763
answer count: 1
tagged with: tooltip
downvote count: 0
has body: We are building/maintaining a complex motion-control-platform control application with 14 subsystems, each with its own thread, including several animated 2D or 3D windows. Legacy requirements mandate JRuby 1.5.2 running on top of Java jre6 jdk1.6.0_21 with Java3D 1.5.2, on top of Windows (XP or 7). When a Java Swing tooltip popup in one of the 2D control-panel windows, null Layout, overlaps &amp; falls outside the bottom edge or sometimes the right edge of the window, the overall Windows Java screen update rate (for all the windows) slows from 16 Hz to 4 Hz. Often this effect continues until one of the windows is resized. Sometimes this effect goes away when the tooltip disappears. Occasionally the effect doesn't occur at all. This occurs both on 32-bit Windows XP and 64-bit Windows 7, pointing more towards Java. There are other amusing bugs where the Windows sleep clock actually speeds up when random unrelated third-party communications applications are running, but I think that's a red herring--this one's definitely a Java + Windows windows-layout bug. Best guess is Windows can't handle Java's resizing the effective window area rapidly? But then why would the effect continue even after the tooltip popup goes away? One source reports improvements with ensuring that all tooltips are "wider than 150 pixels". It is one workaround, although: since the mechanism for the bug is not known, and the bug is stochastic, this helpful voodoo does not seem to guarantee a solution; as well, it precludes short tooltips. Does anyone know WHY this combination of JRuby/Java/Swing/Windows is having problems with tooltips, and what can be done about it seriously?

http://stackoverflow.com/a/20868311
has comment: http://stackoverflow.com/comment/31311293
has body: When using blocking mode, you will always get at least 1 byte. Note: you might only get 1 byte, it doesn't read "messages". When using non-blocking mode, you will get 0 most of the time, in fact whenever there is not a packet waiting for you. In TCP, data is sent in packets, not messages. This means if you send 1 MB, most likely it will be broken into packets of your MTU size e.g. ~1500 bytes. If you read this socket, you will most likely see blocks of this size or a multiple if multiple packets came in since the last read. You will never see part of a packet, unless you read less than the available data. e.g. if 1500 bytes is waiting and you read just 8 bytes, you get part of that packet.
has comment: http://stackoverflow.com/comment/31311401
type: Answer
accepted answer of: http://stackoverflow.com/q/20868269
has comment: http://stackoverflow.com/comment/31311883
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/31311188
answers question: http://stackoverflow.com/q/20868269
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/31348495
type: Comment
type: QuestionComment
has text: An NPE could occur if you have a key with a corresponding value that is `null` in the table. But if you really only use `setMaxCoordRange` this cannot happen because the `float` is boxed in automatically. Did you check that all entries in the table have a non `null` value?
comment on: http://stackoverflow.com/q/20888170
score: 0

http://stackoverflow.com/comment/31314889
has text: @AndrewThompson he has good reasons to "imagine", as in other more powerful languages like C and C++ you can do it with memset, which is far more efficient than a loop. However, in Java this is not possible.
type: Comment
comment on: http://stackoverflow.com/q/20870353
type: QuestionComment
score: 2

http://stackoverflow.com/a/21840800
score: 46
downvote count: 4
answers question: http://stackoverflow.com/q/20918650
upvote count: 50
type: Answer
has body: Types are a construct used for writing programs in a manner that allows the compiler to check the correctness of a program. A type is a proposition on a value - the compiler verifies that this proposition is true. During the execution of a program, there should be no need for type information - this has already been verified by the compiler. The compiler should be free to discard this information in order to perform optimisations on the code - make it run faster, generate a smaller binary etc. Erasure of type parameters facilitates this. Java breaks static typing by allowing type information to be queried at runtime - reflection, instanceof etc. This allows you to construct programs that cannot be statically verified - they bypass the type system. It also misses opportunities for static optimisation. The fact that type parameters are erased prevents some instances of these incorrect programs to be constructed, however, more incorrect programs would be disallowed if more type information was erased and the reflection and instanceof facilities were removed. Erasure is important for upholding the property of "parametricity" of a data type. Say I have a type "List" parameterised over component type T. i.e. List&lt;T&gt;. That type is a proposition that this List type works identically for any type T. The fact that T is an abstract, unbounded type parameter means that we know nothing about this type, therefore are prevented from doing anything special for special cases of T. e.g. say I have a List xs = asList("3"). I add an element: xs.add("q"). I end up with ["3","q"]. Since this is parametric, I can assume that List xs = asList(7); xs.add(8) ends up with [7,8] I know from the type that it doesn't do one thing for String and one thing for Int. Furthermore, I know that the List.add function can not invent values of T out of thin air. I know that if my asList("3") has a "7" added to it, the only possible answers would be constructed out of the values "3" and "7". There is…

http://stackoverflow.com/comment/31317221
comment on: http://stackoverflow.com/q/20871374
score: 0
has text: call is not being recorded,as u can see i have added code of startrecording in call_state_offhook.But this code is not even called.Could not get it,why this code is not being called on call state changed..
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20880348
has comment: http://stackoverflow.com/comment/31362495
tagged with: http://stackoverflow.com/tag/html
type: UnansweredQuestion
tagged with: java
has body: i have made a simple wepp app in struts2 that logs in and add user the log in and registration page are all running ok..but i had a problem when i registered the same email it was successful i wanted to add a simple error that when the email is already registered it may not be used again to register another user i found a couple of validation but it does not answer my question ideas on how to do this kind of validation is appreciated this is a similar problem but it has no answer as well http://www.rqna.net/qna/ypywn-how-to-show-error-message-on-struts2-jquery-dialog-box.html i read this one but i think its a different kind of validation http://struts.apache.org/release/2.2.x/docs/fielderror.html
linked to: http://stackoverflow.com/q/20856712
type: Question
has comment: http://stackoverflow.com/comment/31334665
tagged with: javascript
tagged with: struts2
score: 0
has answer: http://stackoverflow.com/a/20895974
has comment: http://stackoverflow.com/comment/31334272
linked to: http://stackoverflow.com/q/20795421
answer count: 1
has title: show error message on struts2 jquery dialog box
tagged with: jquery

http://stackoverflow.com/comment/31411633
type: QuestionComment
has text: @MarounMaroun, Intellij IDEA
comment on: http://stackoverflow.com/q/20921753
score: 0
type: Comment

http://stackoverflow.com/comment/31586919
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21015379
has text: `Goof 23N, 45, 88, GOOF 33*, 12-24;` this isn't correct String, do you mean `String test =" Goof 23N, 45, 88, GOOF 33*, 12-24";` instead?
score: 0

http://stackoverflow.com/comment/31344831
comment on: http://stackoverflow.com/q/20886075
type: Comment
type: QuestionComment
has text: this is all my code, http://pastebin.com/je40k1ct thanks
score: 0

http://stackoverflow.com/a/24053169
answers question: http://stackoverflow.com/q/21013395
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer
has body: I had the same problem i resolved this error: You need to do one change in your index.jsp file. Change the action in form. (try both form lines one by one) &lt;%@ taglib uri="/struts-tags" prefix="s" %&gt; &lt;s:form action="RegisterAction.action"&gt; or &lt;s:form action="register.action"&gt; &lt;s:textfield name="name" label="Name"&gt;&lt;/s:textfield&gt; &lt;s:password name="password" label="Password"&gt;&lt;/s:password&gt; &lt;s:submit value="register"&gt;&lt;/s:submit&gt; &lt;/s:form&gt; I hope it solve your problem.
accepted answer of: http://stackoverflow.com/q/21013395
type: Answer

http://stackoverflow.com/q/20940160
possible better answer: http://stackoverflow.com/a/20965118
has comment: http://stackoverflow.com/comment/31447404
answer count: 3
has comment: http://stackoverflow.com/comment/31456911
has comment: http://stackoverflow.com/comment/31447396
favorite count: 0
has answer: http://stackoverflow.com/a/20965118
has body: import java.util.ArrayList; public class Euler4{ public static void main(String [] args){ int size = 0; int product = 0; for(int i = 102; i &gt; 100; i--){ for(int j = 102; j &gt; 100; j--){ ArrayList&lt;Integer&gt; digits = new ArrayList&lt;Integer&gt;(); product = i*j; int index = 0; while(product &gt; 0){ digits.add(index,product%10); product /= 10; index++; } for(int element : digits) System.out.println("digits :" + element); size = digits.size() - 1; if(test(0,size,digits)){ System.out.println("i and j " + i + " " + j); break; } } } } public static boolean test(int i, int size, ArrayList&lt;Integer&gt; digits){ if(digits.get(size).equals(digits.get(i))){ if(size == i || size - i == 1){ return true; }else{ System.out.println("i: " + i + " size: " + size + " digits@i: " + digits.get(i) +" digits@size " + digits.get(i)); size--; i++; if(!test(i, size, digits)) return false; } } return false; } } Here's the output: digits :4 index: 0 digits :0 index: 1 digits :4 index: 2 digits :0 index: 3 digits :1 index: 4 digits :2 index: 0 digits :0 index: 1 digits :3 index: 2 digits :0 index: 3 digits :1 index: 4 digits :2 index: 0 digits :0 index: 1 digits :3 index: 2 digits :0 index: 3 digits :1 index: 4 digits :1 index: 0 digits :0 index: 1 digits :2 index: 2 digits :0 index: 3 digits :1 index: 4 i: 0 size: 4 digits@i: 1 digits@size 1 i: 1 size: 3 digits@i: 0 digits@size 0 I think there's a problem with the while loop and a problem with the recursion. The values that get ran through the test() method is the last set of values that goes into the array and that is 10201 so then even though the while loop messed up, the recursive method should still have returned true. I don't know why it's not. This is the problem: http://projecteuler.net/problem=4 Thanks. EDIT: I fixed it up to be a bit more efficient and to give the max palindrome instead of just listing palindromes. Here's the final if anyone is interested: http://pastebin.com/qJUpZVzK
has comment: http://stackoverflow.com/comment/31450083
has answer: http://stackoverflow.com/a/20940443
accepted answer: http://stackoverflow.com/a/20940443
tagged with: recursion
score: 2
has title: Palindrome program, cannot terminate loop, Project Euler #4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20940310
downvote count: 0
tagged with: java
tagged with: loops
has comment: http://stackoverflow.com/comment/31447446
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/31448032

gwt-designer
type: Tag
tag name: gwt-designer
tags question: http://stackoverflow.com/q/20962961
tags question: http://stackoverflow.com/q/20983481

http://stackoverflow.com/q/20877639
tagged with: apache-poi
answer count: 0
has body: I am trying to get all the cells of a particular row and populate that in a cell array using apache POI just like that in jxl. Is that possible ? What are the other alternate ways of performing this using apache POI ?
tagged with: java
has comment: http://stackoverflow.com/comment/31328862
type: Question
score: 0
has title: Is it possible to get the entire cells of a specific row using apache POI and populate that in a cell array just like the case in jxl library?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31329150

http://stackoverflow.com/q/20960331
downvote count: 0
favorite count: 0
has title: Bounding box doesn't rotate when the sprite rotates
has comment: http://stackoverflow.com/comment/31487905
has body: Working on a simple Java 2D game. A tank is controlled by the user. It can be rotated in any angle, and it moves in the direction of that angle. I'm making a bounding box for the tank, so later I can add collision detection. Currently, I have the box following the sprite wherever it goes, but it doesn't rotate when the sprite rotates. I tried to add code to make the box rotate with the sprite, but adding this code simply makes the bounding box go crazy. It doesn't appear as a box anymore, more like a line just flickering and moving around. (Obviously the bounding box should be invisible, but for now I'm drawing it on the screen to check for problems). xcoo[] and ycoo[] are both of type double and hold four values each. These values are the coordinates of the four vertices of the bounding box (a rectangle-shaped Path2D). (Please note that an actual bounding box is only created when it needs to be drawn on the screen, or in collision detection which I haven't written yet. Most of the time, it's just coordinates.) The Tank's move() method is called every cycle of the game-loop. The move() method updates the location of the sprite, and the location of the bounding box. This works fine. But as I said, trying to rotate the bounding box in that method (aka manipulate it's vertices using the rotation matrix), makes it go Here is the Tank's move() method: public void move(){ // Updates the location of the sprite. (works) x += dx; y += dy; bbCenterX += dx; bbCenterY += dy; // Updates the location of the bounding box. (works) for(int i=0;i&lt;4;i++){ xcoo[i] += dx; ycoo[i] += dy; } // Should rotate the bounding box (aka, manipulate it's coordinates // so when it is created with these coordinates, it's rotated). // (Doesn't work). for(int z=0;z&lt;4;z++){ xcoo[z] = xcoo[z] - bbCenterX; ycoo[z] = ycoo[z] - bbCenterY; xcoo[z] = ((xcoo[z] * Math.cos(angle)) - (ycoo[z] * Math.sin(angle))); ycoo[z] = ((xcoo[z] * Math.sin(angle)) + (ycoo[z] * Math.cos(angle))); xcoo[z] = xcoo[z] + bb…
answer count: 1
score: 1
type: UnansweredQuestion
tagged with: bounding-box
upvote count: 1
tagged with: sprite
has answer: http://stackoverflow.com/a/20961277
tagged with: java
type: Question
tagged with: rotation

http://stackoverflow.com/comment/68292399
has text: This setting helped me.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/36661360

http://stackoverflow.com/comment/39631384
type: Comment
has text: Your EntityManager *is* Hibernate, correct? It sounds like it is working, so what is the question? If it is not working, I suggest posting a full question here. You will probably get more answers.
type: AnswerComment
comment on: http://stackoverflow.com/a/20919015
score: 0

http://stackoverflow.com/comment/31493170
has text: http://www.gwtproject.org/javadoc/latest/com/google/gwt/http/client/Response.html
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20964534

http://stackoverflow.com/comment/71595315
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21004893
type: Comment
has text: @fanky How is anybody but you possibly going to know what is in your JAR files? The question is ridiculous.

http://stackoverflow.com/a/20943558
has body: I am pretty sure from recent experiments that there is no way to suppress it. For the script to detect the plug-in versions, it must invoke the plug-in itself. After those experiments I worked to create a script that could detect a variety of things out about the Java plug-in without invoking the plug-in itself. They relied on examining the mime-types info. This still shows a warning in IE if opened from the local file-system. But I hope it will be more forgiving if loaded from the internet. Please report back. But note this is what it reports for IE when the 'allow scripts' check is OK'd. HTML &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset="UTF-8"&gt; &lt;title&gt;Java Information - Non Deployment Toolkit Script&lt;/title&gt; &lt;meta name='author' content='Andrew Thompson'&gt; &lt;meta name='description' content='Non Deployment Toolkit Script'&gt; &lt;script src='mimetypes.js'&gt;&lt;/script&gt; &lt;style type='text/css'&gt; .true { background-color: #6F6; } .false { background-color: #FB0; } .undefined { background-color: #FF0; } .datum { font-family: monospace; } td { padding: 4px; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;Java on this PC&lt;/h1&gt; &lt;h2&gt;Overview&lt;/h2&gt; &lt;p&gt;This page endeavors to ascertain the installation, availability &amp;amp; version of the Java installed on the client PC. More importantly, it attempts to discover the information &lt;b&gt;without invoking the Java Plug-In&lt;/b&gt; itself. The last part is what makes it different to the Deployment Toolkit Script supplied by Oracle. &lt;/p&gt; &lt;script type='text/javascript'&gt; document.write("&lt;h2&gt;Browser Info.&lt;/h2&gt;"); document.write(getBrowserInfo()); document.write("&lt;h2&gt;Basic Info.&lt;/h2&gt;"); document.write("&lt;table border='1'&gt;"); document.write(get3CellRow('&lt;b&gt;Enabled&lt;/b&gt;', isJava(), 'Java is enabled (1.1+) - IE info. (short of ActiveX) stops here')); document.write(get3CellRow('&lt;b&gt;Version&lt;/b&gt;'…
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31455089
upvote count: 2
has comment: http://stackoverflow.com/comment/31455792
type: Answer
has comment: http://stackoverflow.com/comment/31455810
answers question: http://stackoverflow.com/q/20943489

http://stackoverflow.com/q/20958436
linked to: http://stackoverflow.com/q/9639195
has title: Why many-to-one bidirectional association requires update and insert set to false
score: 1
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/20976890
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: oracle-database
has body: The Hibernate document says that if I want to use a list then I need to set the properties for update="false" and insert="false". Please let me know why these attributes are needed and how is this useful? If you use a List, or other indexed collection, set the key column of the foreign key to not null. Hibernate will manage the association from the collections side to maintain the index of each element, making the other side virtually inverse by setting update="false" and insert="false": &lt;class name="Person"&gt; &lt;id name="id"/&gt; ... &lt;many-to-one name="address" column="addressId" not-null="true" insert="false" update="false"/&gt; &lt;/class&gt; &lt;class name="Address"&gt; &lt;id name="id"/&gt; ... &lt;list name="people"&gt; &lt;key column="addressId" not-null="true"/&gt; &lt;list-index column="peopleIdx"/&gt; &lt;one-to-many class="Person"/&gt; &lt;/list&gt; &lt;/class&gt; I have also gone through this post Setting update and insert property in Hibernate, but when I wrote a simple program to create and save my Person and Address objects I can see that addressId property is inserted and updated by hibernate itself: Hibernate: insert into Address (addressId) values (?) Hibernate: insert into person1 (addressId, peopleId, personId) values (?, ?, ?) Hibernate: insert into person1 (addressId, peopleId, personId) values (?, ?, ?) 09:19:08,526 DEBUG AbstractCollectionPersister:1205 - Inserting collection: [partc.onetomany1.Address.people#156] Hibernate: update person1 set addressId=?, peopleId=? where personId=? Hibernate: update person1 set addressId=?, peopleId=? where personId=? But as per comments given by JB Nizet and Thomas, this should not happen. Please let me know if I misunderstood the concept.
upvote count: 1
type: Question

http://stackoverflow.com/comment/31429776
type: Comment
has text: It seems sendEmail is Null, so make sure that R.id.settings is defined in your layout
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/20931084

http://stackoverflow.com/q/20954544
has title: Is it possible to avoid jxls range transformation?
type: Question
has body: I have an excel template, with two sheets. Both have a foreach, that prints some data in the final excel file. However, in the second sheet I need to have reference values in the first sheet that are inside foreach too. So the problem, is that, jxls will transform the formulas in the second sheet as a range, and I want a direct relation. For example: Sheet1 A1 --&gt; &lt;jx:forEach items="${departments}" var="department"&gt; A2 --&gt; ${department.name} | ${department.chief} A3 --&gt; &lt;/jx:forEach&gt; Sheet2 A1 --&gt; 'Sheet 1'!A2 After processing data values, assuming we have 3 departments, I'll have something like: Sheet1 A2 ---&gt; department1 A3 ---&gt; department2 A4 ---&gt; department3 Sheet2 A2 ---&gt; #VALUE (PROBLEM: This happens because jxls references 'Sheet 1'!A1:A3) A3 ---&gt; #VALUE (PROBLEM: This happens because jxls references 'Sheet 1'!A2:A3) A4 ---&gt; department3 (PROBLEM: In this case it works, because range one only element - 'Sheet 1'!A3:A3) Is it possible to avoid or workaround this behaviour? Thanks
has answer: http://stackoverflow.com/a/24655089
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: jxls
tagged with: java

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/20884717
tags question: http://stackoverflow.com/q/20882927
type: Tag
tags question: http://stackoverflow.com/q/20994423
tags question: http://stackoverflow.com/q/20915745

http://stackoverflow.com/a/20904122
type: Answer
downvote count: 0
has body: Yes we can simply implement that method in class A. But let be give a example of Interface so that you can understand your code. There is a concept of Re-usability in OOPs. An interface defines a new secondary datatype in Java. An interface is a reference type only its objects cannot be created. An interface can inherit another interface but cannot inherit any class. A class cannot inherit any interface but it (a class) can implement zero to many interfaces. If a class implements interfaces then 1) It has to override all the abstract methods of all the implemented interfaces. 2) Type compatibilty gets created between the interface and the class. It allows an interface reference can refer to object of implementing class. */ interface Iface { int x = 3;//final and public by default void f();//abstract and public by default } interface AnotherI extends Iface { //more declarations possible here } class InterfaceDemo implements Iface { public void f() { int i; for(i =0 ; i&lt; x; i++) System.out.println("Interfaces are widely used"); } public static void main(String args[]) { Iface ref = new InterfaceDemo(); ref.f();//allowed //ref.newMethodsOfClass();//not allowed } }
score: 1
answers question: http://stackoverflow.com/q/20903983
upvote count: 1

osx-mavericks
type: Tag
tags question: http://stackoverflow.com/q/20860119
tags question: http://stackoverflow.com/q/21014784
tags question: http://stackoverflow.com/q/20999347
tag name: osx-mavericks
tags question: http://stackoverflow.com/q/21015180

http://stackoverflow.com/q/21011048
linked to: http://stackoverflow.com/q/3280353
tagged with: eclipse
has title: How to call methods that is in an external library?
type: Question
has body: I have already linked the necessary jar file to the project that I'm building right now. But when I tried to call methods supported by that .jar library, Eclipse told me that "this method can't be resolved". Now what should I do? Is there any syntax, such as "import xxx.jar;" that I have to add to the source to make it work? Again, sorry I am sort of new to java. I could easily do that on linux with a tag but can't see how to accomplish the same thing with eclipse. I know it is confusing without pictures but I'm not allowed to post any since I just registered.
answer count: 1
has comment: http://stackoverflow.com/comment/31579534
has comment: http://stackoverflow.com/comment/31579529
favorite count: 0
has answer: http://stackoverflow.com/a/21011275
has comment: http://stackoverflow.com/comment/31579453
upvote count: 2
has comment: http://stackoverflow.com/comment/31579486
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31579651
accepted answer: http://stackoverflow.com/a/21011275
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31579443

http://stackoverflow.com/comment/31568226
score: 1
type: QuestionComment
has text: I don't understand this community/industry's obsession with ignoring performance. When you don't design for performance, it doesn't perform. Maybe it's fine for mickey mouse applications, but if you know you have to scale, why wouldn't you plan for it?
type: Comment
comment on: http://stackoverflow.com/q/21004935

http://stackoverflow.com/q/20930752
score: 1
tagged with: jquery
favorite count: 0
tagged with: ajax
has comment: http://stackoverflow.com/comment/31429089
has comment: http://stackoverflow.com/comment/31433763
type: UnansweredQuestion
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/31429702
has comment: http://stackoverflow.com/comment/31429425
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31429609
has comment: http://stackoverflow.com/comment/31431190
has answer: http://stackoverflow.com/a/20936448
has body: i am using Spring mvc in a application and it has a submission form.The form has for example - firstName, lastName fields and a submit button (type="submit"). what i am trying to achieve is when i click submit button , it should perform the validation on the fields (firstName, lastName) and than the submit button should submit the value. i tried the below code: home.jsp &lt;form:form id="formDataBean" method="post" modelAttribute="formDataBean" action="submit" class="form" &gt; &lt;input id="firstName" name="firstName" value="${firstName}"/&gt; &lt;input id="lastName" name="lastName" value="${lastName}"/&gt; &lt;input id="submitButtonid" type="submit" value="Submit"/&gt; &lt;/form:form&gt; &lt;script&gt; $(document).ready(function(){ $("#formDataBean").submit(function( event ) { // validation code below var firstName = $("#firstName").val(); var lastName = $("#lastName").val(); var infoToValidate = new Array(); infoToValidate.push(firstName); infoToValidate.push(lastName); // ajax call to controller to validate the values $.ajax({ url : "validate", type : "GET", data : "infoToValidate=" + infoToValidate, //Stringified Json Object success : function(data) { if(data == valid){ //i want to re invoke the submit button without any code $("#formDataBean").submit(function( event ) {} } if(data == inValid){ //i want to prevent the submit button action to propagate further event.preventDefault(); } }, error : function() { alert("fail"); } }); } } &lt;/script&gt; HomeController.java @RequestMapping(value = "/submit", method = RequestMethod.POST) public String submitInfo(FormDataBean formDataBean, Model model){ // submission code return "home"; } @RequestMapping(value = "/validate" , method = RequestMethod.GET) public String validateResult(@RequestParam String[] infoToValidate) { // validation code if valid{ return "valid"; } else{ return "inValid"; } } Here is the Problem : if i wont call ajax in validation function than the code will work fine (first validation will happen a…
has comment: http://stackoverflow.com/comment/31429678
has title: Validate form fields (ajax call included in validation function) before submitting the values
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/31316416
has text: It's... complicated. In Datastore each Entity has only one parent, enabling one-to-many relationships. You also want the option of many-to-many relationships. The usual way to model that in a one-to-many system is to add a third kind of Entity whose records link the other two. I'll try to extend my first example that way.
type: AnswerComment
comment on: http://stackoverflow.com/a/20859295
type: Comment
score: 0

http://stackoverflow.com/comment/31281228
type: AnswerComment
comment on: http://stackoverflow.com/a/20852510
type: Comment
has text: @StephenC: I am a bit confused between JRE and JVM, but my point still stands. It is safe to assume so since the JVM has to follow the specs, but the size of `int` and `long` used internally in JVM doesn't have to be 32-bit and 64-bit (unless other part of the specs specifies that JVM has to do so internally, which is quite unlikely since the specs should allow for the JVM to be implemented on different hardware). If anything, those width may be chosen for ease of implementation on certain architecture.
score: 0

http://stackoverflow.com/comment/31390617
type: QuestionComment
comment on: http://stackoverflow.com/q/20905219
has text: Are you sure the plProps configured in ApplicationContext.xml ? i dont see that configured . make sure those objects initiated by verifying logs
score: 0
type: Comment

android-fragments
tags question: http://stackoverflow.com/q/20955526
tags question: http://stackoverflow.com/q/20985136
tags question: http://stackoverflow.com/q/20981626
tags question: http://stackoverflow.com/q/20893905
tags question: http://stackoverflow.com/q/20935518
tags question: http://stackoverflow.com/q/20857963
type: Tag
tags question: http://stackoverflow.com/q/20915787
tags question: http://stackoverflow.com/q/21007613
tags question: http://stackoverflow.com/q/20913872
tags question: http://stackoverflow.com/q/21012245
tags question: http://stackoverflow.com/q/20996587
tags question: http://stackoverflow.com/q/21013738
tags question: http://stackoverflow.com/q/20957311
tags question: http://stackoverflow.com/q/20863704
tags question: http://stackoverflow.com/q/21011595
tags question: http://stackoverflow.com/q/20930938
tags question: http://stackoverflow.com/q/20895164
tags question: http://stackoverflow.com/q/20892118
tags question: http://stackoverflow.com/q/20935904
tags question: http://stackoverflow.com/q/21016381
tags question: http://stackoverflow.com/q/20918424
tags question: http://stackoverflow.com/q/20935926
tags question: http://stackoverflow.com/q/20955749
tags question: http://stackoverflow.com/q/20971925
tags question: http://stackoverflow.com/q/20977210
tags question: http://stackoverflow.com/q/20879723
tag name: android-fragments
tags question: http://stackoverflow.com/q/20940008
tags question: http://stackoverflow.com/q/20895087
tags question: http://stackoverflow.com/q/20921605

http://stackoverflow.com/comment/31306089
comment on: http://stackoverflow.com/q/20865561
has text: 1) `public void run() { while(true){ repaint();` Use a Swing based `Timer` for animation. 2) `g.drawImage(backgroundImg, 0,0, null);` should be `g.drawImage(backgroundImg, 0,0, this);` 3) Please learn common [Java naming conventions](http://java.sun.com/docs/books/jls/second_edition/html/names.doc.html#73307) (specifically the case used for the names) for class, method & attribute names & use them consistently.
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/31410909
has text: @Stevie Insteead before barrier in thread, main thread In the result of your code.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/20921305
score: 0

http://stackoverflow.com/comment/31413839
has text: Which version of Tomcat? Looks like one that doesn't support proper websockets.
comment on: http://stackoverflow.com/q/20922958
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31288517
comment on: http://stackoverflow.com/a/20856235
score: 0
type: Comment
has text: I have sent code.. check it once. Now import that project. Your problem will solve
type: AnswerComment

http://stackoverflow.com/q/21010192
has title: how to get the client name logging in website
has answer: http://stackoverflow.com/a/21010541
has body: I had a website name sampleWebsite:8080/SampleWebsite.jsf and I want to get the client name/computer name of the one who access my website. I used this code to get the computer name every time accessing my website. System.out.println(InetAddress.getLocalHost().getHostName()); My computer name is Lenovo-PC. Then I'm gonna access and log in to my website. I want the out output of my computername/client name which is Lenove-PC. But the output was sampleWebsite which is my server name. Can someone help me to get the clientname/computer name not the server name? I appreciate for your help.
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/21010368
has answer: http://stackoverflow.com/a/21010261
score: 0
answer count: 3

http://stackoverflow.com/comment/32276764
type: QuestionComment
has text: No idea why the down vote. The question is clear, well formatted and have answered by expert like (Timo Hahn)
score: 1
comment on: http://stackoverflow.com/q/20876741
type: Comment

http://stackoverflow.com/comment/31296747
type: Comment
has text: There is no other solution.
comment on: http://stackoverflow.com/q/20860880
score: 0
type: QuestionComment

http://stackoverflow.com/q/20867279
linked to: http://stackoverflow.com/q/14166083
linked to: http://stackoverflow.com/q/13528953
linked to: http://stackoverflow.com/q/20672834
answer count: 2
linked to: http://stackoverflow.com/q/752999
has comment: http://stackoverflow.com/comment/31309095
downvote count: 0
tagged with: paintcomponent
favorite count: 0
has answer: http://stackoverflow.com/a/20867377
has title: In Java game, pressing one key cancels a different key that's still pressed
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: swing
tagged with: sprite
type: Question
has body: I'm making a 2D game in java. In the game, pressing the left and right arrow keys rotates a sprite and manipulates a variable named 'angle'. Pressing the up arrow key, computes the direction where the sprite should move depending on the 'angle' variable. This works, but I'm unable to manipulate the angle while moving, aka have left or right keys be pressed at the same time the up arrow is pressed. Pressing the up arrow makes the program ignore the fact the one of the arrow keys is pressed. I have searched the forum and found one suggestion how to handle that, but I'm not sure it's the best for my program. (What I found: How do I handle simultaneous key presses in Java?) Here's some code: Relevant methods of Thing class: public void keyPressed(KeyEvent e){ int key = e.getKeyCode(); if(key==KeyEvent.VK_LEFT){ setAngle(getAngle()-5); leftPressed=true; // *new* } if(key==KeyEvent.VK_RIGHT)setAngle(getAngle()+5);{ rightPressed=true; // *new* } if(key==KeyEvent.VK_UP){ dy = (float) ( Math.sin( getAngle() ) ) * 5; dx = (float) ( Math.sin( 90-getAngle() ) ) * 5; if(leftPressed==true)angle-=5; // *new* if(rightPressed==true)angle+=5; // *new* } public void move(){ x += dx; y += dy; } } The Board class (the class that manages the game:) package learningMovement; import java.util.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.Timer; public class Board extends JPanel implements ActionListener, KeyListener { Thing t; Timer timer; public Board(){ setBackground(Color.BLACK); timer = new Timer(10,this); t = new Thing(); setFocusable(true); timer.start(); addKeyListener(this); } public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; g2d.rotate( Math.toRadians(t.getAngle()), t.getX() + (t.getWidth()/2), t.getY() + (t.getHeight()/2) ); g2d.drawImage(t.getImage(),(int)t.getX(),(int)t.getY(),this); } public void actionPerformed(ActionEvent e){ t.move(); repaint(); } public void keyPressed(KeyEvent e) { …
has answer: http://stackoverflow.com/a/20868270
accepted answer: http://stackoverflow.com/a/20868270
tagged with: keylistener
possible better answer: http://stackoverflow.com/a/20867377

http://stackoverflow.com/q/20903423
has answer: http://stackoverflow.com/a/20903538
has answer: http://stackoverflow.com/a/20903587
downvote count: 0
favorite count: 0
tagged with: android
has title: How to swap red and blue in a drawable in Android?
score: 1
upvote count: 1
has body: can anyone tell me an efficient way of applying a colour filter to a Drawable in Android that will basically turn blue red and red blue? I have a functioning example in Java, but this is not compatible in Android: public class ColourSwapTest extends JFrame { private JPanel panel; private boolean altImageOnShow = false; public static void main(String[] args){ new ColourSwapTest(); } public ColourSwapTest(){ init(); Container container = this.getContentPane(); panel = new JPanel(){ @Override public void paint(Graphics g){ if (altImageOnShow){ g.drawImage(img, 0, 0, null); } else { g.drawImage(src, 0, 0, null); } } }; panel.addMouseListener(new MouseAdapter(){ @Override public void mouseClicked(MouseEvent arg0){ // alternate between original and filtered image if (altImageOnShow){ altImageOnShow = false; } else { altImageOnShow = true; } repaint(); } }); container.add(panel, BorderLayout.CENTER); this.setSize(800,600); this.setLocationRelativeTo(null); this.setVisible(true); } private String dir = "c:/Test Images/2.jpg"; private Image src; private ImageFilter colourFilter; private Image img; /** * init() */ private void init(){ try { src = ImageIO.read(new File(dir)); } catch (IOException e) { e.printStackTrace(); } colourFilter = new RedBlueSwapFilter(); // apply filter to new image img = createImage(new FilteredImageSource(src.getSource(), colourFilter)); } /** * CLASS * RedBlueSwapFilter */ class RedBlueSwapFilter extends RGBImageFilter { public RedBlueSwapFilter() { canFilterIndexColorModel = true; } public int filterRGB(int x, int y, int rgb) { return ((rgb &amp; 0xff00ff00) | ((rgb &amp; 0xff0000) &gt;&gt; 16) | ((rgb &amp; 0xff) &lt;&lt; 16)); } } } This will just load in the image found at C:\Test Images\2.jpg and switch between its original and altered states when you click on it. If anyone can advise on how to get this into Android, I would be most appreciative. Thanks. EDIT: I should add, the clicking on the image to toggle it is totally unimportant, that wa…
type: Question
has answer: http://stackoverflow.com/a/21026050
accepted answer: http://stackoverflow.com/a/21026050
type: AnsweredQuestion
tagged with: colorfilter
tagged with: java
possible better answer: http://stackoverflow.com/a/20903538
linked to: http://stackoverflow.com/q/5699810
answer count: 3

http://stackoverflow.com/q/20912225
tagged with: java
has answer: http://stackoverflow.com/a/20912285
type: Question
has answer: http://stackoverflow.com/a/20912333
score: 0
answer count: 3
has body: I make this request: http://localhost:8983/solr/collection1/select/?indent=on&q=*:*&fl=*&facet=true&facet.field=id&rows=99 and see next result: 0 31 true * on *:* id 99 ... 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 I cannot inderstand why I see 0 0 0 0 What does ot mean? VS1GB400C3 is not matching in all xml document UPDATE request: http://localhost:8983/solr/collection1/select/?indent=on&q=*&fl=id&rows=9999 response: 0 0 id on * 9999 GB18030TEST 6H500F0 F8V7067-APL-KIT IW-02 MA147LL/A adata apple asus ati belkin canon corsair dell maxtor samsung viewsonic USD EUR GBP NOK 3007WFP VA902B 0579B002 9885A004 SOLR1000 UTF8TEST EN7800GTX/2DHTV/256M 100-435805 I cannot to copy here all docs examples.
tagged with: solr
accepted answer: http://stackoverflow.com/a/20912333
has answer: http://stackoverflow.com/a/20920910
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20912285
has title: Solr. Strange facet search result

http://stackoverflow.com/comment/56821731
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/20996373
has text: Nice... i have pinched your work and cited it in my code :)

http://stackoverflow.com/q/20888170
tagged with: android
has comment: http://stackoverflow.com/comment/31410863
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20888372
has title: null pointer exception when retrieving from HashMap even though containsKey() returns true
type: Question
tagged with: hashmap
has body: I've been developing an Android guitar app, and currently I'm having some problems with HashMap. To sum it up, I get a nullpointer exception when I try to retrieve a value from a HashMap with get(key) despite containsKey(key) returning true for that key. Specifically, I have an instance _currentPreset of a class, which has a HashMap called _maxCoordRange, which is initialized in the class like this: private Map&lt;String, Float&gt; _maxCoordRange = new HashMap&lt;String, Float&gt;(); This parameter is not modified in the constructors of the class. Instead, it can only be modified by the following method: public void setMaxCoordRange(String parName, float value) { _maxCoordRange.put(parName, value); } and accessed by: public float getMaxCoordRange(String parName) { return _maxCoordRange.get(parName); } Once I've created the _currentPreset instance, I set some values to the _maxCoordRange map like this: for (int i = 0; i &lt; _currentPreset.getCoordiates().size(); i++) { _currentPreset.setMaxCoordRange(_currentPreset.getParNames().get(i), 0.75f); } In other parts of the code I do the following: if(_currentPreset.getMaxCoordRange().containsKey(pareterName)){ cord.setMaxValueCoord(_currentPreset.getMaxCoordRange(pareterName)); } Here is the odd part. I get a nullpointer exeption when I try to retrieve the value corresponding to the pareterName from the HashMap with getMaxCoordRange, despite containsKey(key) returning true. I did some debugging and I found something rather strange to me. When I finished putting the values in the map, in the expressions tag (when in debugging mode in eclipse), the table looks like this: table HashMap$HashMapEntry[16] (id=829660787832) [0] null [1] null [2] null [3] null [4] null [5] null [6] null [7] null [8] HashMap$HashMapEntry (id=829660788568) [9] HashMap$HashMapEntry (id=829660786456) [10] HashMap$HashMapEntry (id=829660787920) [11] HashMap$HashMapEntry (id=829660788376) [12] HashMap$HashMapEntry (id=829660787448) [13] HashMap$HashMa…
tagged with: java
score: 2
has comment: http://stackoverflow.com/comment/31352312
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31348495
has comment: http://stackoverflow.com/comment/31352258
tagged with: nullpointerexception

http://stackoverflow.com/a/20872284
accepted answer of: http://stackoverflow.com/q/20872236
score: 3
has body: Your don't need half the code. I would try to make it as simple as possible. Try this String str = ... for(int i = str.length() - 1; i &gt;= 0; i--) System.out.print(str.chatAt(i)); System.out.println(); If the assignment says you have to reverse an array of chars you can do this. String str = ... char[] chars = str.toCharArray(); for(int i = 0; i &lt; chars.length/2; i++) { char ch = chars[i]; chars[i] = chars[chars.length - i - 1]; chars[chars.length - i - 1] = ch; } System.out.println(new String(chars)); As you can see this is needlessly complicated, so you would not do this. Another way you can do this if you don't want to use a loop is String str = ... System.out.println(new StringBuilder(str).reverse());
upvote count: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20872236
type: Answer
has comment: http://stackoverflow.com/comment/31318904

http://stackoverflow.com/q/20918696
tagged with: api
type: AnsweredQuestion
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/20920057
has title: Java misc behaviour when connecting php apache
score: 0
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/20918741
tagged with: http
downvote count: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/20918741
has answer: http://stackoverflow.com/a/20920057
has body: I'm creating a java desktop application in netbeans for internal use, this is my first java app. I created a login screen and trying to post user name and password to local wamp server. I used following http utility class to send post data to server: An HTTP utility class to send GET/POST request And this is my code to call send Post Request final String url = "http://localhost/timesheet/api/login"; final String userName = loginName.getText(); final String passwd = pwd.getText(); if (null == userName || userName.equals("")) { lbl = "Please enter your login name"; } else if (null == passwd || passwd.equals("")) { lbl = "Please enter your password"; } else { Map&lt;String, String&gt; data = new HashMap&lt;String, String&gt;(); data.put("user_name", userName.trim()); data.put("pwd", passwd.trim()); String requestURL = "http://localhost/timesheet/api/login"; try { HttpUtility.sendPostRequest(requestURL, data); String[] response = HttpUtility.readMultipleLinesRespone(); for (String line : response) { System.out.println(line); } } catch (IOException ex) { ex.printStackTrace(); } HttpUtility.disconnect(); This code send request successfully and get responce if i do not pass any parameters or pass only one parameter(Either user_name or pwd) in request. But when i send both parameter (user_name &amp; pwd) it show 500 internal sever in responce? I tried searching but not found useful. pleas help me to solve this. The api code works with php, so don't think issue is with server. something happing in java code that cause 500 internal sever error. Thanks. Apache Access Log Entries 127.0.0.1 - - [03/Jan/2014:17:42:32 +0530] "POST /timesheet/api/login HTTP/1.1" 500 1371 127.0.0.1 - - [03/Jan/2014:17:44:07 +0530] "POST /timesheet/api/login HTTP/1.1" 500 1371

http://stackoverflow.com/comment/31531501
type: Comment
has text: this should be a comment
type: AnswerComment
comment on: http://stackoverflow.com/a/20984883
score: 0

http://stackoverflow.com/comment/52015235
type: AnswerComment
type: Comment
score: 7
has text: This is no different then blocking on the calling thread. You should use a NIO client to do proper non blocking requests.
comment on: http://stackoverflow.com/a/20999400

http://stackoverflow.com/comment/31527533
type: Comment
score: 0
comment on: http://stackoverflow.com/a/20982574
has text: Perhaps I should, I was referring to bytecode - to - threading translation by the JVM. Being a novice student of JVM, I can't say this with authority but it looks like all threads are created and managed exactly the same way by JVM regardless of how they are specified in the Java Language...
type: AnswerComment

http://stackoverflow.com/q/20974187
has answer: http://stackoverflow.com/a/20974426
type: Question
accepted answer: http://stackoverflow.com/a/20974426
has body: i use getSystemService(String) in this way that i want this activity to start vibration for 1 second. However, the error say the title public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mVibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); mVibrator.vibrate(1000); } Thank you for answering!
tagged with: vibration
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31511002
has title: The method getSystemService(String) is undefined for the type AlertDemo
tagged with: android
has comment: http://stackoverflow.com/comment/31510677
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/31368602
comment on: http://stackoverflow.com/a/20892645
type: Comment
has text: Thanks for the tip. The applications main job is filtering a set of icons though, so it's pretty confusing if you can start using it without it showing all the icons. I think I'll leave it as-is for the time being. Good answer given the faulty question though :)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31289039
type: Comment
has text: No. the result is not rendered before params interceptor does some post processing. Have a look at the highlighted flows. Rendering the result page occurs almost at the end of request.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20854831

http://stackoverflow.com/q/20950424
tagged with: char
has answer: http://stackoverflow.com/a/20950886
has answer: http://stackoverflow.com/a/20950867
downvote count: 0
favorite count: 0
has body: I am in a requirement of display raw byte data in char form, there are some issue I am stuck like for example [ 1, 32, -1, -1 ] ( byte data ) which when converted into char comes as [1, 3, 2, -, 1, - ,1] My requirement [ 1, 32, -1, -1 ] in char format. Intailly I used the command StringBuilder buffer = new StringBuilder(); for(int i = 0; i &lt; byte1.length;i++){ buffer.append(byte1[i]); } char[] c = buffer.toString().toCharArray(); Didn't serve my requirement. Then I used char dig = (char)(((int)'0')+ (-32)); it gave an invalid output Kindly help in my requirement. Thanks in advance
tagged with: byte
possible better answer: http://stackoverflow.com/a/20950740
has title: Byte[] to char[]
answer count: 4
has answer: http://stackoverflow.com/a/20950740
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20950867
tagged with: java
has answer: http://stackoverflow.com/a/20950498
type: Question
has comment: http://stackoverflow.com/comment/31465770
has comment: http://stackoverflow.com/comment/31465825
has comment: http://stackoverflow.com/comment/31465900
score: 4
has comment: http://stackoverflow.com/comment/31465904
upvote count: 4
has comment: http://stackoverflow.com/comment/31465838
has comment: http://stackoverflow.com/comment/31465823

http://stackoverflow.com/a/21016659
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21016523
score: 13
has body: List array = new ArrayList(map.keySet());
upvote count: 13
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/21016523

http://stackoverflow.com/a/20879207
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31369847
has comment: http://stackoverflow.com/comment/31367426
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/20870625
has body: I guess that instead of describing all possible connections thanks to specific types, you simply have to describe them with interfaces and then at the implementation step all you need is to be sure that your type implementing the dedicated interface. Here two examples: 1) Without using interfaces 2) using interfaces Hoping it is clear, Regards, EBR

apache-camel
tags question: http://stackoverflow.com/q/20877706
tags question: http://stackoverflow.com/q/20955546
tags question: http://stackoverflow.com/q/20961534
tags question: http://stackoverflow.com/q/20976249
tags question: http://stackoverflow.com/q/20978874
tag name: apache-camel
tags question: http://stackoverflow.com/q/20997276
tags question: http://stackoverflow.com/q/20876951
tags question: http://stackoverflow.com/q/20969371
tags question: http://stackoverflow.com/q/20948182
tags question: http://stackoverflow.com/q/20883021
tags question: http://stackoverflow.com/q/20897704
tags question: http://stackoverflow.com/q/20900611
tags question: http://stackoverflow.com/q/20992861
tags question: http://stackoverflow.com/q/20983441
tags question: http://stackoverflow.com/q/20973511
tags question: http://stackoverflow.com/q/20949079
type: Tag

http://stackoverflow.com/a/20954947
score: 4
has body: If you want to parse the double from a string you can use Double.parseDouble(sValue); You can also use an explisit conversion in line for your equation so you can do something like: (double)inum*(double)inum1*(double)inum2/(double)inum4*((double)inum5/(double)inum6) and your result should then come out as a double instead of an integer.
has comment: http://stackoverflow.com/comment/31479877
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/31475904
downvote count: 0
answers question: http://stackoverflow.com/q/20954781
accepted answer of: http://stackoverflow.com/q/20954781
has comment: http://stackoverflow.com/comment/31475756
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31476485

http://stackoverflow.com/comment/31551622
type: Comment
type: QuestionComment
score: 2
has text: @assylias apparently OP doesn't mind to populate the map in the beginning, so it's a simpler problem. each entry is lazily initialized though. double-checked-locking is perfectly fine here.
comment on: http://stackoverflow.com/q/20995715

http://stackoverflow.com/a/20873076
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31320417
answers question: http://stackoverflow.com/q/20873005
upvote count: 9
has comment: http://stackoverflow.com/comment/31320491
has body: Maybe instead of mucking around with the break statement, use an extra boolean flag. //Change if block to set the boolean flag if(current_login.equals(p.getF_name()) &amp;&amp; pass.equals(p.getPassword())){ System.out.println("\nHello " + p.getF_name() + " " + p.getL_name()); authenticated = true; } //Use it in your while statement while(login_count &gt; 0 &amp;&amp; !authenticated);
has comment: http://stackoverflow.com/comment/31320486
score: 9

http://stackoverflow.com/a/20904149
answers question: http://stackoverflow.com/q/20886031
downvote count: 0
has body: You need to use a MouseMotionListener. MouseListener will not work. you then need to override the mouseDragged() class Resizing extends JPanel impelemts MouseMotionListener { ... @Override public void mouseDragged(MouseEvent e){ ... } public void mouseMoved(MouseEvent e){} } When ever the mouse is dragged, it fires an MouseEvent. Using that event you can get that certain point at any given time when the mouse is being dragged public void mouseDragged(MouseEvent e){ Point p = e.getPoint(); } The point is the location of the mouse. You can use its getX() and getY() methods to get the x and y location of the point at every given moment You'll want x and y variables declared as class members to hold the point so you can use it in your paint method int xLoc; int yLoc; In you mouseDragged you can make the x and y points of the MouseEvent fired to set your xLoc and yLoc. Then repaint public void mouseDragged(MouseEvent e){ Point p = e.getPoint(); xLoc = p.getX(); yLoc = p.getY(); repaint(); } In your paintComponent() method you'll use those xLoc and yLoc to paint your objects. So the at every drag of the mouse, the xLoc and yLoc will keep being update and keep repainting. Something like g2.fill(new Rectangle2D.Double(xLoc, yLoc, 50, 50)); g2.fill(new Rectangle2D.Double(xLoc + 100, yLoc + 100, 50, 50)) UPDATE - example program. Try and run it import java.awt.*; import java.awt.event.*; import javax.swing.*; public class MoveRects extends JPanel { private static final int SCREEN_WIDTH = 600; private static final int SCREEN_HEIGHT = 600; int xLoc; int yLoc; public MoveRects(){ addMouseMotionListener(new MouseMotionAdapter(){ public void mouseDragged(MouseEvent e) { Point p = e.getPoint(); xLoc = (int)p.getX(); yLoc = (int)p.getY(); repaint(); } }); } protected void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.GREEN); g.fillRect(xLoc, yLoc, 50, 50); g.setColor(Color.RED); g.fillRect(xLoc + 300, yLoc, 50, 50); } public Dimension getPreferredSize() { re…
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/31380419
has comment: http://stackoverflow.com/comment/31381012
score: 1
has comment: http://stackoverflow.com/comment/31381840

http://stackoverflow.com/q/21005043
has answer: http://stackoverflow.com/a/21005139
linked to: http://stackoverflow.com/q/2294268
tagged with: tomcat7
has comment: http://stackoverflow.com/comment/31568095
tagged with: spring
answer count: 4
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21005150
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31568039
has answer: http://stackoverflow.com/a/21005145
has answer: http://stackoverflow.com/a/21005078
has comment: http://stackoverflow.com/comment/31568048
tagged with: java-6
has body: This problem happens when my web application runs between 40 minutes to an hour and my application web doesn't work, the browser wait a response from server, i dont know if it is not by any error in the programming that i doing or a bug in tomcat or bug in jvm. and this is the exception: Exception in thread "ContainerBackgroundProcessor[StandardEngine[Catalina]]" Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "ContainerBackgroundProcessor[StandardEngine[Catalina]]"
downvote count: 0
tagged with: jvm
favorite count: 0
has title: java.lang.OutOfMemoryError in tomcat 7
type: UnansweredQuestion

http://stackoverflow.com/a/21015275
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/92196856
accepted answer of: http://stackoverflow.com/q/21014964
type: Answer
answers question: http://stackoverflow.com/q/21014964
score: 3
downvote count: 0
upvote count: 3
has body: Turns out it was a permission issue. Atomikos was trying to create the lck files in the eclipse folder, and once we moved eclipse to another location everything worked fine.

http://stackoverflow.com/comment/32087117
score: 1
has text: by the way, this code snippet shows the great expression power of Java
comment on: http://stackoverflow.com/a/20950816
type: AnswerComment
type: Comment

http://stackoverflow.com/q/20958996
tagged with: character-encoding
type: Question
linked to: http://stackoverflow.com/q/464874
tagged with: ant
downvote count: 0
has title: Getting error: unmappable character for encoding ASCII during building (Ivy) of a project in Jenkins
has comment: http://stackoverflow.com/comment/31482705
favorite count: 0
has comment: http://stackoverflow.com/comment/31483803
duplicate of: http://stackoverflow.com/q/464874
has comment: http://stackoverflow.com/comment/31482841
answer count: 0
tagged with: jenkins
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/31498520
score: 1
has body: I have the correct encoding in SVN and i see the correct text while opening the file in SVN. The above error is thrown during Cobertura compile in Jenkins server ( log below). When i was doing a jenkins build locally, i could not see this error. I am using Java 1.7 and have integrated Sonar to Jenkins.I am using IVY to manage dependencies inside the project. I searched a lot in the web and Stack Overflow but could only find answers related to Maven. Would appreciate if someone could help. Full Log Below init: [echo] ### Making default directories ### [mkdir] Created dir: /opt/hd/dt/var/jenkins/workspace/A/ProjectName/build/classes cobertura.compile: [echo] ### Setting Compile Classpath ### [javac] /opt/hd/dt/var/jenkins/workspace/A/ProjectName/src/com/cs/mm/ab/common/util/Constants.java:119: error: unmappable character for encoding ASCII [javac] public static final String THANK_YOU = "Thank you for choosing Restie?s for your "; [javac] [javac] 1 error BUILD FAILED /opt/hd/dt/var/jenkins/workspace/A/ProjectName/build/ant/build.xml:32: The following error occurred while executing this line: /opt/hd/dt/var/jenkins/workspace/A/ProjectName/build/ant/cobertura-build.xml:51: Compile failed; see the compiler error output for details.
tagged with: svn
tagged with: java

http://stackoverflow.com/a/20885393
downvote count: 0
score: 8
answers question: http://stackoverflow.com/q/20884862
upvote count: 8
type: Answer
accepted answer of: http://stackoverflow.com/q/20884862
has body: if you want to create a custom java plugin that has conventions, that differ from the standard gradle plugin, I recommend to start with the java-base plugin. The java-base plugin does provide the functionality of sourcesets but does not already any of them. Instead of inheriting a plugin you should apply it in your custom plugin: class YourCustomJavaPlugin implements Plugin&lt;Project&gt; { void apply(Project project){ // 1st apply the 'java-base' plugin project.apply(plugin:'java-base') // 2nd apply your own conventions on top project.sourceSets.create("customSourceSet") Zip myZip = project.tasks.create("zip", Zip) ... } } cheers, René
type: AcceptedAnswer

http://stackoverflow.com/a/41028152
answers question: http://stackoverflow.com/q/20943833
type: Answer
has body: An other way to hook an ImageView: public class Base64ImageView extends ImageView { private URL url; public Base64ImageView(Element elem) { super(elem); populateImage(); } private void populateImage() { Dictionary&lt;URL, Image&gt; cache = (Dictionary&lt;URL, Image&gt;) getDocument() .getProperty("imageCache"); if (cache == null) { cache = new Hashtable&lt;URL, Image&gt;(); getDocument().putProperty("imageCache", cache); } URL src = getImageURL(); cache.put(src, loadImage()); } private Image loadImage() { String b64 = getBASE64Image(); BufferedImage newImage = null; ByteArrayInputStream bais = null; try { bais = new ByteArrayInputStream( Base64.decodeBase64(b64.getBytes())); newImage = ImageIO.read(bais); } catch (Throwable ex) { } return newImage; } private String getBASE64Image() { String src = (String) getElement().getAttributes() .getAttribute(HTML.Attribute.SRC); if (!isBase64Encoded(src)) { return null; } return src.substring(src.indexOf("base64,") + 7, src.length() - 1); } @Override public URL getImageURL() { String src = (String) getElement().getAttributes() .getAttribute(HTML.Attribute.SRC); if (isBase64Encoded(src)) { this.url = Base64ImageView.class.getProtectionDomain() .getCodeSource().getLocation(); return this.url; } return super.getImageURL(); } private boolean isBase64Encoded(String src) { return src != null &amp;&amp; src.contains("base64,"); } }
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/31531703
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20961717
has text: This did work -- though it has the regrettable consequence of stripping away some useful chars like carriage returns and spaces. But it's in the right direction.
score: 0

http://stackoverflow.com/comment/31404823
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20918022
type: AnswerComment
has text: Can i clean the reference in the below way : **(*env)->DeleteLocalRef( env, nplpidobject);** And also i have a doubt whether getfieldid also returns a reference.

http://stackoverflow.com/a/20958482
score: 8
upvote count: 8
has comment: http://stackoverflow.com/comment/31481992
type: Answer
accepted answer of: http://stackoverflow.com/q/20958455
has body: If you look in the JavaDoc for Thread.sleep() you see exactly what might happen: Throws: IllegalArgumentException - if the value of millis is negative InterruptedException - if any thread has interrupted the current thread. The interrupted status of the current thread is cleared when this exception is thrown. An example on how to interrupt another thread might look like this: public class Foo { public static void main(final String[] args) throws Exception { Thread sleepThread = new Thread(new Runnable() { @Override public void run() { try { Thread.sleep(10000); } catch (InterruptedException e) { System.out.println("Interrupted!"); } } }); sleepThread.start(); Thread.sleep(500); sleepThread.interrupt(); } } This will print Interrupted!
has comment: http://stackoverflow.com/comment/31481620
has comment: http://stackoverflow.com/comment/31481948
answers question: http://stackoverflow.com/q/20958455
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31481797

http://stackoverflow.com/comment/31331024
comment on: http://stackoverflow.com/q/20878862
has text: What is `node` an instance variable or a local variable in the method doing the deletion? I assume it is a local variable in the method. If that is the case, then you are only modifying the reference, not the object. For example if you do `Node someNode = new Node();`, you create a new new Node object and the someNode reference points to that new object. If you pass someNode to a method, that method will receive a reference to the same Node object. But changing the reference in that method will not affect the original object, nor the other reference (someNode).
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31421602
type: QuestionComment
type: Comment
has text: "I am strictly working with Array Lists for all of the code" - No, you are not. You are working with Arrays of `Card`, not `ArrayList`s. In what file do you declare that code?
comment on: http://stackoverflow.com/q/20926835
score: 0

http://stackoverflow.com/q/20921365
upvote count: 23
has comment: http://stackoverflow.com/comment/31410873
has comment: http://stackoverflow.com/comment/31410801
has comment: http://stackoverflow.com/comment/31410763
tagged with: access-modifiers
has answer: http://stackoverflow.com/a/20921579
type: AnsweredQuestion
downvote count: 0
favorite count: 0
score: 23
type: Question
has body: What is equivalent of internal access modifier available in C# for method in Java? (I know default i.e. methods, variables without any scope are having package access but I am looking for keyword equivalent) How can we achieve methods with protected internal scope in Java?
linked to: http://stackoverflow.com/q/1330133
has title: Equivalent of internal in java
accepted answer: http://stackoverflow.com/a/20921579
tagged with: java
has comment: http://stackoverflow.com/comment/31410773
answer count: 1

http://stackoverflow.com/comment/42234602
type: AnswerComment
score: 0
type: Comment
has text: I like your answer, this is great - ByteBuffer buffer = ByteBuffer.wrap(new byte[] {0b00000000, 0b01000001}); System.out.println(buffer.getChar());
comment on: http://stackoverflow.com/a/20875825

http://stackoverflow.com/q/20883328
has answer: http://stackoverflow.com/a/20884194
has answer: http://stackoverflow.com/a/20898812
tagged with: list
tagged with: cookies
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/20898812
has body: hi i am trying to create an ordered list that can display options to move to various pages based on value of cookie. the cookie has been set correctly. and its value is being obtained.. but there is some mistake that i cant quite pinpoint.. <c:forEach items= "${cookie}" var="currentCookie"> <c:if test="${currentCookie.key eq 'user_type' }"> <c:set var="user_type" value = "${currentCookie.value.value }"/> </c:if> </c:forEach> <c:choose> <c:when test="${not empty user_type}"> SELECT <c:when test="${user_type='T'}"> My Account </c:when> <c:when test="${user_type='P'}"> My Account </c:when> <c:when test="${user_type='D'}"> Create Auction </c:when> <c:when test="${user_type='F'}"> DFO Management </c:when> <c:when test="${user_type='S'}"> User Management </c:when> </c:when> <c:otherwise> SELECT Create Auction DFO Management User Management </c:otherwise> the foreach selects various cookies and obtains the one with user_type and obtains the value.. in c choose the value of cookie is compared with predetermined values which generates the ordered list if no value is selected then only 3 items should be displayed in the list pls help..
tagged with: jstl
tagged with: jsp
type: AnsweredQuestion
has title: multiple <c:when in <c:choose + cookies
has comment: http://stackoverflow.com/comment/31338784
has comment: http://stackoverflow.com/comment/31338930
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/20884194

http://stackoverflow.com/q/20889076
downvote count: 0
score: 1
tagged with: java
tagged with: http
type: Question
has body: I'm trying to make a simple HTTP server that handles requests from a browser and returns the appropriate answer. I have implemented the basic connectivity already but I have trouble constructing the return header properly so the browser can display the answer from the server (e.g. getting a .jpg picture from the server and displaying it properly). I think that the problems I'm experiencing have to do with not constructing the answer header correctly. I have little experience with this and I would appreciate any help. Below is my HttpHandler class, which processes the request from the browser and return the answer. I think the problem is somewhere in the httpHeaderConstructor method. package Server; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import org.apache.commons.io.FilenameUtils; public class HttpHandler { public static void httpHandler(BufferedReader clientInput, DataOutputStream serverResponse){ int type_of_method = 0; String path = new String(); try{ String tmp = clientInput.readLine(); String tmp2 = new String(tmp); tmp.toUpperCase(); System.out.println("Clients request call:" + tmp); if(tmp.startsWith("GET")) type_of_method = 1; if(type_of_method == 0){ try{ serverResponse.writeBytes(httpHeaderConstructor(501, 0)); serverResponse.close(); return; }catch(Exception e){ System.out.println("1.Error: " + e.getMessage()); } } int start = 0; int end = 0; for(int a = 0; a &lt; tmp2.length(); a++){ if(tmp2.charAt(a) == ' ' &amp;&amp; start != 0){ end = a; break; } if(tmp2.charAt(a) == ' ' &amp;&amp; start == 0){ start = a; } } path = tmp2.substring(start + 2, end); System.out.println("Requested file path: " + path); }catch(Exception e){ System.out.println("2.Error (bad request Exception): " + e.getMessage()); } System.out.println("Client requested: " + new File(path).getAbsolutePath()); sendRequestedFile(path, serverResponse); } private static void sendRequestedFile(String filePath, DataOutput…
tagged with: webserver
has title: Constructing http headers for Java HTTP server
upvote count: 1
has answer: http://stackoverflow.com/a/20889327
answer count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/31486766
has text: debugStr is the value I am trying to remove with each iteration. I would like the strings with higher indices to move to fill the gap. Thanks,
type: Comment
comment on: http://stackoverflow.com/a/20960949
score: 0
type: AnswerComment

http://stackoverflow.com/q/20942547
score: 0
tagged with: java
tagged with: multithreading
tagged with: loops
possible better answer: http://stackoverflow.com/a/20942643
linked to: http://stackoverflow.com/q/6242268
type: Question
has answer: http://stackoverflow.com/a/20942643
accepted answer: http://stackoverflow.com/a/20942682
tagged with: camera
answer count: 2
has title: How can i correct strobe effect
tagged with: android
has answer: http://stackoverflow.com/a/20942682
has body: I want to create a strobe effect,make the flashlight blink.Below is my code,right now what i have achieve is to make it flash but only once,that's why i need to help me make it flash for a great deal of time. public class Strobe extends Activity { Camera cam; private static final String TAG = null; private Handler mHander = new Handler(); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); strobe(); } private void turnOnLight(){ for(int x = 0; x == 10; x++);{ //although for does exist does nothing and that is in all for i have put around my program,don't know why Log.d("tagname","runs 10 times a"); cam = Camera.open(); Parameters params = cam.getParameters(); params.setFlashMode(Parameters.FLASH_MODE_TORCH); cam.setParameters(params); cam.startPreview(); cam.autoFocus(new AutoFocusCallback(){ public void onAutoFocus(boolean success, Camera camera) { } }); } } private void turnOffLight(){ for(int x = 0; x == 10; x++);{ cam.stopPreview(); cam.release(); Log.d("tagname","runs 10 times b"); } } private void strobe(){ for(int x = 0; x == 10; x++);{ Thread timer = new Thread(){ public void run(){ turnOnLight(); try{ Thread.sleep(300); }catch(InterruptedException e){ e.printStackTrace(); } turnOffLight(); Log.d("tagname","runs 10 times c"); }; };timer.start(); }; } };
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31452117

http://stackoverflow.com/comment/31586002
comment on: http://stackoverflow.com/a/21014705
type: AnswerComment
score: 0
type: Comment
has text: @KalamarObliwy As 1.7 have no lambda expression, you could not use that!

http://stackoverflow.com/a/20864058
answers question: http://stackoverflow.com/q/20863989
type: Answer
has comment: http://stackoverflow.com/comment/31304482
has body: I've heard that you must set a variable to 'null' once you're done using it so the garbage collector can get to it (if it's a field var). This is very rarely a good idea. You only need to do this if the variable is a reference to an object which is going to live much longer than the object it refers to. Say you have an instance of Class A and it has a reference to an instance of Class B. Class B is very large and you don't need it for very long (a pretty rare situation) You might null out the reference to class B to allow it to be collected. A better way to handle objects which don't live very long is to hold them in local variables. These are naturally cleaned up when they drop out of scope. If I were to have a variable that I won't be referring to agaon, would removing the reference vars I'm using (and just using the numbers when needed) save memory? You don't free the memory for a primitive until the object which contains it is cleaned up by the GC. Would that take more space than just plugging '5' into the println method? The JIT is smart enough to turn fields which don't change into constants. Been looking into memory management, so please let me know, along with any other advice you have to offer about managing memory Use a memory profiler instead of chasing down 4 bytes of memory. Something like 4 million bytes might be worth chasing if you have a smart phone. If you have a PC, I wouldn't both with 4 million bytes.
has comment: http://stackoverflow.com/comment/31304250
upvote count: 5
score: 5
has comment: http://stackoverflow.com/comment/31309261
accepted answer of: http://stackoverflow.com/q/20863989
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/20872907
has answer: http://stackoverflow.com/a/20872920
has body: I have a robot called the "Robotic Arm Edge" and the USB Interface. I am trying to make custom software, but this involves the Java Native Interface. I chose Java because it is much easier to make a gui interface in than the ATK+ library for C/C++. The reason I need the Java Native interface is libusb, which I already have a working controller for that I wrote myself. Now, all that I need to do is write a Java wrapper, but I need to convert a jstring to a c string. The GetStringUTFChars JNI method always results in a fatal error, and I have tried almost every variation of the method possible. This is the Java class: RoboController.java: package arm.robot; import arm.robot.enums.*; public class RoboController { static { System.loadLibrary("robojava"); sendToRobo0(""); } static Pinchers m1 = Pinchers.stopped; static Joint m2 = Joint.stopped; static Joint m3 = Joint.stopped; static Joint m4 = Joint.stopped; static Base m5 = Base.stopped; static Light l = Light.off; private static native boolean sendToRobo0(String cmds); public static void sendToRobo(){ StringBuilder sb = new StringBuilder(""); boolean first = true; if(m1.equals(Pinchers.opening)) { if(!first){ sb.append(" "); } else first = false; sb.append("m1o"); } else if(m1.equals(Pinchers.closing)) { if(!first){ sb.append(" "); } else first = false; sb.append("m1c"); } if(m2.equals(Joint.up)) { if(!first){ sb.append(" "); } else first = false; sb.append("m2u"); } else if(m2.equals(Joint.down)) { if(!first){ sb.append(" "); } else first = false; sb.append("m2d"); } if(m3.equals(Joint.up)) { if(!first){ sb.append(" "); } else first = false; sb.append("m3u"); } else if(m3.equals(Joint.down)) { if(!first){ sb.append(" "); } else first = false; sb.append("m3d"); } if(m4.equals(Joint.up)) { if(!first){ sb.append(" "); } else first = false; sb.append("m4u"); } else if(m4.equals(Joint.down)) { if(!first){ sb.append(" "); } else first = false; sb.append("m4d"); } if(m5.equals(Base.clockwise)) { if(!first){ sb.append(" "); …
upvote count: 2
tagged with: fatal-error
score: 2
type: AnsweredQuestion
tagged with: java-native-interface
tagged with: java
accepted answer: http://stackoverflow.com/a/20872920
type: Question
has title: Java Native Interface GetStringUTFChars Fatal Error
downvote count: 0
favorite count: 0
tagged with: linux
answer count: 1
tagged with: c++

http://stackoverflow.com/q/21009973
has body: I have a javax.swing.Timer which needs to run a method, after a random time between two int's. After the object is made the object needs to keep 'running' (as in keep doing the thing int the timer). what i have tried: private int minimal = 30; private int Max = 1000; int randomTimeOutput; Random randomTime; Timer timerRunAction public Object() { randomTime = new Random(); randomTimeOutput = (minimal + randomTime.nextInt(Max - minimal + 1)); timerRunAction = new Timer(randomTimeOutput, this); timerRunAction.start(); } private void doSomething() { //Do something } private void actionPerformed(ActionEvent e) { dosomething(); } i have changed the names to make it more readable Object isn't the real class ofcause. But what happens is : the timer runs in a random times but it keeps running in the random time it runs the first time in. So it isn't changing the time ,after each time it finished running. How can i make it happen so it will run with a different time every time ?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31577596
downvote count: 1
has answer: http://stackoverflow.com/a/21010014
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21010098
possible better answer: http://stackoverflow.com/a/21010014
has comment: http://stackoverflow.com/comment/31577870
tagged with: random
has title: Java timer random time each time between 2 values
favorite count: 0
tagged with: timer
accepted answer: http://stackoverflow.com/a/21010098
upvote count: 2
has comment: http://stackoverflow.com/comment/31577588
has comment: http://stackoverflow.com/comment/31577616
tagged with: swing
type: AnsweredQuestion

http://stackoverflow.com/comment/31480390
type: Comment
type: QuestionComment
score: 1
has text: Removed Java from question title -- it's already in your tags, and removed "Eclipse" from your title, as your question has nothing to do with Eclipse.
comment on: http://stackoverflow.com/q/20957079

http://stackoverflow.com/comment/31278237
comment on: http://stackoverflow.com/q/20850822
has text: You're sure that works in a Toast? It doesn't for me (assuming my edit was what your code actually is).
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/20950217
accepted answer: http://stackoverflow.com/a/20950358
has comment: http://stackoverflow.com/comment/31465581
score: 5
has comment: http://stackoverflow.com/comment/31465779
has comment: http://stackoverflow.com/comment/31465444
downvote count: 0
answer count: 1
has body: I have an interface which contains only int values (so in essence, it is pretty similar to an enum). I want to iterate the interface values, using the following piece of code: for (Field x : MyInterface.class.getDeclaredFields()) { int y = x.getInt(x); // do something with 'y'... } The way I see it, either the getInt method can be static, or it doesn't need any arguments. So why does this method need both 'this' and the additional argument? Is there any plausible scenario for them to be different?
favorite count: 0
upvote count: 5
has comment: http://stackoverflow.com/comment/31465841
has comment: http://stackoverflow.com/comment/31465472
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31465710
tagged with: java
has title: Java - Class Field / Method getInt
type: Question
has answer: http://stackoverflow.com/a/20950358

http://stackoverflow.com/comment/31294916
type: Comment
has text: [Instructions on doing the int -> hex` conversion](http://stackoverflow.com/questions/6539879/how-to-convert-a-color-integer-to-a-hex-string-in-android)
type: AnswerComment
comment on: http://stackoverflow.com/a/20860001
score: 0

http://stackoverflow.com/comment/31370247
type: AnswerComment
has text: checking account should have the issuing of cheque...
type: Comment
comment on: http://stackoverflow.com/a/20898601
score: 0

jpanel
tags question: http://stackoverflow.com/q/20888424
tags question: http://stackoverflow.com/q/20876230
tags question: http://stackoverflow.com/q/21003720
tags question: http://stackoverflow.com/q/20862919
tags question: http://stackoverflow.com/q/20937430
tags question: http://stackoverflow.com/q/20922461
tags question: http://stackoverflow.com/q/20924230
tags question: http://stackoverflow.com/q/20939553
type: Tag
tags question: http://stackoverflow.com/q/20888142
tags question: http://stackoverflow.com/q/21001454
tags question: http://stackoverflow.com/q/20986833
tags question: http://stackoverflow.com/q/20856152
tags question: http://stackoverflow.com/q/21010495
tags question: http://stackoverflow.com/q/21007061
tags question: http://stackoverflow.com/q/20884779
tags question: http://stackoverflow.com/q/20886415
tags question: http://stackoverflow.com/q/20952058
tags question: http://stackoverflow.com/q/20932471
tags question: http://stackoverflow.com/q/20921620
tags question: http://stackoverflow.com/q/20884464
tag name: jpanel
tags question: http://stackoverflow.com/q/20914327
tags question: http://stackoverflow.com/q/20852536
tags question: http://stackoverflow.com/q/20966718
tags question: http://stackoverflow.com/q/20943624
tags question: http://stackoverflow.com/q/20930780
tags question: http://stackoverflow.com/q/20923346

arrays
tags question: http://stackoverflow.com/q/20949873
tags question: http://stackoverflow.com/q/20956665
tags question: http://stackoverflow.com/q/20914158
tags question: http://stackoverflow.com/q/20986248
tags question: http://stackoverflow.com/q/20865517
tags question: http://stackoverflow.com/q/20909402
tags question: http://stackoverflow.com/q/20933367
tags question: http://stackoverflow.com/q/21013820
tags question: http://stackoverflow.com/q/20894605
tags question: http://stackoverflow.com/q/20938318
tags question: http://stackoverflow.com/q/20908708
tags question: http://stackoverflow.com/q/20940488
type: Tag
tags question: http://stackoverflow.com/q/20985719
tags question: http://stackoverflow.com/q/20913378
tags question: http://stackoverflow.com/q/20853198
tags question: http://stackoverflow.com/q/20921589
tags question: http://stackoverflow.com/q/20935474
tags question: http://stackoverflow.com/q/20927374
tags question: http://stackoverflow.com/q/20897028
tags question: http://stackoverflow.com/q/20858378
tags question: http://stackoverflow.com/q/20903309
tags question: http://stackoverflow.com/q/20914165
tags question: http://stackoverflow.com/q/20949234
tags question: http://stackoverflow.com/q/20960683
tags question: http://stackoverflow.com/q/20870231
tags question: http://stackoverflow.com/q/20930109
tags question: http://stackoverflow.com/q/20873005
tags question: http://stackoverflow.com/q/20904167
tags question: http://stackoverflow.com/q/21010295
tags question: http://stackoverflow.com/q/20952230
tags question: http://stackoverflow.com/q/20930443
tags question: http://stackoverflow.com/q/20940884
tags question: http://stackoverflow.com/q/20856176
tags question: http://stackoverflow.com/q/20893557
tags question: http://stackoverflow.com/q/20857142
tags question: http://stackoverflow.com/q/20969877
tags question: http://stackoverflow.com/q/20869559
tags question: http://stackoverflow.com/q/20960055
tags question: http://stackoverflow.com/q/20912313
tags question: http://stackoverflow.com/q/20993099
tags question: http://stackoverflow.com/q/20872236
tags question: http://stackoverflow.com/q/20879108
tags question: http://stackoverflow.com/q/20873435
tags question: http://stackoverflow.com/q/20906214
tags question: http://stackoverflow.com/q/20850591
tags question: http://stackoverflow.com/q/20905469
tags question: http://stackoverflow.com/q/20957455
tags question: http://stackoverflow.com/q/20989792
tags question: http://stackoverflow.com/q/20968357
tags question: http://stackoverflow.com/q/20879858
tags question: http://stackoverflow.com/q/20959937
tags question: http://stackoverflow.com/q/20938176
tags question: http://stackoverflow.com/q/20942130
tags question: http://stackoverflow.com/q/21010501
tags question: http://stackoverflow.com/q/20986840
tags question: http://stackoverflow.com/q/20938892
tags question: http://stackoverflow.com/q/20945371
tags question: http://stackoverflow.com/q/20960487
tags question: http://stackoverflow.com/q/20969932
tags question: http://stackoverflow.com/q/20884018
tags question: http://stackoverflow.com/q/20869398
tags question: http://stackoverflow.com/q/20890762
tags question: http://stackoverflow.com/q/20978133
tags question: http://stackoverflow.com/q/20942518
tags question: http://stackoverflow.com/q/20924354
tags question: http://stackoverflow.com/q/20921542
tag name: arrays
tags question: http://stackoverflow.com/q/20960194
tags question: http://stackoverflow.com/q/21000555
tags question: http://stackoverflow.com/q/20928658
tags question: http://stackoverflow.com/q/21006013
tags question: http://stackoverflow.com/q/20890023
tags question: http://stackoverflow.com/q/21006061
tags question: http://stackoverflow.com/q/20949451
tags question: http://stackoverflow.com/q/20926039
tags question: http://stackoverflow.com/q/20960930
tags question: http://stackoverflow.com/q/20999193
tags question: http://stackoverflow.com/q/20861901
tags question: http://stackoverflow.com/q/20891277

http://stackoverflow.com/comment/31410084
score: 0
has text: I need not provide any values when the script is running. but the screen should be visible enough for that should i use multi threading concept??????????
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20920885

http://stackoverflow.com/q/20899455
has title: Configuring Hibernate with HikariCP
accepted answer: http://stackoverflow.com/a/21156693
possible better answer: http://stackoverflow.com/a/45477480
has comment: http://stackoverflow.com/comment/31405277
upvote count: 13
has answer: http://stackoverflow.com/a/20919015
tagged with: database-connection
type: AnsweredQuestion
has body: Because of problems with c3p0 connection pool, I want to see the alternatives and decide which one might be more usable in my case. HikariCP looks very promising, but there is no documentation how to use it with Hibernate. So far I am using c3p0 as follows: <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> ${database.dialect} ${database.structure} ${database.connection} ${database.username} ${database.password} ${database.driver} true 0 UTF-8 UTF-8 ${database.show_sql} false disabled org.hibernate.connection.C3P0ConnectionProvider 5 30 300 50 600 Can someone point me how to configure HikariCP in such way?
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/21156693
has comment: http://stackoverflow.com/comment/31391438
type: Question
answer count: 3
has answer: http://stackoverflow.com/a/45477480
downvote count: 0
has comment: http://stackoverflow.com/comment/31424247
tagged with: c3p0
favorite count: 0
score: 13
tagged with: hikaricp

http://stackoverflow.com/comment/31285647
comment on: http://stackoverflow.com/a/20854758
score: 0
type: Comment
has text: @madanV try dateFormat.setTimeZone(TimeZone.getDefault()); instead of TimeZone.getTimeZone("UTC")
type: AnswerComment

http://stackoverflow.com/a/21373990
has comment: http://stackoverflow.com/comment/52213654
type: Answer
accepted answer of: http://stackoverflow.com/q/20916107
answers question: http://stackoverflow.com/q/20916107
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has body: I have also run into the same problem calling Graphics.drawImage() on OS/X Mavericks and managed to work around it by manually installing JDK 1.6 and running my code using that instead of 1.7. See how-do-i-install-jdk-1-6-in-mavericks for instructions on how to do this.

http://stackoverflow.com/a/29400560
downvote count: 0
has body: I see, that it is here for some time already... but I encountered this problem today. I do not know the root cause ;), but I resolved the problem simply by installing Eclipse DTP v. 1.7. Update site: Eclipse DTP update site. Projects to install: "Data Tools Platform Enablement Extender SDK" and "Data Tools Platform Extender SDK". My Eclipse version is 4.4.2. Now works like a charm :) Hope it helps!
type: Answer
answers question: http://stackoverflow.com/q/20905905
score: 1
upvote count: 1

http://stackoverflow.com/a/20950227
upvote count: 6
has body: By explicitly defining a value, it's clear that you intended that value at that point of execution. If not, another reader might interpret it as if you either forgot to initialize this variable or you don't care at that point (and will set it somewhere else later). In other words, it's some kind of implicit documentation. Generally, it's considered better practice to write verbose code for better readability; i.e. never use abbreviations for methods names, write them out! Also, if you have to write line comments (//), you can almost always replace them by wrapping the following code into a well-named method. Implicit documentation ftw! :)
has comment: http://stackoverflow.com/comment/31465639
type: Answer
answers question: http://stackoverflow.com/q/20950147
downvote count: 0
score: 6
has comment: http://stackoverflow.com/comment/31466345

http://stackoverflow.com/comment/31308909
score: 1
comment on: http://stackoverflow.com/a/20864154
has text: Hm, you're right. Though I guess I'm not seeing how loading company graphics on the second page prevents phishing, since the phishing sites can just use the same graphics. My answer explains how one might implement a two-phase login like financial sites have.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31544723
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20992299
has text: If you are new to Java you should learn the basics before trying the advanced stuff.

http://stackoverflow.com/comment/31522855
score: 1
has text: What does "updated my build path to include the external JAR for SDK 19" mean - is the build sdk `android-19` in `project.properties`? (In case you're using Eclipse/ADT)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20978703

http://stackoverflow.com/a/20977362
score: 25
downvote count: 0
has body: The sheet margins are not contained in the XSSFPrintSetup object, but on the XSSFSheet itself. Use Sheet's getMargin and setMargin methods, passing the appropriate Sheet constant for the top/left/bottom/right/header/footer margins. Set and get the margin in inches. double leftMarginInches = sheet.getMargin(Sheet.LeftMargin); sheet.setMargin(Sheet.RightMargin, 0.5 /* inches */ );
upvote count: 25
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20966818
accepted answer of: http://stackoverflow.com/q/20966818
type: Answer

http://stackoverflow.com/a/21012355
downvote count: 2
answers question: http://stackoverflow.com/q/21012245
type: Answer
upvote count: 0
has body: Hello Hi could you try Implementing onResume() and calling this block of code from there FragmentManager manager = getFragmentManager(); FragmentTransaction transaction = manager.beginTransaction(); transaction.add(R.id.LIST_LAYOUT,frag,"LIST"); transaction.commit(); also override onsaveinstancestate()
score: -2

http://stackoverflow.com/comment/31504389
type: AnswerComment
has text: @gonggong Ohhhh! Now I understand. I had put the `(` a character too late in the regex. `\\(?(` at the start should be `(\\(?` instead. [There we go](http://ideone.com/U55IGM).
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20867854

http://stackoverflow.com/a/20880691
has comment: http://stackoverflow.com/comment/31353938
type: Answer
answers question: http://stackoverflow.com/q/20880128
has body: You are using Intent in the wrong way, try change: startActivity(new Intent("com.example.fittle.FISH")); To startActivity(new Intent(context, FISH.class)); Context can be this if you are calling it from activity.
score: 0
has comment: http://stackoverflow.com/comment/31334509

http://stackoverflow.com/q/20888519
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31352893
type: UnansweredQuestion
tagged with: modelattribute
has title: Spring MVC Form Not Submitting Value
has comment: http://stackoverflow.com/comment/31348795
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/31349463
answer count: 0
has comment: http://stackoverflow.com/comment/31351685
score: 1
upvote count: 1
type: Question
tagged with: java
tagged with: forms
has body: Resolution I've now managed to get this working. It was my own oversight that was causing the null result, and thanks to @WillKeeling for pointing out that I was mapping the form to the wrong controller method. Rather than creating a new Role object for the form to submit, I was (for an unknown reason) asking it to submit a User object. My working JSP & Controller below: <form:form method="POST" action="/users/${user.username}/addRole" modelAttribute="newRole"> Roles <form:select class="form-control" path="rolename" multiple="false"> <form:options items="${roles}" title="rolename" itemValue="rolename" itemLabel="rolename" /> </form:select> </form:form> Controller Mapping @RequestMapping(value = "/{username}/addRole", method = RequestMethod.POST) public String addUserRoles(@ModelAttribute("newRole") Role newRole, @PathVariable("username") String username) { System.out.println(newRole.getRolename()); return "redirect:/users/" + username; } Original Question I may be missing something obvious here but I was hoping someone may be able to help. I'm building an access management system for the team I work in. I've got a form on a jsp (code below) which should submit a new "role" object that can be handled into the repository in the back end. At the moment however, when I click submit the logging reports that the value is "null". Can somebody please shed some light on why this is? Form in JSP <form:form method="POST" action="/users/${user.username}/addRole" modelAttribute="user"> Roles <form:select class="form-control" path="roles" multiple="false"> <form:options items="${roles}" title="roles" itemValue="rolename" itemLabel="rolename" /> </form:select> </form:form> Controller Original path is /users with the following controller. @RequestMapping(value = "/{username}/addRole", method = RequestMethod.POST) public String addUserRoles(@ModelAttribute("user") User user) { System.out.println(user.getRoles()); return "redirect:/users/" + user.getUsername(); } Result in Console Ro…

http://stackoverflow.com/a/20978103
answers question: http://stackoverflow.com/q/20977904
type: Answer
accepted answer of: http://stackoverflow.com/q/20977904
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31519135
has body: Assuming that your "YourBmi" has a double value, make this changes: EDITED: I changed the else if code. It has to much parenthesis and add another if in last alse. if (Double.valueOf(YourBmi) &lt;= 18.0) { review.setText("You are Underweight "); } else if (Double.valueOf(YourBmi) &gt; 18.0 &amp;&amp; Double.valueOf(YourBmi) &lt; 25.0 ) { review.setText("You are Normal (healthy weight) "); } else if(Double.valueOf(YourBmi) &gt; 25.0) { review.setText("You are Overweight"); }
has comment: http://stackoverflow.com/comment/31519693
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/31360819
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20894513
score: 1
has text: Thank you, Ian! I will keep it in mind. Sorry for being so annoying!

http://stackoverflow.com/q/20903136
has comment: http://stackoverflow.com/comment/31376244
has title: Disable Column Header sorting on a JTable
answer count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/32845506
tagged with: java
score: 7
accepted answer: http://stackoverflow.com/a/20903584
has answer: http://stackoverflow.com/a/32845506
tagged with: swing
upvote count: 7
type: Question
has body: Is it possible to disable manual sorting on a JTable after adding a sorter? So I have a JTable that has the following sorter attached to it (basically sorts by column 3 when the table is initialised): JTable jTable = new JTable(); RowSorter&lt;TableModel&gt; sorter = new TableRowSorter&lt;TableModel&gt;(jTable.getModel()); List&lt;RowSorter.SortKey&gt; sortKeys = new ArrayList&lt;RowSorter.SortKey&gt;(); sortKeys.add(new RowSorter.SortKey(3, SortOrder.DESCENDING)); sorter.setSortKeys(sortKeys); jTable.setRowSorter(sorter); This works fine, however the user is still able to click on the column headers in the table and sort by any of the columns, which I want to disable. Is this possible?
has comment: http://stackoverflow.com/comment/31376713
tagged with: sorting
has answer: http://stackoverflow.com/a/70829027
tagged with: jtable
downvote count: 0
has answer: http://stackoverflow.com/a/54166466
has answer: http://stackoverflow.com/a/20903584
favorite count: 0
linked to: http://stackoverflow.com/q/14365510

mp4parser
tags question: http://stackoverflow.com/q/20979985
type: Tag
tag name: mp4parser

http://stackoverflow.com/a/20871338
type: Answer
has comment: http://stackoverflow.com/comment/31358634
has comment: http://stackoverflow.com/comment/31358080
has body: Never put sensitive data in the URL of your request. Use SSL and store the sensitive information in headers or in the content. Reasoning is: If you encrypt the URL on the device, where would you store the encryption key? You are back to the same problem. Even if you securely stored the URL or got it from somewhere externally, anyone on your network can see your network traffic plain as day. That's what SSL is for - it will handle this better than we can.
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/31316948
answers question: http://stackoverflow.com/q/20871297
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20871297
has comment: http://stackoverflow.com/comment/31317058

http://stackoverflow.com/q/20915880
has body: Very simple program calculating travel distance(just started a week ago) and I have this loop working for a true or false question, but I want it to work for a simple "yes" or "no" instead. The String I have assigned for this is answer. public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); double distance; double speed; boolean again = true; String answer; do{ System.out.print("Tell me your distance in miles: "); distance = input.nextDouble(); System.out.print("Tell me your speed in which you will travel: "); speed = input.nextDouble(); double average = distance / speed; System.out.print("Your estimated time to your destination will be: " + average + " hours\n\n"); if(average &lt; 1){ average = average * 10; System.out.println(" or " + average + " hours\n\n"); } System.out.println("Another? "); again = input.nextBoolean(); }while(again); } }
possible better answer: http://stackoverflow.com/a/20915894
has title: Trying to restart a do-while loop with a String variable to equal "yes" or "no"
score: 0
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/20915894
downvote count: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20915973
tagged with: java
has answer: http://stackoverflow.com/a/20915907
accepted answer: http://stackoverflow.com/a/20915907
type: Question
upvote count: 2

http://stackoverflow.com/a/20903854
has comment: http://stackoverflow.com/comment/31377530
accepted answer of: http://stackoverflow.com/q/20903046
has comment: http://stackoverflow.com/comment/31377707
upvote count: 4
answers question: http://stackoverflow.com/q/20903046
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/31377295
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31377914
has body: You can easily do this in the following way. First you will need declare the SharedPreferences inside the Activity in this manner: public class MainActivity extends Activity { SharedPreferences sp; int val=2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); sp=this.getSharedPreferences("service_validation", MODE_WORLD_READABLE); val=sp.getInt("VALIDATION", val); . .// you can put here anything code . } . .// you can put here anything method . . } Now when you would like to save the value in background asynch task. Please put this code inside onPostExecute(..) method in this manner: SharedPreferences.Editor editor=sp.edit(); editor.putInt("VALIDATION", 1); editor.commit(); It is better to use this code on doInBackground(..) method. After saving the value, refresh or re-run the Activity. It will show the effect . Enjoy the code!! If my answer will help you then please support my answer.
type: Answer

http://stackoverflow.com/a/20908679
has comment: http://stackoverflow.com/comment/31406803
has comment: http://stackoverflow.com/comment/31425340
has comment: http://stackoverflow.com/comment/31406235
has comment: http://stackoverflow.com/comment/31391349
type: Answer
has comment: http://stackoverflow.com/comment/31390108
has comment: http://stackoverflow.com/comment/31406953
has comment: http://stackoverflow.com/comment/31414304
has comment: http://stackoverflow.com/comment/31404930
has comment: http://stackoverflow.com/comment/31410777
has comment: http://stackoverflow.com/comment/31389638
has comment: http://stackoverflow.com/comment/31393536
has body: As discussed in Painting in AWT and Swing: Paint Processing, JComponent.repaint() registers an asynchronous repaint request to the component's RepaintManager, which uses invokeLater() to queue a Runnable to later process the request on the event dispatching thread. This is a necessary, but not sufficient, condition to establish a happens-before relation between successive calls to repaint(). As a practical matter, you still need to synchronize access to any data that is shared between threads. Without this, there's no way to ensure the visibility of any changes meant to influence the subsequent call to repaint().
has comment: http://stackoverflow.com/comment/31394279
has comment: http://stackoverflow.com/comment/31407421
has comment: http://stackoverflow.com/comment/31421840
has comment: http://stackoverflow.com/comment/31406136
has comment: http://stackoverflow.com/comment/31390321
score: 4
has comment: http://stackoverflow.com/comment/31403068
has comment: http://stackoverflow.com/comment/31415265
has comment: http://stackoverflow.com/comment/31393204
has comment: http://stackoverflow.com/comment/31393908
has comment: http://stackoverflow.com/comment/31393125
upvote count: 4
answers question: http://stackoverflow.com/q/20905985
has comment: http://stackoverflow.com/comment/31389781
has comment: http://stackoverflow.com/comment/31425237
has comment: http://stackoverflow.com/comment/31391282
downvote count: 0
has comment: http://stackoverflow.com/comment/31407391
has comment: http://stackoverflow.com/comment/31418129
has comment: http://stackoverflow.com/comment/31425245

http://stackoverflow.com/comment/31453047
type: QuestionComment
comment on: http://stackoverflow.com/q/20943153
score: 5
has text: Use a consistent and logical indent for code blocks. The indentation of the code is intended to help people understand the program flow.
type: Comment

http://stackoverflow.com/comment/31300250
type: AnswerComment
type: Comment
has text: ok, will file it away. was thinking the $ might be similiar to @(razor) for .net.
comment on: http://stackoverflow.com/a/20862443
score: 0

http://stackoverflow.com/comment/31448205
type: AnswerComment
type: Comment
has text: yes, i was checking to see if all of them work so after seeing maxq1 worked, but then I saw maxq2 just printed the first number
score: 0
comment on: http://stackoverflow.com/a/20940396

http://stackoverflow.com/q/20884592
has comment: http://stackoverflow.com/comment/31341102
type: Question
has comment: http://stackoverflow.com/comment/31341050
has comment: http://stackoverflow.com/comment/31341059
has comment: http://stackoverflow.com/comment/31341184
has body: OK, So I have started programming in Eclipse, using Java, and making an Android App. In one of my activities, I am saving people's details - name and mobile number (to send SMS to them later). However when the method is executed a load of errors are thrown. The method looks like this, and is executed by clicking on a button (standard stuff): It also fires another method, to write to a file: public void addpeople_action_save(View view) { EditText et_addpeople_name = (EditText) findViewById(R.id.addpeople_name); EditText et_addpeople_number = (EditText) findViewById(R.id.addpeople_number); String person_name = et_addpeople_name.getText().toString();///parses from the EditText to a string. String person_number = et_addpeople_number.getText().toString(); ///Next section is writing the two strings to a internal file, as a CSV format. ///eg: Bill, 0123567898 ///this will actually append the string to an arraylist of strings, before writing it back to the file. ArrayList&lt;PeopleDetails&gt; peopledetails_return =Readpeopledetails();///creates an arraylist containing people's details ///read from file PeopleDetails person_details = new PeopleDetails("", ""); person_details.name = person_name; person_details.number = person_number; peopledetails_return.add(person_details); peopledetails_return = sortList(peopledetails_return); peopledetails_write(peopledetails_return); / ///or will write a new file if it doesn't exist. ///New method(PeopleNumber, PeopleName, Filename) ///will write to file. } And the errors: 01-02 08:47:20.290: E/AndroidRuntime(1966): FATAL EXCEPTION: main 01-02 08:47:20.290: E/AndroidRuntime(1966): java.lang.IllegalStateException: Could not execute method of the activity 01-02 08:47:20.290: E/AndroidRuntime(1966): at android.view.View$1.onClick(View.java:3633) 01-02 08:47:20.290: E/AndroidRuntime(1966): at android.view.View.performClick(View.java:4240) 01-02 08:47:20.290: E/AndroidRuntime(1966): at android.view.View$PerformClick.run(View.java:17721) 01-02 …
has comment: http://stackoverflow.com/comment/31341319
has comment: http://stackoverflow.com/comment/31341190
score: 0
has comment: http://stackoverflow.com/comment/31341265
has answer: http://stackoverflow.com/a/20884849
tagged with: exception
has title: Lots of error when running a method
has answer: http://stackoverflow.com/a/20886151
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/31341238
has answer: http://stackoverflow.com/a/20884846
answer count: 4
tagged with: java
has answer: http://stackoverflow.com/a/20884921
has comment: http://stackoverflow.com/comment/31341045

http://stackoverflow.com/comment/31577760
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21009939
has text: That's great! I liked how your answer was very comprehensive, don't change your style :)
type: AnswerComment

http://stackoverflow.com/comment/31581524
type: Comment
has text: What are the symptoms? What visible problem occurs when you try to run this? If you get an error message, copy/paste it into your question.
comment on: http://stackoverflow.com/q/21012161
score: 0
type: QuestionComment

http://stackoverflow.com/q/20947041
linked to: http://stackoverflow.com/q/8197656
accepted answer: http://stackoverflow.com/a/20947127
type: AnsweredQuestion
tagged with: matrix
tagged with: android
type: Question
tagged with: bitmap
answer count: 1
has title: Android matrix manipulation
has body: I have a question regarding matrix manipulation on canvases. I think I understand what is happening, but I would like someone to confirm for me. I have scoured the internet for the past hour and a half and can't seem to find specifically what I'm looking for. My question is: In the below lines of code, before the bitmap is drawn, it is rotated about its center point by 'angle' degrees, then placed on the canvas at (100, 100), correct? I'm developing a game where I need certain objects to rotate according to another's position, and everything is working perfectly, I just want to know exactly what I'm doing. Any confirmation/clarification is welcome. :) matrix.setRotate(angle, 0, 0); matrix.postTranslate(100, 100); canvas.drawBitmap(bitmap, matrix, null);
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/20947127

http://stackoverflow.com/a/20961807
has body: Java specifies a regular expression that can be used to validate strings being passed to Double.parseDouble or Double.valueOf in the Javadoc of Double.valueOf: final String Digits = "(\\p{Digit}+)"; final String HexDigits = "(\\p{XDigit}+)"; // an exponent is 'e' or 'E' followed by an optionally // signed decimal integer. final String Exp = "[eE][+-]?"+Digits; final String fpRegex = ("[\\x00-\\x20]*"+ // Optional leading "whitespace" "[+-]?(" + // Optional sign character "NaN|" + // "NaN" string "Infinity|" + // "Infinity" string // A decimal floating-point string representing a finite positive // number without a leading sign has at most five basic pieces: // Digits . Digits ExponentPart FloatTypeSuffix // // Since this method allows integer-only strings as input // in addition to strings of floating-point literals, the // two sub-patterns below are simplifications of the grammar // productions from section 3.10.2 of // The Java™ Language Specification. // Digits ._opt Digits_opt ExponentPart_opt FloatTypeSuffix_opt "((("+Digits+"(\\.)?("+Digits+"?)("+Exp+")?)|"+ // . Digits ExponentPart_opt FloatTypeSuffix_opt "(\\.("+Digits+")("+Exp+")?)|"+ // Hexadecimal strings "((" + // 0[xX] HexDigits ._opt BinaryExponent FloatTypeSuffix_opt "(0[xX]" + HexDigits + "(\\.)?)|" + // 0[xX] HexDigits_opt . HexDigits BinaryExponent FloatTypeSuffix_opt "(0[xX]" + HexDigits + "?(\\.)" + HexDigits + ")" + ")[pP][+-]?" + Digits + "))" + "[fFdD]?))" + "[\\x00-\\x20]*");// Optional trailing "whitespace" if (Pattern.matches(fpRegex, myString)) Double.valueOf(myString); // Will not throw NumberFormatException else { // Perform suitable alternative action }
score: 3
accepted answer of: http://stackoverflow.com/q/20961762
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20961762
upvote count: 3

http://stackoverflow.com/comment/31374219
type: AnswerComment
comment on: http://stackoverflow.com/a/20886518
score: 0
type: Comment
has text: This is Spring (Hibernate) related problem now. Here was related problem: http://stackoverflow.com/questions/9795650/failed-to-lazily-initialize-a-collection . And here you can read some useful details on it: http://forum.spring.io/forum/spring-projects/web/111584-lazy-load-loosing-session-in-json-conversion-jackson

http://stackoverflow.com/a/20924625
has comment: http://stackoverflow.com/comment/31421323
has body: The problem is that Date is mutable, so another thread could change the end date: end.setTime(0); after you have checked that start.after(end) (easier way to write your condition). So it would look like: T1: start.after(end) => returns false, all looks good T2: end.setTime(0); => sneaky Thread 2 changes the date T1: this.start = start; this.end = end; //boom => your class invariant is not valid anymore
type: Answer
accepted answer of: http://stackoverflow.com/q/20924560
answers question: http://stackoverflow.com/q/20924560
has comment: http://stackoverflow.com/comment/31419059
upvote count: 9
has comment: http://stackoverflow.com/comment/31418898
score: 9
has comment: http://stackoverflow.com/comment/31422355
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31438633

http://stackoverflow.com/comment/31396808
score: 0
type: Comment
has text: That was the problem. Your activities were in package called `Activity`, and in manifest, your package name was com.example.ruby. See an updated answer on how to fix it.
type: AnswerComment
comment on: http://stackoverflow.com/a/20910972

http://stackoverflow.com/a/20907191
has comment: http://stackoverflow.com/comment/31387816
has body: you can't to call paint() from AWT/Swing Listener this methods is automatically called by override this method for Container override paintComponent for JPanel instead of paint()
has comment: http://stackoverflow.com/comment/31383796
answers question: http://stackoverflow.com/q/20907132
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/31383955
upvote count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/31383647

http://stackoverflow.com/comment/31314244
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20870046
has text: [This answer](http://stackoverflow.com/a/5204380/418556) provides a cleaner way to get the version from the manifest. In a nutshell: `String version = this.getClass().getPackage().getImplementationVersion();`

http://stackoverflow.com/q/20878456
linked to: http://stackoverflow.com/q/822322
answer count: 3
accepted answer: http://stackoverflow.com/a/20878490
possible better answer: http://stackoverflow.com/a/20878694
has answer: http://stackoverflow.com/a/20878694
favorite count: 0
has answer: http://stackoverflow.com/a/20878808
has comment: http://stackoverflow.com/comment/31330285
has comment: http://stackoverflow.com/comment/31332398
has comment: http://stackoverflow.com/comment/31330787
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
type: Question
has title: Best design/coding to accomplish the below requirement?
downvote count: 0
has body: I am using Java 1.7. I have below map. Map&lt;String, String&gt; keyValues = new HashMap&lt;&gt;(); But map can contain values as below. keyValues.put("one", "value1"); keyValues.put("two", "value2"); OR keyValues.put("four", "value1"); keyValues.put("two", "value2"); keyValues.put("seven", "value3"); OR keyValues.put("one", "value1"); keyValues.put("two", "value2"); keyValues.put("three", "value3"); Basically the map can contain N values where is N is generic it can contain any number of values. I have one more value for group of keys as below. keys one, two belongs to 12345SRT keys one, two, three, four belongs to 12345SRTSSS keys four, two, seven belongs to 764RTYL87 Now map can contain any one of above key sets. In that case based on the key set in the map it has to return corresponding value. Ex: If map contains one and two then it should return 12345SRT. If map contains four,two and seven then logic should return 764RTYL87. What is the best place to keep above key sets and corresponding values? Shall i consider enum? The logic has to take map and return value. What is the best way to do that?
has answer: http://stackoverflow.com/a/20878490

http://stackoverflow.com/comment/31317909
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/20871618
has text: @SotiriosDelimanolis how do I access those parts of the format?

http://stackoverflow.com/comment/31385494
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20905765
has text: from your comments:
score: 0

http://stackoverflow.com/q/20934817
type: Question
answer count: 2
score: 5
has answer: http://stackoverflow.com/a/20934895
has comment: http://stackoverflow.com/comment/31436536
has comment: http://stackoverflow.com/comment/31436482
upvote count: 5
has body: I read a sample code given by Bloch in Effective Java as shown below: Now, I want to make it clear that for which purpose Thread.currentThread().interrupt() was called. I read explanation given by that book but I'm still confused: Can anyone explain it a step further?
has answer: http://stackoverflow.com/a/20934887
favorite count: 0
downvote count: 0
has title: Why Thread.currentThread().interrupt() be called?
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/20934887
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20934895
tagged with: java

windows-server-2003
type: Tag
tag name: windows-server-2003
tags question: http://stackoverflow.com/q/21007204

http://stackoverflow.com/a/20933141
has comment: http://stackoverflow.com/comment/31433676
score: 0
has comment: http://stackoverflow.com/comment/31433991
has comment: http://stackoverflow.com/comment/31433754
type: Answer
has body: You have to include the Main-Class entry in the manifest file of your jar file. See this tutorial
answers question: http://stackoverflow.com/q/20933100

http://stackoverflow.com/comment/31486738
type: Comment
has text: I appreciate your help. If you have time to look, the data comes like this, [link](http://ww1.microchip.com/downloads/en/DeviceDoc/rn-wiflycr-ug-v1.2r.pdf) on page 73.
type: QuestionComment
comment on: http://stackoverflow.com/q/20960715
score: 0

http://stackoverflow.com/comment/31537100
type: Comment
has text: Thank you for your answer, however, this does not use nio.file.DirectoryStream as specified in the question. Regards.
type: AnswerComment
comment on: http://stackoverflow.com/a/20987866
score: 0

http://stackoverflow.com/q/20960181
score: 1
tagged with: javabeans
has answer: http://stackoverflow.com/a/20960798
favorite count: 0
has comment: http://stackoverflow.com/comment/31485608
tagged with: swing
has title: Displaying image from path contained in text file
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20961642
tagged with: java
has answer: http://stackoverflow.com/a/20961642
accepted answer: http://stackoverflow.com/a/20960798
upvote count: 1
has comment: http://stackoverflow.com/comment/31485316
type: Question
answer count: 2
downvote count: 0
tagged with: bufferedreader
has body: I am trying to display an image using a JFrame, but the path to that image changes about once every two seconds. The path is contained in a text file. I can display a single image in a JFrame without a problem, and can use a counter to display a range of different images provided I hard code the paths. But I just do not know how to go about displaying an image that has a new path recorded in a text file every 2 seconds. I have tried using buffer reader to read the text file then save the path to a bean but as I have the buffer reader in a loop the bean is returned null if I call it from outside the loop. Besides this seams like a very long winded way to accomplish this task. Could anyone suggest a simple way to achieve my goal. I can't seam to see the wood from the trees with this. Thanks. BTW: This is not a homework assignment, it is simply a personal program I am making.
tagged with: awt

http://stackoverflow.com/comment/31544227
has text: @user3168013 what exception do you get?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20990906
type: AnswerComment

http://stackoverflow.com/a/20993807
upvote count: 2
has body: What @tobias_k is saying is this. This is your format SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'"); When you call .format to format the Date, it returns a String String dateString = format.format(period.getStartDate()); Then concatenate it dateString = dateString + period.getStartTime();
type: Answer
answers question: http://stackoverflow.com/q/20993303
score: 2
downvote count: 0

http://stackoverflow.com/comment/31476126
type: Comment
has text: Good point, I forgot about the .class thing. Sorry I haven't actually done applets in a while.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20955673

http://stackoverflow.com/comment/31364132
score: 0
type: AnswerComment
has text: I've forgotten to point out that the JPanels are necessary, because they hold a background image (black/white). By the panel that is meant to have a `BorderLayout`, you mean one of the little JPanels?
type: Comment
comment on: http://stackoverflow.com/a/20895920

http://stackoverflow.com/q/21007484
has title: Is it possible to map subdirectory as root (spring)
has comment: http://stackoverflow.com/comment/31611533
type: Question
tagged with: jsp
score: 0
answer count: 0
type: UnansweredQuestion
has body: I'm implementing a web application using Spring MVC. The root path is WEB-INF/views and here I have some jsp and some subdirectories containing other jsp. It is possible to map WEB-INF/views/{some dir} into WEB-INF/views/ ? My purpose is to refer pages only with name. For example I want to write : &lt;c:url value="/myJsp.jsp"&gt;&lt;/c:url&gt; instead of &lt;c:url value="/dir1/dir2/myJsp.jsp"&gt;&lt;/c:url&gt; Obviusly I want to mantain directories structure.
tagged with: spring-mvc
tagged with: java
has comment: http://stackoverflow.com/comment/31585449

http://stackoverflow.com/q/20856712
tagged with: struts2
has comment: http://stackoverflow.com/comment/31295273
answer count: 1
downvote count: 0
tagged with: jsp
tagged with: jquery
favorite count: 0
has comment: http://stackoverflow.com/comment/31305862
type: AnsweredQuestion
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/20857030
type: Question
has body: I want to load my Error.jsp in my ErrorDiv if Action class returns error. I am doing an AJAX call. JS: success: function(result){ if(result === 'success') alert('Database Updated Successfully!'); else{ $('#ErrorDiv').load('/gma/pages/Error.jsp'); } } Error.jsp: <% request.setAttribute("decorator", "none"); response.setHeader("Cache-Control","no-cache"); //HTTP 1.1 response.setHeader("Pragma","no-cache"); //HTTP 1.0 response.setDateHeader ("Expires", 0); //prevents caching at the proxy server %> <s:if test="hasActionErrors()"> <s:actionerror /> </s:if> However, action errors are not getting displayed. In firebug I checked, response to GET Error.jsp in that the part comes empty. Why are actionError not getting displayed? EDIT: Action Class: try{ slsConfigureTspThresholdRemote.setThresholdParameters(circleId, tspId, thresholdTypeFlag, thresholdParametersList); } catch (Exception e){ addActionError(e.getMessage()); e.printStackTrace(); result = "error"; return ERROR; } struts.xml: <action name="updateThresholdParameters" class="cdot.oss.cmsat.gma.struts.ConfigureTspThresholdAction" method="updateThresholdParameters"> result pages/Error.jsp Presently, I am doing $('#ErrorDiv').html(result); so that my JSP get loaded in div instead of $('#ErrorDiv').load('/gma/pages/Error.jsp');!
has title: ActionError not getting displayed
score: 3
accepted answer: http://stackoverflow.com/a/20857030
tagged with: javascript

http://stackoverflow.com/comment/31535665
comment on: http://stackoverflow.com/q/20987214
score: 4
has text: @BrianRoach How is this a duplicate? I asked to solve the problem with nio.file.DirectoryStream.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/20947152
tagged with: java
tagged with: counter
possible better answer: http://stackoverflow.com/a/20947323
tagged with: java-io
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/31459787
favorite count: 0
has body: I'm really new at this so forgive my ignorance.. So this is what I need to do: Determine how many bottle caps each person has to open in order to find a winning cap. The answer is 1 in 5. Prompt the user for the number of trials. Read back the data for all of the trials from the output file. Calculate the average number of caps opened in order to win a prize. Print the result to the screen. This is what I've tried, but the counter isn't working.. Help? import java.util.Scanner; import java.util.Random; import java.io.IOException; import java.io.PrintWriter; import java.io.File; public class BottleCapPrize { public static void main(String [] args) throws IOException { int trials = 0; int loop = 1; int winCounter = 0; int random; double average; // Scanner in = new Scanner(System.in); Random rand = new Random(); PrintWriter outFile = new PrintWriter (new File("MonteCarloMethod.txt")); // System.out.print("Number of trials: "); trials = in.nextInt(); // for(loop = 1; loop &lt;= trials; loop++) { random = rand.nextInt(5); if(random == 1) { outFile.println("Trial: " + loop + " WIN!"); winCounter++; } outFile.println("Trial: " + loop + " LOSE"); } // average = winCounter / trials; outFile.println("Average number of caps to win: " + average); System.out.println("Average number of caps to win: " + average); outFile.close(); } }
has answer: http://stackoverflow.com/a/20947332
accepted answer: http://stackoverflow.com/a/20947332
type: AnsweredQuestion
score: 2
tagged with: java.util.scanner
downvote count: 0
has comment: http://stackoverflow.com/comment/31467248
has title: Can't get counter to work
tagged with: output
has answer: http://stackoverflow.com/a/20947323
type: Question

http://stackoverflow.com/comment/31530691
type: QuestionComment
has text: Please provide more details. Which line is throwing this error?
type: Comment
comment on: http://stackoverflow.com/q/20984429
score: 0

http://stackoverflow.com/q/20932697
type: Question
tagged with: bufferedwriter
has answer: http://stackoverflow.com/a/20932794
score: 0
linked to: http://stackoverflow.com/q/1532461
has answer: http://stackoverflow.com/a/20932739
has title: BufferedWriter advantages
has answer: http://stackoverflow.com/a/20932751
has body: I have the following method: public void writeToFile( String id, String no, int systol, int diastol, int pulsDiff, double speedAvg, double spread ) { String line = id + "\t" + no + "\t" + systol + "/" + diastol + "\t" + pulsDiff + "\t" + speedAvg + "\t" + spread + "\r\n"; File fil = new File("resultat.txt"); BufferedWriter writer = null; try { writer = new BufferedWriter(new FileWriter(fil, true)); writer.write(line); writer.close(); } catch (Exception e) { System.err.println("Fejl: " + e.getMessage()); } Could this have been done in different ways? With some different methods? And what are the advantages by doing so? Im trying to understand the advantage of having a bufferedWriter. I'm still at the beginning and I'm trying to understand this sentence:" In general, a Writer sends its output immediately to the underlying character or byte stream. Unless prompt output is required, it is advisable to wrap a BufferedWriter around any Writer whose write() operations may be costly, such as FileWriters and OutputStreamWriters. For example, PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("foo.out"))); will buffer the PrintWriter's output to the file. Without buffering, each invocation of a print() method would cause characters to be converted into bytes that would then be written immediately to the file, which can be very inefficient. Especially the "In general, a Writer sends its output immediately to the underlying character or byte stream" part.
answer count: 4
has answer: http://stackoverflow.com/a/20932760
type: UnansweredQuestion
tagged with: java
tagged with: printwriter
duplicate of: http://stackoverflow.com/q/12350248

http://stackoverflow.com/q/20947873
has answer: http://stackoverflow.com/a/20950966
answer count: 2
tagged with: intellij-plugin
tagged with: intellij-idea
score: 4
has answer: http://stackoverflow.com/a/20949630
accepted answer: http://stackoverflow.com/a/20949630
favorite count: 0
possible better answer: http://stackoverflow.com/a/20950966
has body: I am working on a plugin for IntelliJ Idea 13. I do some changes in beforeDocumentSaving and I use document.setText: public class AppendAction implements ApplicationComponent { @Override public void initComponent() { MessageBus bus = ApplicationManager.getApplication().getMessageBus(); MessageBusConnection connection = bus.connect(); connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerAdapter() { @Override public void beforeDocumentSaving(Document document) { document.setText(appendSomething(document.getText())); } }); } } This works great, my only problem is that when this plugin is run, and I want to undo the changes, I get to following error message: Cannot Undo Following files have changes that cannot be undone: Any Idea? :-)
has title: IntelliJ Idea Plugin Cannot Undo on document.setText
upvote count: 4
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question

http://stackoverflow.com/q/20907351
has comment: http://stackoverflow.com/comment/31384135
type: Question
tagged with: jsessionid
has comment: http://stackoverflow.com/comment/31384010
answer count: 1
accepted answer: http://stackoverflow.com/a/20907553
upvote count: 3
tagged with: java
has body: I'm writing a utility that needs to mimmic HttpServletResponse.encodeURL(...) and HttpServletResponse.encodeRedirectURL(...). I know that many servlet containers append ;jsessionid=XXX to the URL to track the session. My question is do ALL servlet containers do it? Please note that I'm aware that this function can be switched off if cookies are preferred. So, my questions: Does every servlet container append ;jsessionid=XXX to the URL? (when using url based session id) Are there any other variants (eg jsessionid vs JSESSIONID) Are there any other strange ways of tracking session id in the URL? I'm interested in all major servlet containers (jetty, tomcat, jbos, websphere, etc...)
has title: Do all servlet containers use jsessionid to track the session?
tagged with: httpsession
downvote count: 0
tagged with: servlets
has answer: http://stackoverflow.com/a/20907553
type: AnsweredQuestion
score: 3
tagged with: url
favorite count: 0

http://stackoverflow.com/comment/31356640
type: Comment
has text: How can I modify the XML so there is enough room for both without increasing or decreasing the (actual) size of sqwhite
comment on: http://stackoverflow.com/a/20891078
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31586103
score: 0
type: AnswerComment
has text: I know how to create an IF condition. you ain't getting the gist of the question. I am unable to create IF-ELSE condition for the particular case. what test to pass into IF?
type: Comment
comment on: http://stackoverflow.com/a/21014299

http://stackoverflow.com/comment/31484861
type: QuestionComment
type: Comment
has text: Not necessarily jonrsharpe , I think that alternative approaches are more important here than just code golfing his implementation.
comment on: http://stackoverflow.com/q/20959717
score: 0

http://stackoverflow.com/q/20930996
answer count: 1
type: UnansweredQuestion
has body: I have two tables (1) REG (2) REG_TEMP REG Columns: REGDNO, NAME REG_TEMP Columns: DATECOL In REG table I store the the values 0 &amp; 1 to column (i.e Date I select in the program) which I alter in the program, i.e, The date I select will be inserted into REG_TEMP and the same date is altered to become new column for my table REG Example: If I take Dec_12_2013 as my date REG Table becomes REGDNO, NAME, DEC_12_2013(New Column) and the date Dec_12_2013 will become a record in the REG_TEMP table. Now the problem I encountered is "to display the records of the table REG according to sorted order of the DATECOL in REG_TEMP", REG_TEMP: DATECOL ---------- Dec_12_2013 Dec_5_2013 Dec_20_2013 Whenever I insert the record REG_TEMP table looks like this and my REG table will have columns like REG ----------- REGDNO NAME Dec_12_2013 Dec_5_2013 Dec_20_2013 where the columns are not sorted. I am not able to sort out the proper SQL statement that gives me the table as REGDNO, NAME, Dec_5_2013, Dec_12_2013, Dec_20_2013 with the appropriate records of every column. That is I need the SQL statement or JAVA code that sorts the dates in the DATECOL of REG_TEMP and retrieve the record in the table REG according to the sorted column name. Any one please help me out how it can be done.
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20936350
has title: Using Two tables for retrieveing data
score: 0
tagged with: sql

http://stackoverflow.com/comment/31469248
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20931543
type: Comment
has text: Yes, I also tried that solution, but didn't work. It looks like it doesn't load any logger. The application starts, but the logger doesn't work.

http://stackoverflow.com/q/20868269
has title: when socketChannel.read(BUFFER) will return 0
tagged with: socketchannel
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/20868311
tagged with: sockets
upvote count: 1
has body: I have a server which reads from the SocketChannel like below: private void readDataFromSocket(SocketChannel socketChannel) throws IOException { BUFFER.clear(); int count = 0; while ((count = socketChannel.read(BUFFER)) &gt; 0) { BUFFER.flip(); int limit = BUFFER.limit(); while (limit &gt; 0) { System.out.print((char) BUFFER.get()); limit--; } } if (count &lt; 0) { System.out.println("closing the socket!!!"); socketChannel.close(); } } And below is the client where client writes to the SocketChannel: private void write(String str, SocketChannel channel) throws IOException{ byte[] b = str.getBytes(); buffer.clear(); buffer.put(b); buffer.flip(); while(buffer.hasRemaining()){ channel.write(buffer); } } So my question: when exactly in the server code the count value will be 0 ( while ((count = socketChannel.read(BUFFER)) &gt; 0))? is it possible that the count will be 0 if the server has read half of the message that client has sent i.e. Suppose client wrote: stack overflow, is it possible that in the server count will be 0 after reading stack i.e. half of the message that the client has sent (think that the message can be of 1MB size)?
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/20868311
type: Question

http://stackoverflow.com/comment/31507454
type: Comment
has text: @Bohemian I agree that lean, precise code is better. E.g. smart organization of `if`s, loops and `try`-`catch` blocks can reduce both method length and nesting levels, making the code more readable. But explicitly initializing variables (where reasonable) doesn't make code less readable. Omitting those initializations actually reduces the code's expressiveness.
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/20950251

executorservice
type: Tag
tags question: http://stackoverflow.com/q/20998418
tags question: http://stackoverflow.com/q/20935119
tag name: executorservice

http://stackoverflow.com/comment/31432446
score: 0
has text: @ᴍarounᴍaroun Oh yes, you are right! I delete my comment.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20932619

http://stackoverflow.com/comment/31355523
has text: What's the exception?
type: Comment
comment on: http://stackoverflow.com/q/20891951
score: 0
type: QuestionComment

http://stackoverflow.com/comment/31369405
type: Comment
comment on: http://stackoverflow.com/q/20899603
score: 0
type: QuestionComment
has text: kindly check the FACILITY_MAPPING_SEQ.nextval value and DB column size.

http://stackoverflow.com/comment/31330886
comment on: http://stackoverflow.com/q/20874229
has text: yes `public String create() { newGroupe.setNom(nom); gdao.ajouter(newGroupe); groupes.setWrappedData(gdao.selectAll()); newGroupe=new Groupe(); FacesMessage msg = new FacesMessage("Ajout effectué avec succés"); FacesContext.getCurrentInstance().addMessage(null, msg); return "list"; }`
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31431523
type: Comment
has text: @AhmedHamdy one problem is, it isn't adding EVERY single pair. It seems to have missed the last one!
comment on: http://stackoverflow.com/a/20931939
type: AnswerComment
score: 0

http://stackoverflow.com/a/21017625
downvote count: 0
answers question: http://stackoverflow.com/q/21017235
has comment: http://stackoverflow.com/comment/31591008
has body: Define clip region for the Graphics used for print. g.setClip(int x, int y, int width, int height) Where parameters for clip is the panel bounds.
upvote count: 2
has comment: http://stackoverflow.com/comment/31591335
type: Answer
score: 2

http://stackoverflow.com/comment/31493293
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20964169
has text: On `$ifNull`: I was thinking you would wrap it in a `$eq` in a `$cond` to get the logic right. Something like: '$cond' : [ { '$eq' : [ { '$ifNull' : [ '$myfieldname', ObjectId('52cb90166c4a281586e13465') ] }, ObjectId('52cb90166c4a281586e13465') ] }, 0, 1 ]

http://stackoverflow.com/q/20914494
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31398780
has body: i need to validate a reference code that is in the form of 2 letters, 3 numbers and one letter. I've tried using for functions, and have also tried going through each letter individually but its either too messy or it's not giving me the result i want. I've heard you can use regex but i'm not sure how to apply it. Any help would be great. Thanks I was told that this works: reference.matches("[A-z]{2}+[0-9]{3}+[A-z]") but when i run it, no matter what i put into the console that is is incorrect.
linked to: http://stackoverflow.com/q/15145659
has comment: http://stackoverflow.com/comment/31406290
has title: Validating reference code in java
has answer: http://stackoverflow.com/a/20914518
tagged with: validation
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31398538
favorite count: 0
accepted answer: http://stackoverflow.com/a/20914518
has comment: http://stackoverflow.com/comment/31398579
tagged with: regex
type: AnsweredQuestion
score: 1

http://stackoverflow.com/a/21632666
type: Answer
upvote count: 1
has body: It turns out that the StudentManagementEJB.jar file is not copied into the /lib directory upon deployment. Aside from adding it to the Class-Path, it must also be copied to %JBOSS_HOME%\standalone\deployments\&lt;ProjectName&gt;.war\WEB-INF\lib directory(if the project is deployed as .war). In this case ProjectName is StudentManagement.
type: AcceptedAnswer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/20959660
answers question: http://stackoverflow.com/q/20959660

http://stackoverflow.com/comment/64837843
score: 4
type: AnswerComment
type: Comment
has text: "No theorems can be proven about a program that contains a single instance of reflective or raw type access." I agree. Don't do it. Type erasure rewards people that don't, and penalizes people that do. That is the very point of this post. It's true to get the benefit of free theorems, you may have to build walls in which code is not reflective. This can/should/is done in many JVM-based projects. This is done to get free theorems at all, rather giving up on the process of engineering well.
comment on: http://stackoverflow.com/a/21843984

http://stackoverflow.com/a/20850928
answers question: http://stackoverflow.com/q/20850837
has comment: http://stackoverflow.com/comment/31278449
has body: Change to android:textAppearance="?android:attr/textAppearanceListItemSmall" and your item's will have the default selection behavior with the custom list item XML (a theory, haven't tested). EDIT: Try this to make the list item light up when you tap it like the simple_list_item_1: In the list item: android:background="@drawable/clickable" In drawable folder add this: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:state_pressed="true" android:drawable="@android:drawable/list_selector_background" /&gt; &lt;/selector&gt;
has comment: http://stackoverflow.com/comment/31278069
score: 0
has comment: http://stackoverflow.com/comment/31279070
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31278695
has comment: http://stackoverflow.com/comment/31278855
has comment: http://stackoverflow.com/comment/31278020
type: Answer
accepted answer of: http://stackoverflow.com/q/20850837

http://stackoverflow.com/a/21017512
has body: You add an applet to an html page. The jsp page gets compiled and when it runs its spits out html. So in your browser all you will have is html. So you basically need to embedd you applet to the html that is generated by your jsp page. I would suggest you to do some research on adding your applet to html. Once you have that, simply append the resulting html code (which has the applet) to your jsp page. Embed the applet in the file by adding the following applet tag anywhere between the file's tags: In an HTML file: In a JSP file: The jsp will ultimately spit out the html code.
answers question: http://stackoverflow.com/q/21017345
score: 0
has comment: http://stackoverflow.com/comment/31592299
has comment: http://stackoverflow.com/comment/31592577
has comment: http://stackoverflow.com/comment/31590973
has comment: http://stackoverflow.com/comment/31592041
has comment: http://stackoverflow.com/comment/31592225
type: Answer
has comment: http://stackoverflow.com/comment/31598768
has comment: http://stackoverflow.com/comment/31591948

http://stackoverflow.com/comment/31319993
type: Comment
score: 7
has text: expected and actual results?
comment on: http://stackoverflow.com/q/20872872
type: QuestionComment

http://stackoverflow.com/q/20940769
tagged with: apache-httpclient-4.x
answer count: 3
possible better answer: http://stackoverflow.com/a/47256215
tagged with: yahoo-finance
favorite count: 0
has title: Retrieving Stock Quotes using Yahoo Finance API
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/67170503
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20940953
tagged with: java
tagged with: classpath
type: Question
upvote count: 2
has body: I am trying to build a simple fantasy stocks JAVA application of sorts for a final project. The main problem as of now is figuring out how to retrieve the stock data. I took this snippet of code from the Yahoo Finance Java tutorials, but it seems to be outdated. Would anyone be willing help me out and update this for httpclient 4.x or link me to an example that works? Also, in command line, would I only have to reference httpclient in -cp, or httpcore as well? import java.io.*; import org.apache.commons.httpclient.*; import org.apache.commons.httpclient.methods.*; public class YahooWebServiceGet { public static void main(String[] args) throws Exception { String request = "http://api.search.yahoo.com/WebSearchService/V1/webSearch?appid=YahooDemo&amp;query=umbrella&amp;results=10"; HttpClient client = new HttpClient(); GetMethod method = new GetMethod(request); // Send GET request int statusCode = client.executeMethod(method); if (statusCode != HttpStatus.SC_OK) { System.err.println("Method failed: " + method.getStatusLine()); } InputStream rstream = null; // Get the response body rstream = method.getResponseBodyAsStream(); // Process the response from Yahoo! Web Services BufferedReader br = new BufferedReader(new InputStreamReader(rstream)); String line; while ((line = br.readLine()) != null) { System.out.println(line); } br.close(); } }
has answer: http://stackoverflow.com/a/20940953
tagged with: httpclient
has comment: http://stackoverflow.com/comment/31448927
has answer: http://stackoverflow.com/a/47256215

http://stackoverflow.com/a/20983912
has comment: http://stackoverflow.com/comment/31529978
score: 0
answers question: http://stackoverflow.com/q/20981317
type: Answer
has comment: http://stackoverflow.com/comment/39155039
has body: I am working on a project that is almost identical to this. The way I generate the worlds, I have a two-dimensional array of tiles, and a method that populates the array with tiles. The way the world is generated, I place a grass tile in each column, followed by a randomly determined number of dirt tiles, followed by stone tiles until the bottom of the world. Then, for the next column, I place a grass tile at a y-coordinate that is between -2 and +2 tiles from the previous grass's y-coordinate, and fill the rest of the column as before. Continue until you get to the end of the array.

http://stackoverflow.com/a/20912971
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/20912955
answers question: http://stackoverflow.com/q/20912955
has comment: http://stackoverflow.com/comment/31396315
downvote count: 0
type: AcceptedAnswer
score: 4
has body: split uses regular expressions as parameter, and ( is regex metacharacter which in this case starts groups. To make it literal you need to escape it for example with split("\\(") or split("[(]").

http://stackoverflow.com/q/20993303
answer count: 2
has comment: http://stackoverflow.com/comment/31546938
has comment: http://stackoverflow.com/comment/31546744
downvote count: 1
has comment: http://stackoverflow.com/comment/31546287
favorite count: 0
type: UnansweredQuestion
has title: How to create specific Date Output as String?
has comment: http://stackoverflow.com/comment/31546255
has answer: http://stackoverflow.com/a/20993807
upvote count: 0
has answer: http://stackoverflow.com/a/20993782
tagged with: java
has comment: http://stackoverflow.com/comment/31546207
has body: I have this class: public class Period { private Date startDate = new Date(); private String startTime = "10:00"; private Date endDate = new Date(); private String endTime = "23:59"; } Now i need two string outputs "2014-01-08T10:00:00" and "2014-01-08T23:59:00" ! How i can create these two outputs by using the class Period? It is necessary to work with the class Period, which includes startTime and EndTime as Strings! I only have this small code for using the class SimpleDateFormat: final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); Thanks for helping me !
has comment: http://stackoverflow.com/comment/31546634
type: Question
score: -1
has comment: http://stackoverflow.com/comment/31546042

http://stackoverflow.com/comment/31547246
score: 0
type: AnswerComment
type: Comment
has text: @user3172787 you are welcome.I was busy in answering other questions and I think Niko's answer is better than mine.If you have any other questions then feel free to ask.Always ready to help
comment on: http://stackoverflow.com/a/20993181

http://stackoverflow.com/comment/31498203
has text: JSF is in the context of this question merely a HTML code generator. You just have to write JSF code in such way that it generates exactly the desired HTML output. How would you do it in "plain HTML"? Note that you can just use "plain HTML" in a JSF page as well.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20966272
score: 1

http://stackoverflow.com/comment/31479310
score: 0
type: Comment
has text: @Dev Those are all dependency errors you will need to figure out. Consider using maven to manage them.
type: AnswerComment
comment on: http://stackoverflow.com/a/20956590

http://stackoverflow.com/a/20862606
answers question: http://stackoverflow.com/q/20862515
score: 0
type: Answer
has body: You should use another data structure to achieve that, Use a Map&lt;String,List&lt;String&gt;&gt; where the possible keys are Question,Answers,Category,Essay Then in your code you can remove all unnecessary if-else Example with your code: public static void openFile() { Map&lt;String,List&lt;String&gt;&gt; map = new HashMap&lt;&gt;(); // here you put the keys, you can do it when you read the file based in your input too dynamically map.put("Question",new ArrayList&lt;&gt;()); map.put("Answers",new ArrayList&lt;&gt;()); map.put("Category",new ArrayList&lt;&gt;()); map.put("Essay",new ArrayList&lt;&gt;()); int retrival = chooser.showOpenDialog(null); String[]array = null; if (retrival == JFileChooser.APPROVE_OPTION) { try (BufferedReader br = new BufferedReader(new FileReader( chooser.getSelectedFile()))) { String sCurrentLine; while ((sCurrentLine = br.readLine()) != null) { if (sCurrentLine.equals("")) { continue; } array = sCurrentLine.split(":"); if(map.containsKey(array[0])){ map.get(array[0]).add(array[1]); } } } catch (Exception ex) { ex.printStackTrace(); } } } You can see this way is much more cleaner and readable.

http://stackoverflow.com/q/20931001
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31429675
has answer: http://stackoverflow.com/a/20931072
has comment: http://stackoverflow.com/comment/31429765
tagged with: imagemagick
has comment: http://stackoverflow.com/comment/31429613
answer count: 1
downvote count: 0
favorite count: 0
tagged with: processbuilder
type: UnansweredQuestion
has body: I am using Process Builder to run ImageMagick commands on Windows. For some reason, with Process Builder the output image isn't being generated most times. When I tried the same command using Runtime.getRuntime().exec, output was generated. Any idea why that is? String input="D:\\Koala.jpg"; String output = "D:\\ProcessBuilderOutput\\KoalaPNG.png"; commands.add("D:\\Program Files\\ImageMagick-6.8.6-Q16\\convert"); commands.add("-alpha off"); commands.add("-strip"); commands.add(input); commands.add("-colorspace CMYK"); commands.add(output); try{ executeProcessCommand(commands); if(new File(output).exists() != true){ System.out.println("output not generated"); } }catch (Exception e) { e.printStackTrace(); } public static void executeProcessCommand(List&lt;String&gt; commands) throws Exception { Process proc = null; try { System.out.println("-executeProcessCommand: Trying to execute :- "+commands); ProcessBuilder processBuilder = new ProcessBuilder(commands); proc = processBuilder.start(); proc.waitFor(); System.out.println("- executeProcessCommand: Executed the command "); } catch (Exception e) { System.out.println(" - executeProcessCommand:" + e.getMessage()); } finally { try { if(proc != null) proc.destroy(); } catch (Exception e) { System.out.println("executeProcessCommand:"+ e.getMessage()); } } }
has title: Process Builder is not working on Windows

http://stackoverflow.com/comment/31413634
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20922844
has text: You should name your methods from lowercase letter. It is standard Java convention.

http://stackoverflow.com/a/20885171
score: 1
has body: Try this out: JPanel with GridLayout, and JLabels left and right aligned. The frame is a Box still uses a box. What should interest you is the JPanel panel code. That's where I'm adding the labels. All you have to do is nest components and layouts import java.awt.*; import javax.swing.*; import javax.swing.border.LineBorder; public class TwoLabels extends JFrame{ public TwoLabels(){ Box box = Box.createVerticalBox(); JPanel panel = new JPanel(new GridLayout(1, 2)); panel.setBorder(new LineBorder(Color.black)); JLabel label1 = new JLabel("Hello"); JLabel label2 = new JLabel("World"); label1.setHorizontalAlignment(JLabel.LEADING); label2.setHorizontalAlignment(JLabel.TRAILING); panel.add(label1); panel.add(label2); box.add(new JPanel(){ public Dimension getPreferredSize(){ return new Dimension(300, 300); } }); box.add(panel); add(box); setDefaultCloseOperation(EXIT_ON_CLOSE); pack(); setVisible(true); } public static void main(String[] args) { new TwoLabels(); } }
upvote count: 1
answers question: http://stackoverflow.com/q/20884779
type: Answer
downvote count: 0

http://stackoverflow.com/a/20925276
answers question: http://stackoverflow.com/q/20925202
score: 1
has body: Guava has a RateLimiter which may be useful for your use case. In particular, you could do something like: //initially, create one zombie every 10 seconds final RateLimiter zombieRate = RateLimiter.create(0.1); Runnable increaseRate = new Runnable() { @Override public void run() { //increase rate by 20% zombieRate.setRate(zombieRate.getRate() * 1.2); } }; //then increase the rate every minute ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); scheduler.scheduleAtFixedRate(increaseRate, 1, 1, TimeUnit.MINUTES); Your Zombie creation then becomes: while (true) { zombieRate.acquire(); createZombie(); }
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/31410568
type: Comment
has text: Can you clarify your question? What doesn't work here?
score: 2
comment on: http://stackoverflow.com/q/20921281
type: QuestionComment

http://stackoverflow.com/comment/31543854
type: AnswerComment
has text: mine is windows xp.... program successfully executed but i dont know where to look out for pdf file??
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20991779

http://stackoverflow.com/a/20901577
downvote count: 0
has body: I can't respond to this as a comment so I'll just go ahead and make it an answer. List&lt;Object[]&gt; resultList = new ArrayList(); // CREATE an empty ArrayList object resultList = query.getResultList(); // getResultList ALSO returns its own ArrayList object And since you assign the list that getResultList() returns to the same variable as you used for your own empty ArrayList, your application loses any connection to your own empty ArrayList and Java will collect it as garbage. Essentially you created it for absolutely no purpose. what JB Nizet posted is enough. List&lt;GmaThresholdParameter&gt; resultList = query.getResultList();
type: Answer
score: 1
answers question: http://stackoverflow.com/q/20901282
upvote count: 1

http://stackoverflow.com/comment/31565737
has text: Read this and it will answer all your questions and how to fix it: http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html
score: 1
comment on: http://stackoverflow.com/q/21001466
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31356618
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20868824
has text: can you post working code in the answer? That would help others that get here.

ldap-query
tags question: http://stackoverflow.com/q/20912006
tags question: http://stackoverflow.com/q/20975072
tag name: ldap-query
type: Tag

http://stackoverflow.com/comment/31565387
type: Comment
has text: Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException at DisplayableCard.display(DisplayableCard.java:16) at CardGamePanel.go(CardGamePanel.java:31) at simple$1.actionPerformed(simple.java:24)
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21003720

http://stackoverflow.com/q/20860493
downvote count: 0
tagged with: maven-3
favorite count: 0
has answer: http://stackoverflow.com/a/20860662
has title: New Maven Project in Eclipse IDE J2SE-1.5 issue
type: UnansweredQuestion
tagged with: maven
score: 1
tagged with: java
upvote count: 1
tagged with: eclipse
has answer: http://stackoverflow.com/a/20860690
tagged with: m2eclipse
has body: When I create a new maven project using m2e plugin, I choose web-app archetype, the default execution environment was set to J2SE-1.5. I'm running my eclipse with JDK 1.7.0_45 I can change it from J2SE-1.5 to JDK 1.7.0_45 using project's Libraries build path or I can specify the 'maven-compiler-plugin' source and target in pom.xml but these are temp solutions which I don't prefer. Can I change the default bounded JDK to be 1.7 instead of 1.5.
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31296139

http://stackoverflow.com/a/20907455
answers question: http://stackoverflow.com/q/20907243
has comment: http://stackoverflow.com/comment/31386093
downvote count: 0
has comment: http://stackoverflow.com/comment/31386720
accepted answer of: http://stackoverflow.com/q/20907243
has comment: http://stackoverflow.com/comment/31386465
has comment: http://stackoverflow.com/comment/31387246
score: 2
has comment: http://stackoverflow.com/comment/31386672
has comment: http://stackoverflow.com/comment/31386833
has comment: http://stackoverflow.com/comment/31386889
has comment: http://stackoverflow.com/comment/31386038
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31385953
has comment: http://stackoverflow.com/comment/31386715
has comment: http://stackoverflow.com/comment/31385734
has comment: http://stackoverflow.com/comment/31385602
has comment: http://stackoverflow.com/comment/31386558
type: Answer
has body: If you want to find those exact lines in your file then this will work: Review Master:\n\\d++\nRating:\\s*+(\\w++)\nReview Master Page" Here is an example using your input as a test string: public static void main(String[] args) throws Exception { final String in = "Review Master:\n" + "1111111111\n" + "Rating: Fail\n" + "Review Master Page"; final Matcher m = Pattern.compile("" + "Review Master:\n" + "\\d++\n" + "Rating:\\s*+(\\w++)\n" + "Review Master Page").matcher(in); while(m.find()) { System.out.println(m.group(1)); } } Output: Fail If you want to delete those lines then your need to replace the pattern in the file which your have as a String: public static void main(String[] args) throws Exception { final String in = "Some other text\n" + "Review Master:\n" + "1111111111\n" + "Rating: Fail\n" + "Review Master Page\n" + "Some final text"; final Matcher m = Pattern.compile("" + "\n?" + "Review Master:\n" + "\\d++\n" + "Rating:\\s*+(\\w++)\n" + "Review Master Page").matcher(in); final StringBuffer output = new StringBuffer(); while (m.find()) { System.out.println(m.group(1)); m.appendReplacement(output, ""); } m.appendTail(output); System.out.println("Result: \"" + output.toString() + "\""); } Output: Fail Result: "Some other text Some final text" i.e. we use the Matcher to yank the pass/fail from the input and also build the output replacing the block of text matched with nothing. You have not made clear which parts of the patterns are variable.

http://stackoverflow.com/a/20907218
accepted answer of: http://stackoverflow.com/q/20906942
has comment: http://stackoverflow.com/comment/31385547
answers question: http://stackoverflow.com/q/20906942
upvote count: 1
score: 1
has body: make sure you add your database in the odbc !! Go to the start menu and type Odbc then it will appear a dialog >> select the system dsn tap then select add then select your server whatever Mysql Or ms Access after that enter your DB info if you select Mysql then save by click ok then go to your Code and make a string whith your config and send it to the connection object!! note: You should delete your constructor and leave the compiler run the default..
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/20853584
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/20849929
downvote count: 0
score: 1
has body: Why is the savePhoneNumber method in your ClinicService.java as @Transactional(readOnly=True)? That is the cause of the problem

http://stackoverflow.com/a/20878092
type: Answer
score: 11
downvote count: 0
has comment: http://stackoverflow.com/comment/31330777
has comment: http://stackoverflow.com/comment/31329530
answers question: http://stackoverflow.com/q/20878039
has body: Marker interface is used as a tag to inform a message to the java compiler so that it can add special behavior to the class implementing it. Java marker interface has no members in it. The purpose of Marker interfaces is to force some kind of functionality in the classes by providing some functionality to a class if it implements the marker interface. Read Java Marker Interface also see What is the use of marker interfaces in Java?
has comment: http://stackoverflow.com/comment/31329563
upvote count: 11

http://stackoverflow.com/comment/31433073
type: QuestionComment
comment on: http://stackoverflow.com/q/20932897
score: 0
has text: thanks Raghunandan your comment help alot
type: Comment

http://stackoverflow.com/a/20949485
answers question: http://stackoverflow.com/q/20949439
score: 0
has body: You are trying to access the HashMap entries before you've put them in there. Also, keep in mind that you can only create an array like that when you first initialize it. This for example works though: import java.util.HashMap; public class Board { public static HashMap&lt;String, String&gt; spelMap; public static String[] mapping; public Board() { spelMap = new HashMap&lt;String, String&gt;(); spelMap.put("A", "."); spelMap.put("B", "."); spelMap.put("C", "."); spelMap.put("D", "."); spelMap.put("E", "."); spelMap.put("F", "."); spelMap.put("G", "."); spelMap.put("H", "."); spelMap.put("I", "."); spelMap.put("J", "."); spelMap.put("K", "."); spelMap.put("L", "."); spelMap.put("M", "."); spelMap.put("N", "."); spelMap.put("O", "."); spelMap.put("P", "."); spelMap.put("Q", "."); spelMap.put("R", "."); spelMap.put("S", "."); spelMap.put("T", "."); spelMap.put("U", "."); spelMap.put("V", "."); spelMap.put("W", "."); spelMap.put("X", "."); } public static void main(String args[]) { Board board = new Board(); String[] mapping = { "" + spelMap.get("A") + "-----------" + spelMap.get("B") + "-----------" + spelMap.get("C") + "", "| | |", "| " + spelMap.get("D") + "-------" + spelMap.get("E") + "-------" + spelMap.get("F") + " |", "| | | | |", "| | " + spelMap.get("G") + "---" + spelMap.get("H") + "---" + spelMap.get("I") + " | |", "| | | | | |", "" + spelMap.get("J") + "---" + spelMap.get("K") + "---" + spelMap.get("L") + " " + spelMap.get("M") + "---" + spelMap.get("N") + "---" + spelMap.get("O") + "", "| | | | | |", "| | " + spelMap.get("P") + "---" + spelMap.get("Q") + "---" + spelMap.get("R") + " | |", "| | | | |", "| " + spelMap.get("S") + "-------" + spelMap.get("T") + "-------" + spelMap.get("U") + " |", "| | |", "" + spelMap.get("V") + "-----------" + spelMap.get("W") + "-----------" + spelMap.get("X") + "" }; board.mapping = mapping; for(int i=0; i &lt; board.mapping.length; i++){ System.out.println(board.mapping[i]); } } } You could set up a getter and a setter me…
type: Answer
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/31463998

http://stackoverflow.com/a/20967838
type: Answer
has body: The file may contain images or unsupported format, in that case it'll display like that.
answers question: http://stackoverflow.com/q/20966501
score: 0

http://stackoverflow.com/comment/31349777
has text: Yes you do need a semi-colon. Sorry, I forgot that
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20884470

http://stackoverflow.com/comment/31503914
has text: tried with your suggestion but no luck :-(. My build.xml have jar build for its regular java project .what snippet u shared.. i did append and tried
comment on: http://stackoverflow.com/a/20952798
score: 0
type: AnswerComment
type: Comment

jaxp
type: Tag
tag name: jaxp
tags question: http://stackoverflow.com/q/20994438

http://stackoverflow.com/comment/31479430
comment on: http://stackoverflow.com/a/20957014
type: Comment
has text: the thing is that I have used yahoo and there seems to be a problem - http://blog.fox-it.com/2014/01/03/malicious-advertisements-served-via-yahoo/
type: AnswerComment
score: 0

http://stackoverflow.com/a/20937854
has body: Just, don't call this: gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
downvote count: 0
type: AcceptedAnswer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/20937840
type: Answer
answers question: http://stackoverflow.com/q/20937840
score: 2

http://stackoverflow.com/comment/31446890
type: Comment
score: 1
comment on: http://stackoverflow.com/a/20939692
type: AnswerComment
has text: Count is the correct value :-) You're not hitting `count++` after the break. The indexing in your second for-loop is off. If you want to check this, print out the value out count after enter 5 letters, and it'll be 5. But the indices of the elements in the array are going to b 0,1,2,3,4, so you should initialise `i` as `count-1`.

http://stackoverflow.com/a/20910103
type: Answer
answers question: http://stackoverflow.com/q/20909331
upvote count: 1
score: 1
downvote count: 0
has body: From the exception trace it appears that your trying to invoke a method on a null object: attempt_1388768204803_0006_m_000000_0, Status : FAILED Error: java.lang.NullPointerException at edu.osu.cse.ysmart.TestQuery.TestQuery1$Map.map(TestQuery1.java:42) at From the source code, the following comparison fails: if(line_buf[2].compareTo("Abid Khan") == 0) line_buf[2] is not being populated and hence the null pointer exception. You can print the values for line_buf[2] just before the if condition to see if you are having values. This will help you debug the issue.

http://stackoverflow.com/a/20971219
score: -3
type: Answer
has body: @Adrain Please use the following xpath and you should be able to fetch or change the value /parent/version/text()
answers question: http://stackoverflow.com/q/20970236
downvote count: 3
has comment: http://stackoverflow.com/comment/31505761
upvote count: 0

http://stackoverflow.com/comment/31538189
type: Comment
has text: Alexey sorry for bothering you, but did you successfully uploaded your web app with database?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20930276

http://stackoverflow.com/q/20919838
answer count: 3
has answer: http://stackoverflow.com/a/20919871
favorite count: 0
possible better answer: http://stackoverflow.com/a/20919868
has answer: http://stackoverflow.com/a/20919868
has answer: http://stackoverflow.com/a/20919890
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20919871
tagged with: java
has title: How to store elements and number of appearances in Java
score: -1
has comment: http://stackoverflow.com/comment/31407992
downvote count: 1
type: Question
upvote count: 0
has body: I got a newb question: I want to store some elements in a structure like( Object element, int count ), to say i have x number of element1 and y number of element2 For example: dog,5 cat,4 toaster, 5 car, 1 spacecraft, 3 Is there a predifined Collection in Java that does this? or do i have to define one. Thanks a lot.

http://stackoverflow.com/comment/31488405
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20961618
has text: @Neil I see. Apparently that's going to be a middle-sized or big system. Looks interesting btw. I guess I was no much help. Good luck anyways.

http://stackoverflow.com/q/20871703
tagged with: exception
has answer: http://stackoverflow.com/a/20871897
answer count: 4
has answer: http://stackoverflow.com/a/20871723
tagged with: compiler-errors
has comment: http://stackoverflow.com/comment/31317632
type: UnansweredQuestion
upvote count: 1
downvote count: 1
linked to: http://stackoverflow.com/q/14011749
type: Question
tagged with: try-catch
has answer: http://stackoverflow.com/a/20871804
has answer: http://stackoverflow.com/a/20871748
tagged with: java
has comment: http://stackoverflow.com/comment/31317597
has title: Why am I getting an unreported exception error in Java
has body: I am trying to load a text file into java to get each individual word stored in an ArrayList of words. (which is an object that I have created that is working without problems. import java.util.*; import java.io.FileOutputStream; import java.io.FileInputStream; import java.io.BufferedReader; import java.io.InputStreamReader; public class txtUtils { public ArrayList&lt;Word&gt; readFromText(ArrayList&lt;Word&gt; Words) { String file = "corpus.txt"; FileInputStream in = new FileInputStream(file); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine; while ((strLine = br.readLine()) != null) { for (int j = 0; j &lt; strLine.length(); j++){ { strLine = br.readLine(); int start = 0; for(int x= start; x &lt; strLine.length(); x++) { if(strLine.charAt(x)== ' ' || strLine.charAt(x) == '.') { Words.add(new Word((strLine.substring(start,x- 1)).toUpperCase())); start = x; } } } } } in.close(); return Words; } } When compiling it, I get this error. unreported exception java.io.FileNotFoundException; must be caught or declared to be thrown It is shown for the line, FileInputStream in = new FileInputStream(file); The file is clearly there and has even been added in my classpath, so I do not see why it keeps on throwing this exception. Is there a way to override it? If not, is there any other way to load a text file into java?
score: 0
has comment: http://stackoverflow.com/comment/31317624
favorite count: 0
tagged with: file-io

http://stackoverflow.com/comment/31431608
has text: Thanks. I had thought that the stack trace would be printed to stdout. I think you are saying that since I am catching the Exceptionable, this is not the reason the program is terminating but I see no other reason in stderr that it is terminating. I am going to try catching Exception instead of SQLException in the catch block.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/20931937
type: Comment

http://stackoverflow.com/q/20879202
has answer: http://stackoverflow.com/a/20879335
tagged with: java
type: Question
upvote count: 2
tagged with: crc16
answer count: 2
possible better answer: http://stackoverflow.com/a/20879335
tagged with: byte
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/20879362
has body: I have an char array containing hex value. It contains 6 bytes. I have calculated the crc of these 6 bytes and the function returns int value. This is the code. char buffer[] = {0x01,0x05,0x00,0x06,0x00,0x00}; byte[] bufferbyte = new String(buffer).getBytes(); for (byte bb : bufferbyte){ System.out.format("0X%x ", bb); } int crcresult; crcresult = CRC16(buffer,6); //crc calculation byte[] crc_bytes = ByteBuffer.allocate(4).putInt(crcresult).array(); for (byte b : crc_bytes){ System.out.format("0X%x ", b); } My question are I have used bytebuffer to convert crc obtained as int into byte. But the calculated crc are stored in 4 byte instead of 2 byte. I have calculated CRC 16 but the resulting crc is 32 bit . I think it is because i have returned "int" in the crc calculation and it is written that in java an int is 32 bits. So How to extract only two bytes from the byte buffer (crc_bytes) or the calculated int crc (crcresult). I have put the bytes of the "char buffer[]" and two bytes of calculated crc in single byte array. How can we append char buffer[] and crcresult in one byte array. The output of above code is 0X1 0X5 0X0 0X6 0X0 0X0 0X0 0X0 0X2d 0Xcb Where first 6 bytes are bytes converted from char array and last 4 bytes are crc.
tagged with: binary
has title: Extract certain byte from char array and byte array in java
tagged with: crc
has answer: http://stackoverflow.com/a/20879362
score: 2
type: AnsweredQuestion

http://stackoverflow.com/q/20920894
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/20920971
score: 0
tagged with: google-maps
answer count: 1
has body: Title needs a bit more explanation. So I have lots of JSON that I have parsed and put into one ArrayList. The JSON is an Array of shops. The JSONObjects are the shops details, things like name, address, latitude, longitude etc. Now in my onPostExecute I want to plot these as markers on a map and call the shops information when user clicks on a marker. I've got as far as being able to plot only one shop as a marker. The amount of shops I will have will change constantly over time, right now there are 4. In my onPostExecute I have following code: @Override protected void onPostExecute(ArrayList&lt;ShopArray&gt; shopArray) { super.onPostExecute(shopArray); double lat = shopArray.get(0).geo_lat; double lng = shopArray.get(0).geo_lng; LatLng test = new LatLng(lat, lng); gMap.addMarker(new MarkerOptions() .position(test)); } As of now my JSON has 4 shops listed, but it will only plot one on the marker. Is there a way I can call all the latitudes and longitudes and then have all the map markers show? If you need me to post my JSON let me now and I will update my post. This is sort of the final hurdle to get it shown to the user. Would really appreciate some advice on where I have gone wrong or what can be done better. Thanks in advance!
accepted answer: http://stackoverflow.com/a/20920971
has title: JSON parsed to ArrayList. How can I get it to repeat data in onPostExecute for multiple map markers?
tagged with: android
tagged with: android-asynctask
type: AnsweredQuestion
type: Question

http://stackoverflow.com/comment/31529318
score: 0
type: Comment
type: AnswerComment
has text: @ajb Anyway, your *downvoting* reveals a bug in case of multiple use of the same method on the same array :p. But OP didn't give us his context... homework or code for production ?
comment on: http://stackoverflow.com/a/20982312

http://stackoverflow.com/comment/31292797
score: 1
comment on: http://stackoverflow.com/a/20858886
type: AnswerComment
has text: @TronicZomB thanks for the edit, was struggling how to get code-tag inside of list-tag (need to add more spaces).
type: Comment

http://stackoverflow.com/q/21002343
upvote count: 2
tagged with: android
tagged with: memory-leaks
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31593160
tagged with: java
accepted answer: http://stackoverflow.com/a/21049636
type: Question
has comment: http://stackoverflow.com/comment/31564958
has comment: http://stackoverflow.com/comment/31589668
score: 2
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/21049636
favorite count: 0
has body: I'm working on an application where 90% of the activities inherit from a common activity and all these activities leak, meaning that if I go from A-&gt;B and then B-&gt;A (finish() is called), B's onDestroy() gets called but it still leaks (checked with MAT). The leaked activities are quite big (10MB~) so after going back and forth a few times the app crashes with OOM. I've checked the heap dump and followed the path to GC roots for the leaking activities and they all look like this: So I guess it's something in the common superclass that's leaking. I've already checked that all the BroadcastReceivers and listeners are unregistered when the activities get destroyed and there are no Handlers used nor anonymous inner classes which may be causing the leak (it seems to me, at least). What could be the cause of the leak? Any help would be really appreciated. EDIT I've found that there are two pieces of code that when commented out the activities are not leaking anymore: Some lines of code that instantiate a ProgressDialog. A call to postDelayed with an anonymous Runnable. In the first case, the dialog's dismiss() function is called before destruction, so I don't know why this could be the problem. In the second case, removeCallbacks is called for the Runnable in onPause, so theoretically it's properly cleaned, isnt' it? Cheers.
has title: Memory leak - Android activities held by android.os.Message

http://stackoverflow.com/a/20946814
score: 5
upvote count: 5
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20883021
type: Answer
accepted answer of: http://stackoverflow.com/q/20883021
has body: I Changed my code as following now it works fine but i think i am not using camel properly so help me to improve generate soap request using camel without writing any java code. package com.camel.test; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.soap.MessageFactory; import javax.xml.soap.MimeHeaders; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPMessage; import javax.xml.soap.SOAPPart; import org.apache.camel.CamelContext; import org.apache.camel.Exchange; import org.apache.camel.Processor; import org.apache.camel.ProducerTemplate; import org.apache.camel.component.cxf.DefaultCxfBinding; import org.apache.camel.component.cxf.common.message.CxfConstants; import org.apache.camel.impl.DefaultCamelContext; public class CamelViralTest { static CamelContext context; public static void main(String args[]) throws Exception { CamelContext context = new DefaultCamelContext(); ProducerTemplate template = context.createProducerTemplate(0); context.start(); String url = "cxf://http://localhost:8081/buzzor-service/services/ApplicationService?" + "wsdlURL=http://localhost:8081/buzzor-service/services/ApplicationService?wsdl&amp;" + "serviceName={http://service.application.buzzor.atpl.com}ApplicationService&amp;" + "portName={http://service.application.buzzor.atpl.com}ApplicationServiceHttpPort" +"&amp;dataFormat=MESSAGE"; Exchange e=sendSimpleMessage1(template,url); System.out.println(e.getOut().getBody()); Thread.sleep(10000); context.stop(); } private static Exchange sendSimpleMessage1(ProducerTemplate template, String endpointUri) { final List&lt;String&gt; params = new ArrayList&lt;String&gt;(); Map&lt;String, Object&gt; headers = new HashMap&lt;String, Object&gt;(); headers.put(CxfConstants.OPERATION_NAME, "getApplication"); headers.put("requestObject", new DefaultCxfBinding()); params.add("hello world"); Exchange exchange = template.request(endpointUri, …

http://stackoverflow.com/q/20863943
answer count: 1
has comment: http://stackoverflow.com/comment/31303262
favorite count: 0
has body: I'm writing a RESTful web service that requires multiple authentication mechanisms (basic, x509, and anonymous). I therefore have three &lt;http> elements in three separate spring context files. When I start my service, I'm getting the following exception: org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [org.springframework.security.web.SecurityFilterChain] is defined: expected single matching bean but found 3: org.springframework.security.web.DefaultSecurityFilterChain#0, org.springframework.security.web.DefaultSecurityFilterChain#1, org.springframework.security.web.DefaultSecurityFilterChain#2 I think this makes sense, right? I've defined three &lt;http> elements, so spring is probably creating three instances of org.springframework.security.web.DefaultSecurityFilterChain. And now someone is asking for a bean of type org.springframework.security.web.SecurityFilterChain, and is finding three. But, according to Spring Security documentation, this is supposed to be possible, so my question is: How do I get this scenario to work? Here are my three &lt;http> configurations: x509Auth.xml: &lt;sec:http pattern="/service/x509/**" use-expressions="true"&gt; &lt;sec:x509 subject-principal-regex="(.*)" user-service-ref="ldapUserDetailsService" /&gt; &lt;sec:intercept-url pattern="/service/x509/identity/**" access="hasRole('Domain Users')" /&gt; &lt;/sec:http&gt; basicAuth.xml: &lt;sec:http pattern="/anubis/basic/**" use-expressions="true" create-session="stateless"&gt; &lt;sec:intercept-url pattern="/service/basic/identity/**" access="isAuthenticated()" /&gt; &lt;sec:http-basic /&gt; &lt;/sec:http&gt; noAuth.xml: &lt;sec:http pattern="/service/anonymous/**" security="none" /&gt;
tagged with: spring
has comment: http://stackoverflow.com/comment/31327355
score: 2
type: AnsweredQuestion
has title: NoUniqueBeanDefinitionException with multiple http sections in Spring Security
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/20876868
accepted answer: http://stackoverflow.com/a/20876868
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/31329083
has comment: http://stackoverflow.com/comment/31303304
has comment: http://stackoverflow.com/comment/31326410
tagged with: spring-security
has comment: http://stackoverflow.com/comment/31303394

http://stackoverflow.com/comment/31570049
has text: I don't see a question here.. You have the code, it works as expected, your copy-paste feature can be assumed to work as well, so what is it that you want us to tell you?
type: QuestionComment
type: Comment
score: 5
comment on: http://stackoverflow.com/q/21006013

http://stackoverflow.com/comment/31413830
comment on: http://stackoverflow.com/q/20913509
type: Comment
type: QuestionComment
has text: @AndrewThompson :D Someone's on a roll(: I revised my code a bit to show what's happening a bit more...
score: 0

http://stackoverflow.com/q/20974729
tagged with: selenium-webdriver
score: 2
has body: I am having a problem with certain websites that cause my browser to prompt an alert when I try to switch to a different URL, or even close the browser. Some examples: http://grooveshark.com/ http://www.dollardays.com/ In order to workaround the alert with Selenium, I need to switch to that alert, and then sometimes accept it and sometimes reject it (depending on the contents of the alert). I wish to avoid solving this problem that way because: I need to guess whether I should accept the alert or reject the alert. Switching to the alert sometimes throws an exception, even though the alert is present. What preferences do I need to set in the Firefox-Profile, in order to prevent the browser from issuing such alerts (or any other alerts for that matter)? Answers in Java or Python will be highly appreciated. Thanks
upvote count: 2
type: UnansweredQuestion
tagged with: java
tagged with: selenium
type: Question
has answer: http://stackoverflow.com/a/20978612
has answer: http://stackoverflow.com/a/38181611
has title: Selenium Web-Driver Firefox Profile - Disable popup and alert windows
has answer: http://stackoverflow.com/a/20979927
downvote count: 0
favorite count: 0
tagged with: python
has answer: http://stackoverflow.com/a/31110400
answer count: 4

http://stackoverflow.com/a/20991217
has body: Yes. This is wrong.change your code to SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); dateFormat.format(new Date()) // Now working Your String should match with your date formate or you have to use date object here.
type: Answer
has comment: http://stackoverflow.com/comment/31542283
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20991172
upvote count: 1

http://stackoverflow.com/comment/31288631
score: 0
type: AnswerComment
has text: @assylias yes, i got it. I have updated my answer as well.
type: Comment
comment on: http://stackoverflow.com/a/20856736

http://stackoverflow.com/comment/31318847
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20872236
has text: lets redefine homework as something you aren't being paid to do in the professional world. Also, you need to give us way more detail.

http://stackoverflow.com/comment/31489418
type: QuestionComment
has text: All your program's allocated memory space is technically mutable. (-ish, I'm sure bits of it can be protected by the OS for some reason.) There's nothing preventing you from making a JNI call and writing random garbage wherever you want from the C code. It usually doesn't make sense to define immutability "immutable as long as you don't bypass the mechanisms that guarantee immutability". (Which, very frequently, is API design.)
score: 7
comment on: http://stackoverflow.com/q/20945049
type: Comment

http://stackoverflow.com/q/20891080
tagged with: java
has answer: http://stackoverflow.com/a/20891139
tagged with: character-encoding
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/20891138
accepted answer: http://stackoverflow.com/a/20891138
downvote count: 0
has answer: http://stackoverflow.com/a/20891137
answer count: 3
possible better answer: http://stackoverflow.com/a/20891139
favorite count: 0
has comment: http://stackoverflow.com/comment/31353868
has title: How do I convert a integer representing a character to a string?
type: AnsweredQuestion
has body: I am reading a file in Java, which gives me each character as an integer, and then processing each character one at a time. However, I cannot compare that character when it is in integer form, so how can I convert it? Example: I want: 93 → A NOT: 5 → 5 Then, I can compare it with an "if" statement.
score: 1

http://stackoverflow.com/comment/31296760
has text: It will open a Firefox browser instance.
type: Comment
comment on: http://stackoverflow.com/a/20853737
score: 0
type: AnswerComment

http://stackoverflow.com/a/20983079
has body: To read from Standard input (command line input) you must use some kind of stream reader to read the System.in stream. An InputStreamReader initialised by InputStreamReader(System.in) lets you read character by character. However, I suggest wrapping this with a BufferedReader: BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String inputLine = reader.readLine(); Must import java.io.*;
has comment: http://stackoverflow.com/comment/31537927
upvote count: 3
score: 1
downvote count: 2
answers question: http://stackoverflow.com/q/20982664
has comment: http://stackoverflow.com/comment/31528616
type: Answer

http://stackoverflow.com/q/20986983
type: Question
accepted answer: http://stackoverflow.com/a/20987053
type: AnsweredQuestion
tagged with: flicker
tagged with: java
answer count: 1
has title: Timer Flickers When It Reaches 0
has body: importing libraries public class Countdown1 extends Applet implements Runnable { // getting user input String input = JOptionPane.showInputDialog("Enter seconds: "); // converting string to integer int counter = Integer.parseInt(input); Thread countdown; public void start() { countdown = new Thread(this); countdown.start(); } // executed by thread public void run() { Timer timer; timer = new Timer(1000, new ActionListener() /* counting down time inputted */ { public void actionPerformed(ActionEvent evt) { if (counter &gt; 0) { counter--; // repainting each second repaint(); } } }); // timer started timer.start(); } public void paint(Graphics g) { //painting text and time g.setFont(new Font("Times New Roman", Font.BOLD, 35)); g.drawString("Seconds: " + String.valueOf(counter), 260, 210); setBackground(Color.orange); setForeground(Color.magenta); // change background to cyan when timer reaches 0 if (counter == 0) { setBackground(Color.cyan); } } }
has answer: http://stackoverflow.com/a/20987053
tagged with: timer
score: 0

http://stackoverflow.com/comment/31541134
comment on: http://stackoverflow.com/q/20990565
score: 0
type: Comment
type: QuestionComment
has text: @blackbelt sorry I don't understand you

http://stackoverflow.com/a/20895816
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31384636
has comment: http://stackoverflow.com/comment/31369930
has comment: http://stackoverflow.com/comment/31385684
has body: In your code for Table Column "slected" selected.setCellValueFactory(new PropertyValueFactory&lt;User, Boolean&gt;("active")); you're setting propertyvalue factory "active" but there is no "active" property in your User class .When you move scroll bar tableview trigger updateItem method,as you don't have active property (even if you have property default value is false) checkbox.setSelected(item); line will deselect checkbox as item value is always false. To fix this issue define a BooleanProperty active in user class and update property value when user selected/deselected checkbox. Here is whole code which is working import javafx.application.Application; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.*; import javafx.scene.control.cell.PropertyValueFactory; import javafx.stage.Stage; import javafx.util.Callback; import javafx.scene.layout.BorderPane; import java.util.LinkedList; import java.util.List; public class TestApp extends Application { List&lt;User&gt; list = new LinkedList&lt;&gt;(); TableColumn&lt;User, Integer&gt; id; TableColumn&lt;User, String&gt; firstName; TableColumn&lt;User, Boolean&gt; selected; TableView&lt;User&gt; tableView; public static void main(String[] args) { launch(); } @Override public void start(Stage stage) throws Exception { stage.setHeight(500); stage.setWidth(500); stage.setMinHeight(200); stage.setMinHeight(100); stage.setTitle("Table view"); tableView = new TableView&lt;&gt;(); ObservableList&lt;User&gt; list = FXCollections.observableArrayList(); for(int i = 0; i &lt; 40; i++) { list.add(new User(i, "first name", "last name")); } id = new TableColumn("ID"); id.setCellValueFactory(new PropertyValueFactory&lt;User, Integer&gt;("id")); firstName = new TableColumn("First Name"); firstName.setCellValueFactory(new PropertyValueFactory&lt;User, String&…
has comment: http://stackoverflow.com/comment/31382516
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20862024
answers question: http://stackoverflow.com/q/20862024
type: Answer

http://stackoverflow.com/q/20941772
has comment: http://stackoverflow.com/comment/31450563
has body: I have 2 classes one of which is a GUI. My first class is called MusicSearch.java and it has this: public static void directoryMusicLocator(File dir) { try { String[] filetype = new String[] { "mp3" }; // only search mp3 files System.out.println("Getting all .mp3 files in " + dir.getCanonicalPath() + " including those in subdirectories"); List&lt;File&gt; files = (List&lt;File&gt;) FileUtils.listFiles(dir, filetype, true); for (File file : files) { System.out.println(file.getAbsolutePath()); // get the file's absolute path } System.out.println("\nFinished Searching."); } catch (IOException e) { e.printStackTrace(); } } What this does is that it searches for Mp3 files on a directory for example C:\Music For the GUI, well I created it using netbeans' JFrame Designer and a screenshot of this can be seen on the image below. (I can't embed images at the moment so I can only provide a link to the image.) https://i.sstatic.net/7pLPL.jpg On the JTextField next to the "Enter Location", the user enters a location for example C:\Music. When the user clicks the button "Find MP3's" the method directoryMusicLocator is called. Below is the Action Listener for the Find MP3's button: private void findMP3ButtonActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: String fLocation = dirToSearch.getText(); // this gets the input from the textfield File dir = new File(fLocation); // converts the location to path MusicSearch.directoryMusicLocator(dir); } An example of the output can be seen below when it is ran and user entered C:\Music on the textfield: C:\Music\Feint - Times Like These (Fracture Design Remix).mp3 C:\Music\Ficci - Climax (FREE).mp3 C:\Music\Ficci - Making Me Blue (FREE).mp3 Now what I want is the output to display on the JTextArea but I don't know how. Can someone tell me how. Thanks
answer count: 3
has answer: http://stackoverflow.com/a/20941831
accepted answer: http://stackoverflow.com/a/20941831
upvote count: 1
has comment: http://stackoverflow.com/comment/31450597
favorite count: 0
has answer: http://stackoverflow.com/a/20941840
has answer: http://stackoverflow.com/a/20941827
tagged with: swing
tagged with: jbutton
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: jtextarea
has title: Java Swing, On button click, output to JTextArea
possible better answer: http://stackoverflow.com/a/20941827

http://stackoverflow.com/a/20967160
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31498057
has comment: http://stackoverflow.com/comment/31501092
type: Answer
accepted answer of: http://stackoverflow.com/q/20966883
answers question: http://stackoverflow.com/q/20966883
has body: Well, the messages are actually stored in a persistent manner. From the offical documentation: Each HornetQ server has its own ultra high performance persistent journal, which it uses for message and other persistence. HornetQ has its own way of storing the messages directly on the file system. If you want to store the messages in the MySQL database, this is not supported by HornetQ, and will probably not be in the future. This has been debated a few times, for example here. The HornetQ team obviously don't think there is a need to add such support.
score: 0

http://stackoverflow.com/comment/31515959
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20972181
has text: user, try to open it with a different editor. On your Linux machine use gedit or kate, on your windows machine use notepad++. Also try the suggestion on my first comment (building new linux when you write to the file). Cheers
type: Comment

http://stackoverflow.com/comment/31351652
has text: Exactly. But what am I doing wrong? I have never gotten this problem before.
type: Comment
comment on: http://stackoverflow.com/a/20890020
type: AnswerComment
score: 0

http://stackoverflow.com/q/20875403
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20875560
accepted answer: http://stackoverflow.com/a/20875560
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: JsonParser ArrayIndexOutOfBoundsException when parsing json
has comment: http://stackoverflow.com/comment/31325307
type: Question
has comment: http://stackoverflow.com/comment/31325268
answer count: 1
has comment: http://stackoverflow.com/comment/31325066
has comment: http://stackoverflow.com/comment/31325197
score: 0
tagged with: parsing
has body: The following code should work as a JsonParser but it is returning an ArrayIndexOutOfBoundsException even though I check that there are still elements to parse. public void parseJson(String url) { try { InputStream is = new URL(url).openStream(); JsonParser parser = Json.createParser(is); while (parser.hasNext()) { Event e = parser.next(); if (e == Event.KEY_NAME) { if (parser.getString().equals("name") &amp;&amp; parser.hasNext()) { parser.next(); writer = new BufferedWriter(new FileWriter("names.txt")); writer.write(parser.getString()); } } } } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } The error produced is such: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 4096 at org.glassfish.json.JsonTokenizer.readChar(JsonTokenizer.java:388) at org.glassfish.json.JsonTokenizer.read(JsonTokenizer.java:98) at org.glassfish.json.JsonTokenizer.readString(JsonTokenizer.java:124) at org.glassfish.json.JsonTokenizer.nextToken(JsonTokenizer.java:310) at org.glassfish.json.JsonParserImpl$StateIterator.nextToken(JsonParserImpl.java:157) at org.glassfish.json.JsonParserImpl$StateIterator.next(JsonParserImpl.java:182) at org.glassfish.json.JsonParserImpl.next(JsonParserImpl.java:150) at proj.Proj2.parseJson(Proj2.java:43) at proj.Proj1.main(Proj1.java:78) It parses everything up to when the error is thrown. Sample JSON that produces error: [{"id":774,"na":"Hungry Leaf","cs_phone":"919-234-7755","rds_info":{"id":125,"name":"Triangle Food Guy","logo":""},"services":{"deliver":{"time":1200,"mino":100,"can":0}},"allow_tip":1,"allow_asap":1,"cu":["American","Breakfast","Sandwiches"],"addr":"2608 Erwin Rd, Durham, NC","full_addr":{"addr":"2608 Erwin Rd","addr2":"","city":"Durham","state":"NC","postal_code":"27705-3843"},"city":"Durham","latitude":36.008621,"longitude":-78.94474,"del":1200,"mino":100,"is_delivering":0},{"id":780,"na":"Armadillo Grill","cs_phone":"919-234-7755","rds_info":{"id":125,"name":"Tr…
has comment: http://stackoverflow.com/comment/31325297

http://stackoverflow.com/comment/37662372
comment on: http://stackoverflow.com/a/23630457
type: Comment
score: 1
type: AnswerComment
has text: Thanks for your effort. However, on Win8 (maybe also on old Win OS?), the compiler complains about the statement `Process proc = new ProcessBuilder(ADBExecutor.WIN_RUNTIME, "adb devices").start();`: `The constructor ProcessBuilder(String[], String) is undefined`. Therefore, I edit it to `Process proc = new ProcessBuilder("cmd.exe", "/C", this.adb_directory, "devices").start();` and it works. Please check it out.

http://stackoverflow.com/comment/31473571
type: Comment
comment on: http://stackoverflow.com/a/20953813
has text: @user3165913 Well, that is what my code example at the end shows you.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31548770
comment on: http://stackoverflow.com/a/20989807
score: 1
type: AnswerComment
has text: I've edited my answer with examples, I hope it's clearer now. Configure Hibernate to log the SQL queries executed and you will learn a lot ;)
type: Comment

http://stackoverflow.com/comment/31586901
comment on: http://stackoverflow.com/a/20994643
type: Comment
has text: I suggest that you should start with OSGi in the way as you can. Try out some tutorials about Declarative Services. If you do not see, how you could achieve your goals, move to Blueprint (probably Aries). However, keep in mind that you may change back later, when you had a couple of projects with OSGi. If you want an example that uses JPA and DS, you can check the enRoute example, written by Peter Kriens: https://github.com/osgi/osgi.enroute.blog
score: 0
type: AnswerComment

http://stackoverflow.com/a/20990879
has body: A primitive wrapper class in the Java and ActionScript programming languages is one of eight classes provided in the java.lang package to provide object methods for the eight primitive types. All of the primitive wrapper classes in Java are immutable. J2SE 5.0 introduced autoboxing of primitive types into their wrapper object, and automatic unboxing of the wrapper objects into their primitive value—the implicit conversion between the wrapper objects and primitive values. Wrapper classes are used to represent primitive values when an Object is required. The wrapper classes are used extensively with Collection classes in the java.util package and with the classes in the java.lang.reflect reflection package. The primitive wrapper classes and their corresponding primitive types are: Primitive type -> Wrapper class -> Constructor Arguments byte -> Byte -> byte or String short -> Short -> short or String int -> Integer ->int or String long -> Long -> long or String float -> Float -> float, double or String double -> Double -> double or String char -> Character ->char boolean -> Boolean -> boolean or String The Byte, Short, Integer, Long, Float, and Double wrapper classes are all subclasses of the Number class. The wrapper classes BigDecimal and BigInteger are not one of the primitive wrapper classes and are mutable. see also this So in conclusion objects(Character) can be assigned the null value in Java but primitive (char) cannot since they denote a location in memory having on value, but primitives are references for a memory location containing the whole class
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20990580

http://stackoverflow.com/comment/31568621
comment on: http://stackoverflow.com/a/20994314
type: AnswerComment
has text: you might have to write >= while checking. just run and let me know.
score: 0
type: Comment

http://stackoverflow.com/a/20871528
type: Answer
accepted answer of: http://stackoverflow.com/q/20871374
has comment: http://stackoverflow.com/comment/31317329
answers question: http://stackoverflow.com/q/20871374
downvote count: 0
score: 1
has body: It looks like you start your recording service when the phone state changes (for example, from "idle" to "offhook"). But then in that service you don't register your broadcast receiver to listen for phone state changes and you also don't ever start recording, so nothing ever happens. You should pass data to the service to tell it the phone state change when it starts, then make sure you register your broadcast receiver when it starts. You will also need to handle the fact that you now have two broadcast receivers listening for phone state changes and possibly starting and stopping your recording.
has comment: http://stackoverflow.com/comment/31413424
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31317708
has comment: http://stackoverflow.com/comment/31410214
has comment: http://stackoverflow.com/comment/31436395
has comment: http://stackoverflow.com/comment/31333391
upvote count: 1
has comment: http://stackoverflow.com/comment/31325170
has comment: http://stackoverflow.com/comment/31430992

http://stackoverflow.com/a/20949847
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20949612
has body: Apart from the StringBuilder solution suggested in previous answer, you can try different approaches to speed it up dramatically: Use BufferedInputStream. You know the file size. You can allocate a char buffer of file size and slurp the whole file content into it using java.io.Reader.read(char[] buf) method. Be careful about huge files; slurping huge files may make you run into OutOfMemoryException. Use a XML parser to load XML content. They know how to read the file efficiently (oh, implementation dependent; better than the logic you used in any case). Be careful about DOM parsers; they may make you run into OutOfMemoryException if the file is huge. You may want to use SAX parser to get events of each image content being read so that you can handle them one at a time.
type: Answer

http://stackoverflow.com/comment/31511239
comment on: http://stackoverflow.com/a/20974436
has text: You'll need an [AffineTransform](http://docs.oracle.com/javase/7/docs/api/java/awt/geom/AffineTransform.html), this [code](http://svn.apache.org/repos/asf/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/util/UnitConv.java?p=820841) may help - and remember there are 72 dots per inch on your screen (and 300 dots per inch in a high quality PDF - about 118 dots per cm).
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31613413
type: Comment
has text: I would use SLSB for mobile application as well. I've designed mobile applications that interacts with barebone serlvets reading plain JSON responses produced using SLSB injected via CDI (@EJB annotations).
comment on: http://stackoverflow.com/a/21009392
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31494463
comment on: http://stackoverflow.com/a/20965247
has text: but any idea how could i make similar like snasphot is ..pls help.
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/31551509
type: Comment
has text: you are right. my fault. see edit in question I will shortly post.
comment on: http://stackoverflow.com/a/20995908
type: AnswerComment
score: 0

object
tags question: http://stackoverflow.com/q/20930901
tags question: http://stackoverflow.com/q/20931176
tags question: http://stackoverflow.com/q/20931464
tag name: object
tags question: http://stackoverflow.com/q/20958454
tags question: http://stackoverflow.com/q/20930676
tags question: http://stackoverflow.com/q/20942130
tags question: http://stackoverflow.com/q/20891721
tags question: http://stackoverflow.com/q/20992009
tags question: http://stackoverflow.com/q/21013349
tags question: http://stackoverflow.com/q/20880993
tags question: http://stackoverflow.com/q/21011732
tags question: http://stackoverflow.com/q/20878862
tags question: http://stackoverflow.com/q/20890770
tags question: http://stackoverflow.com/q/20897165
tags question: http://stackoverflow.com/q/20867912
tags question: http://stackoverflow.com/q/20881315
tags question: http://stackoverflow.com/q/20956462
tags question: http://stackoverflow.com/q/20898050
tags question: http://stackoverflow.com/q/21006061
tags question: http://stackoverflow.com/q/20981919
tags question: http://stackoverflow.com/q/20983658
tags question: http://stackoverflow.com/q/20941574
tags question: http://stackoverflow.com/q/20927735
tags question: http://stackoverflow.com/q/21003803
tags question: http://stackoverflow.com/q/20864868
tags question: http://stackoverflow.com/q/20943476
tags question: http://stackoverflow.com/q/20943709
tags question: http://stackoverflow.com/q/20983563
tags question: http://stackoverflow.com/q/20895806
tags question: http://stackoverflow.com/q/20941413
tags question: http://stackoverflow.com/q/20956561
tags question: http://stackoverflow.com/q/20914881
type: Tag
tags question: http://stackoverflow.com/q/20850741
tags question: http://stackoverflow.com/q/20944679

http://stackoverflow.com/comment/31482809
comment on: http://stackoverflow.com/q/20854585
type: Comment
has text: I've added an example project on github, that has the same NoSuchBeanException after deploying the war to tomcat and starting the application. (the spring datasource properties are dummies in the example, but that shouldn't matter for this example).
score: 0
type: QuestionComment

http://stackoverflow.com/comment/31573555
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21007594
has text: I sort of have the same question as OP. I never really understood the difference between initiating an object in the constructor or doing it when you declare it as a field.

http://stackoverflow.com/comment/31330096
type: QuestionComment
comment on: http://stackoverflow.com/q/20878221
score: 0
has text: As mentioned in other answers you can put autowire on a non-static method and modify desired static filed inside it. Which is simpler than creating custom annotation. Link : http://www.connorgarvey.com/blog/?p=105
type: Comment

http://stackoverflow.com/comment/31396549
type: AnswerComment
has text: Of course if you really just want to convert to or from hex, there are much more efficient ways to do it.
score: 0
comment on: http://stackoverflow.com/a/20913435
type: Comment

http://stackoverflow.com/q/20974765
upvote count: 22
linked to: http://stackoverflow.com/q/20819376
answer count: 2
has answer: http://stackoverflow.com/a/20976921
downvote count: 0
has title: How to define a global PatternLayout for log4j2?
score: 22
accepted answer: http://stackoverflow.com/a/20976921
has body: Is it possible to define a (named) PatternLayout within a log4j2.xml configuration file? <?xml version="1.0" encoding="UTF-8"?> <PatternLayout pattern="%d %-5p %C{2} (%F:%L) - %m%n" /> <PatternLayout pattern="%d %-5p %C{2} (%F:%L) - %m%n" /> <appender-ref ref="CONSOLE" /> <appender-ref ref="DEBUG_FILE" /> In this example the PatternLayout is repeated. Could I define it somehow globally with a name, and then just use the name reference to set the pattern for each appender?
favorite count: 0
has comment: http://stackoverflow.com/comment/77004997
tagged with: log4j2
tagged with: logging
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/32244993
has answer: http://stackoverflow.com/a/32244993
tagged with: java
type: Question

http://stackoverflow.com/a/20963994
has comment: http://stackoverflow.com/comment/31492369
downvote count: 0
answers question: http://stackoverflow.com/q/20963975
type: Answer
has body: You should use an array: int[] numbers = new int[5]; And then iterate through the array and assign values at each index. If you have intentions of sorting the array, invoke Arrays.sort(numbers);
has comment: http://stackoverflow.com/comment/31492273
has comment: http://stackoverflow.com/comment/31492316
has comment: http://stackoverflow.com/comment/31492227
upvote count: 1
has comment: http://stackoverflow.com/comment/31492438
score: 1

http://stackoverflow.com/q/20893506
has comment: http://stackoverflow.com/comment/31358814
has title: How do I prevent static methods from calling within different packages?
tagged with: static
has answer: http://stackoverflow.com/a/20893544
type: UnansweredQuestion
tagged with: java
type: Question
has body: Okay, so my question is probably going to be a bit confusing, so bear with me. I'm accessing this method from a different class, in a static way : // Call GuiHandling.handleGui(); // Method public static void handleGui() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { GUI gui = new GUI(); gui.setLocationRelativeTo(null); TabMaker.MAIN_GUI = gui; } catch (Exception e) { e.printStackTrace(); } } }); do General.sleep(10); while (!Config.MOVE_ON &amp;&amp; !Config.STOP_SCRIPT); } I have two projects in java, with the exact same package and class naming, I.e. scripts.gui.guiUtil When I run the program, the GUI from the other project loads. So, essentially what I'm asking, is how would I go about removing the static modifier, and accessing it non-statically so the correct GUI loads? Note: - I do not have the other class imported - It's loading the other GUI as both projects are being run under the same JVM - I've tried this: http://java.dzone.com/articles/why-static-bad-and-how-avoid but I'm not sure on how to initialize the Client constructor, or even if that will solve my problem. Thanks in advance, let me know if I can clear anything up, or if I left anything else
score: 0
has comment: http://stackoverflow.com/comment/31358740
answer count: 1

http://stackoverflow.com/comment/51557152
type: QuestionComment
has text: My experiences with similar problem is shared [here][1] [1]: http://stackoverflow.com/questions/31774695/using-multipart-without-form-in-spring-mvc
score: 1
comment on: http://stackoverflow.com/q/21015891
type: Comment

http://stackoverflow.com/q/20877025
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/52508364
tagged with: libgdx
score: 1
tagged with: java
has body: I was going to rain as follows: Various actors in a "Stage" falling vertically, being drawn randomly on the screen. (But it has a higher cost in processing and memory) I made a simple example with particle (to whom I sent screen and full class code in the 1st post), and I realized that maybe used for particle effects: rain Cloud passing horizontally mist Sandstorm thunder Particles would be more interesting with, so I decided to just ask about the rain and it aparti have mold to see how would the other effects. Forum LibGDX: How to create a rain and cloud? (Using "Particle")
upvote count: 1
has title: LibGDX - How to create a rain and cloud? (Using "Particle")
favorite count: 0
tagged with: android
tagged with: particles
downvote count: 0
answer count: 0

http://stackoverflow.com/q/20925219
has body: I know that this question was asked many times before, but unfortunately none of the answers solved my problem, I'm using ubuntu 13.04 and I'm writing jsp file on eclipse that has to be connected to mysql database but whenever I wrote the following line in the code : Class.forName("com.mysql.jdbc.Driver").newInstance(); I found an exception java.lang.ClassNotFoundException: com.mysql.jdbc.Driver, I'm aware that I should use mysql-connector jar file and drop it in web-INF folder and tomcat lib folder and some other folder but unfortunately none of these worked!.Any help please?(please be specific)
has comment: http://stackoverflow.com/comment/31418958
score: 1
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/31419041
tagged with: eclipse
has comment: http://stackoverflow.com/comment/31418473
upvote count: 1
tagged with: ubuntu
has comment: http://stackoverflow.com/comment/31418987
has comment: http://stackoverflow.com/comment/31418977
tagged with: jdbc
favorite count: 0
duplicate of: http://stackoverflow.com/q/2353141
answer count: 0
downvote count: 0
has title: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver ubuntu?
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2353141
type: Question

http://stackoverflow.com/comment/31483752
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20958775
has text: This class is missing: com.proteinbar.staging.DeleteBillingAddress

http://stackoverflow.com/comment/31403637
score: 0
type: Comment
has text: Thanks for your comment. Like spring security provides support for stateless feature does Oauth 2 also provide any support given their are so many applications made now a days which are stateless.
comment on: http://stackoverflow.com/a/20905172
type: AnswerComment

http://stackoverflow.com/q/20960494
answer count: 2
has answer: http://stackoverflow.com/a/20960732
downvote count: 0
favorite count: 0
has title: Making an executable with most Java code, but maybe another language added in
score: 1
tagged with: exe
tagged with: c++
accepted answer: http://stackoverflow.com/a/20960732
possible better answer: http://stackoverflow.com/a/20961679
has answer: http://stackoverflow.com/a/20961679
upvote count: 1
type: AnsweredQuestion
tagged with: dmg
tagged with: java
has body: I have been looking everywhere, and being a novice at Java and lacking proper terminology it seems impossible to find this. I assume the correct term is "wrapping", but looking at other Java applications, such as: Minecraft, and seeing how pretty the launcher is and custom buttons, it seems impossible to accomplish such a feat with JFrame. Do they code their own sort of frame? I've heard that you can "wrap" Java code in like C++ to make the launcher, and after passing the screen is launches the game (minecraft.jar). Also, how is the exe file created? That once it is run it checks for a patch from the server, that installs the necessary files in a given directory and checks there for save files? Is it another language? if so which? Which do You recommend? A resource for learning all of this? These are the main aspects that I've been struggling to learn as no one seems to ask a similar question as I. Also, considering Java is cross-platform, my main targets are Windows > Mac, for now I can't be bothered to worry about Linux considering I'm already struggling so much here; so for now, how to create a Exe file, if need be, in C++ or any other language, then perhaps DMG for Mac.
type: Question

http://stackoverflow.com/comment/31802686
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20942821
has text: Place new Thread(new WorkerRunnable(clientSocket, this)).start(); into the try { ... block to avoid threads for clientSocket = null

http://stackoverflow.com/comment/31399360
type: Comment
comment on: http://stackoverflow.com/a/20914909
has text: Works fine in Java 7, no warnings with `-Xlint:all`
type: AnswerComment
score: 0

http://stackoverflow.com/q/21003087
score: 2
tagged with: mysql
type: Question
tagged with: java
has title: Jooq INSERT on duplicate key UPDATE
upvote count: 2
has body: Trying to use "jooq" to work with db (MySQL). It looks like nice, but as sql query more complex jooq construction more obscure. Is anybody know what code should I write to get SQL-analog for: INSERT INTO table (field1, field2, counter) VALUES (123, abc, 10), (124, cde, 20) ON DUPLICATE KEY UPDATE counter = counter + VALUES(counter);
tagged with: sql
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21038160
tagged with: jooq
type: UnansweredQuestion

http://stackoverflow.com/q/20896733
score: 0
tagged with: windows
tagged with: windows-7
type: UnansweredQuestion
tagged with: swt
type: Question
has answer: http://stackoverflow.com/a/20899649
tagged with: java
answer count: 1
has title: How can I allow dropping a file on the Windows 7 taskbar icon using Java or SWT?
has body: When I drag a file onto the Chrome taskbar icon, Windows asks me Pin to Google Chrome. When I shift+drag a file onto the Chrome taskbar icon, Windows asks me Open with Google Chrome. I would like for my SWT application to have this same behavior, or at least some response to files being dropped onto the taskbar icon. I have already added a DropListener to my root Shell, which lets me intercept drop events onto the title bar of my application, but it doesn't respond to drop events on the taskbar icon. Any tips?

http://stackoverflow.com/comment/31527743
comment on: http://stackoverflow.com/q/20982394
score: 0
type: QuestionComment
type: Comment
has text: possible duplicate of ["implements Runnable" vs. "extends Thread"](http://stackoverflow.com/questions/541487/implements-runnable-vs-extends-thread)

http://stackoverflow.com/a/20886568
accepted answer of: http://stackoverflow.com/q/20879163
has body: Define a ColumnConstraints object, and use it in the grid pane: ColumnConstraints firstColumn = new ColumnConstraints(); grid.getColumnConstraints().addAll(firstColumn); You can set the min, pref, and max width on the column constraints to control how much that column is allowed to be resized (for example, setting all three to the same fixed value will force the column to be that size). You might also want to set the wrapping width of your text, so that it takes up less space.
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/20879163
upvote count: 1

http://stackoverflow.com/a/20998657
type: Answer
answers question: http://stackoverflow.com/q/20998436
score: 1
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31557308
has body: You need a RelativeLayout, not a LinearLayout. Image A must specify the attribute android:layout_alignParentTop="true". Image B must specify the attributes android:layout_alignParentBottom="true" and android:layout_alignParentLeft="true". Image C must specify the attributes android:layout_alignParentBottom="true" and android:layout_alignParentRight="true"
has comment: http://stackoverflow.com/comment/31556887

http://stackoverflow.com/comment/31591460
has text: What is `Im`? What is `PixelGrabber`?
score: 1
comment on: http://stackoverflow.com/q/21017828
type: QuestionComment
type: Comment

http://stackoverflow.com/a/20931932
downvote count: 0
has comment: http://stackoverflow.com/comment/31431254
type: Answer
has body: See if this works for you. I just edited your code. it might not be the best answer. public static void receiver(String firstArg) {// Receives // Input // File String cipherText; String key; String inFile = new File(firstArg).getAbsolutePath(); Path file = new File(inFile).toPath(); // File in = new File(inFile); try (InputStream in = Files.newInputStream(file); BufferedReader reader = new BufferedReader( new InputStreamReader(in))) { String line = null; List&lt;String&gt; lines = new ArrayList(); while ((line = reader.readLine()) != null) { lines.add(line);//trim line first though and check for empty string } for(int i=1;i&lt;lines.size();i++){ cipherText = arrayLine[i]; // key = arrayLine[1]; System.out.println(arrayLine[i] + " " + arrayLine[i-1]); cipherKeyPairs.put(arrayLine[i-1], arrayLine[i]); } } catch (IOException x) { System.err.println(x); } }
score: 1
has comment: http://stackoverflow.com/comment/31431313
upvote count: 1
answers question: http://stackoverflow.com/q/20931859

http://stackoverflow.com/comment/31451661
type: QuestionComment
comment on: http://stackoverflow.com/q/20942423
has text: Can you post the surrounding context?
score: 0
type: Comment

http://stackoverflow.com/a/20937686
score: 0
has body: My friend you can use this example hope this helps you http://www.java2s.com/Code/Java/Collections-Data-Structure/Asimpleappletclasstodemonstrateasortalgorithm.htm This is the example for a simple applet class to demonstrate bubble sort
type: Answer
has comment: http://stackoverflow.com/comment/31442409
has comment: http://stackoverflow.com/comment/31442523
accepted answer of: http://stackoverflow.com/q/20937532
answers question: http://stackoverflow.com/q/20937532
has comment: http://stackoverflow.com/comment/31442465
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31442422
has comment: http://stackoverflow.com/comment/31442590

http://stackoverflow.com/a/20879011
type: Answer
has body: Change if(list1!=null&amp;!list1.isEmpty()) in to if(list1!=null&amp;&amp;!list1.isEmpty()) short-circuit(like &amp;&amp;), don't evaluate the right hand side if it that doesn't necessary. As an example if &amp;&amp; left hand side is false no need to evaluate right hand side one. In other way || if left is true no need to evaluate right hand side one. So if list is null rest of the part will not evaluate. non-short(like &amp;) evaluvate both side always.So you will get NullPointerException.
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/20878999

http://stackoverflow.com/comment/31456911
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20940160
has text: Sorry, mistaken what you wanted with the printout. It said "digits", which to me was referring to number of digits left at that point in loop, to debug how many iterations it takes, instead of saying "digit" and referring to a singular one. Loop condition was fine.
type: Comment

http://stackoverflow.com/q/20939115
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/20939153
has comment: http://stackoverflow.com/comment/31445407
tagged with: netbeans
tagged with: java
possible better answer: http://stackoverflow.com/a/20939153
tagged with: swing
duplicate of: http://stackoverflow.com/q/20934382
type: Question
has answer: http://stackoverflow.com/a/20939293
accepted answer: http://stackoverflow.com/a/20939293
type: AnsweredQuestion
has title: Change the way JRadioButtons displayed on JPanel
linked to: http://stackoverflow.com/q/20934382
has body: I have a JPanel, and I want to add JRadioButtons to it, this is the code I tried : private void populateQuestionnaire(Question question){ buttonGroup = new ButtonGroup(); for(Choix c : question.getListChoix()) { radioButton = new JRadioButton(c.getChoixLibelle()); buttonGroup.add(radioButton); jPanel1.add(radioButton); } jPanel1.revalidate(); jPanel1.repaint(); } And I have the layout of JPanel is FlowLayout. This is how the JRadioButtons displayed : I want JRadioButtons to be added one below the other and to be centered in the JPanel.

http://stackoverflow.com/q/20977361
has comment: http://stackoverflow.com/comment/31516956
has comment: http://stackoverflow.com/comment/31517260
has comment: http://stackoverflow.com/comment/31517347
answer count: 6
has comment: http://stackoverflow.com/comment/31517079
score: 0
linked to: http://stackoverflow.com/q/1102891
has comment: http://stackoverflow.com/comment/31516910
has comment: http://stackoverflow.com/comment/31517386
has comment: http://stackoverflow.com/comment/31516975
has answer: http://stackoverflow.com/a/20977684
has title: Identify if string can be converted into int array
favorite count: 0
has comment: http://stackoverflow.com/comment/31516775
has answer: http://stackoverflow.com/a/20978304
has comment: http://stackoverflow.com/comment/31517765
has answer: http://stackoverflow.com/a/20977695
upvote count: 1
tagged with: regex
possible better answer: http://stackoverflow.com/a/20977667
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31517649
has answer: http://stackoverflow.com/a/20977779
has answer: http://stackoverflow.com/a/20977667
has body: I have a converter that will convert an array of int into a String. **EDIT** [1, 2, -45, 678] -&gt; "1 2 -45 678"; [1] -&gt; "1" Into this converter, I have a supportFromString method to identify if the string can be converted back into an array. I though of using regex to do so, but I can't find a good match. I tried "\\d+\\s" and "[\\d+]\\s" but s.matches(pattern) returns false. Any suggestion? If one non-numeric character is found, it's not valid. EDIT Here is the toString method of the converter @Override public String toString(Object o, ConverterContext converterContext) { StringBuilder builder = new StringBuilder(); for (Integer integer : ((Integer[]) o)) { if (builder.toString().length() &gt; 0) { builder.append(" "); } builder.append(integer); } return builder.toString(); }
tagged with: java
accepted answer: http://stackoverflow.com/a/20977684
has answer: http://stackoverflow.com/a/20977599
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31517295

http://stackoverflow.com/comment/31504751
comment on: http://stackoverflow.com/q/20970165
type: Comment
score: 0
type: QuestionComment
has text: i want cpu usage in percentage by java process. how can i get using JMX?

http://stackoverflow.com/comment/31392541
type: Comment
comment on: http://stackoverflow.com/a/20911494
type: AnswerComment
score: 0
has text: the OP has something wrong. `file.getname()` does indeed return only the file name + extension, no path is returned. I've tested on OpenJDK and Oracle's java, both Java 7.

http://stackoverflow.com/comment/31432542
comment on: http://stackoverflow.com/q/20932402
score: 0
type: Comment
has text: Add logging to your `onReceive()` and then check the logcat to see if it is getting called. `Toast` is an unreliable debugging technique.
type: QuestionComment

http://stackoverflow.com/comment/31495190
has text: How are you writing the object in file.Paste that code too
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20965658
score: 0

http://stackoverflow.com/comment/31569928
type: QuestionComment
score: 1
has text: Ok, I checked - I created it through eclipse, maven project with vaadin7 artifact, and then widgetset does not get compiled.
comment on: http://stackoverflow.com/q/21005268
type: Comment

http://stackoverflow.com/comment/31572603
score: 0
has text: This is the line: Class.forName(driver).newInstance(); where driver is com.mysql.jdbc.Driver
comment on: http://stackoverflow.com/q/21007204
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31466825
comment on: http://stackoverflow.com/a/20950476
has text: You also use so called `tagged hooks` which will allow you to make custom `@Before` and `@After` - http://zsoltfabok.com/blog/2012/09/cucumber-jvm-hooks/
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31557425
type: QuestionComment
has text: Do you have two or one super constructor ?
comment on: http://stackoverflow.com/q/20999559
score: 0
type: Comment

http://stackoverflow.com/comment/31752828
comment on: http://stackoverflow.com/a/20916888
type: AnswerComment
score: 0
has text: I don't know how that class can be missing. What OS are you using? Did you install Java separately from Eclipse? If so, how did you install it?
type: Comment

http://stackoverflow.com/comment/31542872
type: Comment
comment on: http://stackoverflow.com/a/20990853
score: 0
type: AnswerComment
has text: As I already mentioned it will not be practical to change 4k+ action classes.

http://stackoverflow.com/q/20932319
favorite count: 0
tagged with: cassandra
type: UnansweredQuestion
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I have a simple column family : CREATE TABLE activesubs( sub_id BIGINT, sub_data BLOB, user_id BIGINT, user_data BLOB, updated BIGINT, PRIMARY KEY (user_id, sub_id) ) WITH compaction = { 'class' : 'LeveledCompactionStrategy' }; when I query for all rows using cqlsh I get back the expected results set : SELECT user_id from activesubs; user_id --------- 2512 ..... 4396 (83 rows) cqlsh:game> however when I try this using the java API I get 0 results back, the code is very simple: Iterable<Row> results = session.execute("select user_id from activesubs") ; I have played around and if I change the schema so that only sub_id is the primary key then the query works through the java api... I am using the latest api version : com.datastax.cassandra cassandra-driver-core 2.0.0-rc2 Has anybody seen this before? Am I doing something wrong or is this a bug with the api?
tagged with: datastax-java-driver
has title: cassandra java driver returns emptylist with composite key
downvote count: 0

http://stackoverflow.com/a/20993729
type: Answer
answers question: http://stackoverflow.com/q/20991763
has body: You can use (though it doesn't seem to be the best way of what actually you are trying to achieve but still you can have a single image) setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { and the event.getX() and event.getY() will give you the coordinates where you are clicking for example if(event.getX() == 100 and event.getY() == 100) { // show your popup} But there will be a problem if you have multiple images you have to know at what positions these boxes will be present, and you might face problem if the image is to zoomed
score: 0

http://stackoverflow.com/comment/31564989
score: 0
comment on: http://stackoverflow.com/q/21003096
has text: @JarrodRoberson Well I did find out now that there **is** a difference so my question was not that bad.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/58534152
comment on: http://stackoverflow.com/q/20888182
type: QuestionComment
has text: Hey @Phataas were you able to figure this one out? I am trying to override `onActivityResult` from JNI as well.
score: 0
type: Comment

http://stackoverflow.com/q/21005444
score: 2
has comment: http://stackoverflow.com/comment/31613594
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31569310
accepted answer: http://stackoverflow.com/a/21005527
possible better answer: http://stackoverflow.com/a/21005488
tagged with: java
has answer: http://stackoverflow.com/a/21005488
has comment: http://stackoverflow.com/comment/31568975
type: Question
has comment: http://stackoverflow.com/comment/31569025
has comment: http://stackoverflow.com/comment/31569111
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31568993
has title: double comparison to zero special case?
favorite count: 0
has comment: http://stackoverflow.com/comment/31568881
has comment: http://stackoverflow.com/comment/31602632
has comment: http://stackoverflow.com/comment/31570130
has comment: http://stackoverflow.com/comment/31568982
upvote count: 2
has comment: http://stackoverflow.com/comment/31577322
tagged with: double
has answer: http://stackoverflow.com/a/21005527
has body: I'm initializing a double array: double [] foo = new double[n]; My understanding is that the java language specification causes all the values in the array to be initialized to zero. As I go through my algorithm, some of the entries in the array get set to a positive value. So to check whether a particular element has a non-zero value set, is it safe to just use if (foo[i] &gt; 0.0) or should I be using an epsilon there. Or similarly if I want to know if a value has not been set, could I use == given that the zeros will not have been computed values, but the original initialized zeros? Normally of course I would never use == to compare floating point numbers, but I wonder if this is a special case? Thanks!
has comment: http://stackoverflow.com/comment/31597146

http://stackoverflow.com/comment/31327177
comment on: http://stackoverflow.com/a/20872972
has text: thankyou very much it works perfectly but i get other problem .. the message not show complitly because p:dialog haven't scroll barr to scroll botom so how can i add scroll bar to p:dialog
type: AnswerComment
score: 0
type: Comment

url-rewriting
tags question: http://stackoverflow.com/q/20918076
type: Tag
tag name: url-rewriting
tags question: http://stackoverflow.com/q/20972048

http://stackoverflow.com/comment/31556059
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20998273
has text: Thanks for your response I delete all files in META-INF directory expect MANIFEST.INF then i resigned all jars files with our certificate. Unfortunately the error persist only in bouncy castle jar « bcprov-ext-jdk16-140.jar » here is the exception : java.security.NoSuchProviderException: JCE cannot authenticate the provider BC .... Caused by: bcprov-ext-jdk16-140.jar is not signed by a trusted signer.
score: 0

http://stackoverflow.com/a/21017823
type: Answer
score: 1
upvote count: 1
has body: The JRE Class White List provides a list of classes that can be used from the JRE. The above 2 classes that it is complaining about are not in that list and you cannot use them. You will either have to look for alternatives (other libraries), see if those classes can be dropped from the JAR (without ofcourse affecting your functionality) and so on.
downvote count: 0
answers question: http://stackoverflow.com/q/21007742

http://stackoverflow.com/a/27172406
type: Answer
has body: You can try this .js $scope.uploadFile=function(){ var formData=new FormData(); formData.append("file",file.files[0]); $http.post('/serverApp/rest/newDocument', formData, { transformRequest: function(data, headersGetterFunction) { return data; }, headers: { 'Content-Type': undefined } }).success(function(data, status) { alert("Success ... " + status); }).error(function(data, status) { alert("Error ... " + status); }); .java @Controller public class DocumentUploadController { @RequestMapping(value="/newDocument", method = RequestMethod.POST) public @ResponseBody void UploadFile(@RequestParam(value="file", required=true) MultipartFile file) { String fileName=file.getOriginalFilename(); System.out.println(fileName); } } That's based on https://github.com/murygin/rest-document-archive There is a good example of file upload https://murygin.wordpress.com/2014/10/13/rest-web-service-file-uploads-spring-boot/
upvote count: 5
score: 5
answers question: http://stackoverflow.com/q/21015891
downvote count: 0

http://stackoverflow.com/a/20893372
score: 1
downvote count: 0
type: AcceptedAnswer
type: Answer
upvote count: 1
has body: As various people pointed out, it turns out there were a load of unprintable characters after the 16. The trim() or replace() options both worked, but the problem lay in the method I copied from the android developer training page! When I replaced it with something based on BufferedReader reader = new BufferedReader(new InputStreamReader(stream, "UTF-8")); The problem went away. To be fair I'm not really interested in spending hours re-inventing the wheel doing input stream manipulation since I have an app to write. I just wanted to turn a stream into a String and used the first piece of code which worked, or seemed to.
accepted answer of: http://stackoverflow.com/q/20892969
answers question: http://stackoverflow.com/q/20892969

http://stackoverflow.com/comment/31575819
has text: I need to set an order, Now I have 1.- About, 2.- Refresh, 3.- Share and 4.- Exit, I need 1.- Share, 2.- refresh, 3.- About, and 4.- Exit
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21008999

http://stackoverflow.com/a/20907949
has comment: http://stackoverflow.com/comment/31385937
score: 8
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/31385397
upvote count: 8
has body: @Column(columnDefinition = "DECIMAL(7,2)") If you're asking how you should validate, you should use the @Min and @Max annotations or the @DecimalMin and @DecimalMax annotations. @Size is an annotation used to validate a property, not to define its column. @Size is typically used to assure that a string or a collection is of a certain size.
has comment: http://stackoverflow.com/comment/31385820
has comment: http://stackoverflow.com/comment/84048442
has comment: http://stackoverflow.com/comment/31386006
answers question: http://stackoverflow.com/q/20907923

http://stackoverflow.com/comment/31516509
has text: @user3161879 Well, I don't use JSONObject often so I definitely am not an expert. Maybe it is using recursion somewhere to analyse structure of document. Maybe it doesn't have enough memory to effectively parse this string after downloading it (you mentioned that downloading took 1GB of your memory). It is hard to guess without actually seeing your document. I think you should create separate question for this so other users may explain it better.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20957873

http://stackoverflow.com/comment/31400751
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20913800
type: Comment
has text: But when I checked your code. I found it was incorrect. I inserted 1,2,3,4,5,6 as a sequence. The output is not what expected. The right solution is: 2 is the left children of 1, 3 is the right of 1. And 4 is left of 2, and 5 is the right of 2. And 6 is left of 3.

http://stackoverflow.com/q/20886825
tagged with: jcombobox
has body: I have two comboboxes ... First one shows the cities of hotels and the second one shows tha hotels name based on the city selected in first combo box. First Combobox is working correctly. second one shows is only for the first selected city. it does not make changes to itself after changing the city in first combo box ! what do I have to add to this code in order to be able to see changes in second combobox by changing the first combobox. try { Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/JEREN","root",""); Statement stat = con.createStatement(); String City_Selected = jComboBox1.getSelectedItem().toString(); String select_HN = "select name from tbl_Hotel where city = '"+City_Selected+"';"; ResultSet rs = stat.executeQuery(select_HN); while (rs.next()) { String hotel_name = rs.getString("name"); // jLabel3.setText(hotel_name); jComboBox2.addItem(hotel_name); }//end while rs.close(); stat.close(); con.close(); } catch (Exception e) { e.printStackTrace(); }
tagged with: java
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31346013
has answer: http://stackoverflow.com/a/20886943
linked to: http://stackoverflow.com/q/3191837
score: -1
duplicate of: http://stackoverflow.com/q/3191837
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/31346549
has comment: http://stackoverflow.com/comment/31345384
tagged with: swing
has title: two comboboxes related to each other
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/31345341

http://stackoverflow.com/a/20982248
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/31527084
score: 1
answers question: http://stackoverflow.com/q/20982043
upvote count: 1
has body: The method remove(parameter) with an int as parameter for ArrayList also has a return of type E, being the Object of Object type specified when creating the list. So for starters when you are using theList[] I'm assuming it's an array of ArrayLists() and that you are sure theList is of type ArrayList and not an Array. 1- Save and recompile your code, the error line is nowhere in the code you specified. 2- Make sure theList[whereWeAre] is an int if you're using the above specified method. 3- Why not just use this method included in ArrayList() class: public boolean remove(Object o) which will remove the first occurence of the object and return true if successful. Learn more here: Docs

http://stackoverflow.com/comment/31362477
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20893619
has text: What I meant was a small snippet that allows use to reproduce the error that you're seeing. Just that one line isn't going to help; there could be a number of things wrong.

http://stackoverflow.com/comment/31382953
type: QuestionComment
comment on: http://stackoverflow.com/q/20899119
has text: It is almost certian that JDOM is doing things just right, and that the code you use to **output** from JDOM is not setting the CharSet of the OutputStream, and the XMLOutputter. As a consequence, JDOM will assume the worst, and escape all non-ASCII characters. Please show us the code you use to get the data out of the JDOM model.
score: 0
type: Comment

http://stackoverflow.com/q/20934412
has comment: http://stackoverflow.com/comment/31435986
has comment: http://stackoverflow.com/comment/31435916
favorite count: 0
possible better answer: http://stackoverflow.com/a/20934600
has body: I have an int[] array that contains values with the following properties: They are sorted They are unique (no duplicates) They are in a known range [0..MAX) MAX is typically quite a lot larger than the length of the array (say 10-100x) Sometimes the numbers are evenly distributed across the range, but at other times there are quite long sequences of consecutive numbers. I estimate it is about 50/50 between the two cases. Given this list, I want to efficiently find the index of a specific value in the array (or if the value is not present, find the next higher value). I've already implemented a straight binary search with interval bisection that works fairly well, but I have a suspicion that the nature/distribution of the data can be exploited to converge to a solution faster. I'm interested in optimising the average case search time, but it is important that the worst case is never worse than O(log n) as the arrays are sometimes very large. Question: it is possible to do much better than a plain binary search in the average case? EDIT (to clarify additional questions / comments) The constant in O(log n) definitely matters. In fact assuming that better algorithmic complexity than O(log n) isn't possible, the constant is probably the only thing that matters..... It's often a one-off search, so while preprocessing is possible it's probably not going to be worth it.
has comment: http://stackoverflow.com/comment/31435847
has answer: http://stackoverflow.com/a/20934600
score: 6
has comment: http://stackoverflow.com/comment/31435951
answer count: 4
has comment: http://stackoverflow.com/comment/31436024
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31436162
has comment: http://stackoverflow.com/comment/31435825
has comment: http://stackoverflow.com/comment/31435761
downvote count: 0
has comment: http://stackoverflow.com/comment/31436082
tagged with: java
has answer: http://stackoverflow.com/a/21013429
has answer: http://stackoverflow.com/a/20934535
has comment: http://stackoverflow.com/comment/31435910
type: Question
tagged with: indexing
has answer: http://stackoverflow.com/a/20934894
accepted answer: http://stackoverflow.com/a/20934894
tagged with: algorithm
upvote count: 6
has comment: http://stackoverflow.com/comment/31435792
has comment: http://stackoverflow.com/comment/31435990
has title: Efficient search of sorted numerical values
has comment: http://stackoverflow.com/comment/31436344

http://stackoverflow.com/comment/31451452
comment on: http://stackoverflow.com/a/20942292
type: AnswerComment
type: Comment
has text: So how would i get the contents of the line that it read without using the second readLine(); ?
score: 0

http://stackoverflow.com/comment/31436724
comment on: http://stackoverflow.com/a/20918570
score: 0
type: Comment
has text: You can download the current SWT jars from the Eclipse 4.3.1 [download page](http://download.eclipse.org/eclipse/downloads/drops4/R-4.3.1-201309111000/)
type: AnswerComment

http://stackoverflow.com/comment/31460559
comment on: http://stackoverflow.com/a/20946932
type: AnswerComment
score: 0
has text: That's fine.. `input==null` returns a boolean.
type: Comment

http://stackoverflow.com/comment/31590945
type: Comment
comment on: http://stackoverflow.com/q/21017171
score: 0
type: QuestionComment
has text: Fire the sql corresponding to single date and create the sheet with name same as date and if found any result then add all the data in that sheet.

http://stackoverflow.com/comment/31444212
has text: Thanks dasblinkenlight but fixing the typo did not change the error result
type: Comment
comment on: http://stackoverflow.com/q/20938541
score: 0
type: QuestionComment

http://stackoverflow.com/q/20983348
answer count: 1
tagged with: spring-mvc
score: 0
tagged with: java
has body: Current Spring application would like to integrate with existing POJOweb service(javax.jws.WebService) application. WSDL and everything are well packed in a jar file as a dependency. There are two questions: can this spring application calling the API from the jar file to send/receive web service message back and forth without Spring-WS involved? If not, then what is the minimal cost to make the integration?
has answer: http://stackoverflow.com/a/20983406
tagged with: jsp
type: UnansweredQuestion
type: Question
has title: Can a POJO web service application running in a spring application without Spring framework
tagged with: web-services
tagged with: spring

http://stackoverflow.com/q/21018441
type: Question
tagged with: android
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31592191
has comment: http://stackoverflow.com/comment/31592443
has answer: http://stackoverflow.com/a/21019548
answer count: 1
has body: I am using Twitter4j Library on my android application. Is there any way to tweet using a tweeter dialog that user can edit the tweet text? I don't want to tweet programmatically, Something like a facebook dialogs.
tagged with: twitter4j
tagged with: twitter
type: UnansweredQuestion
has title: Tweeting from android using a twitter dialog

http://stackoverflow.com/comment/31490568
type: AnswerComment
has text: @SrbNyk - You need to use the right id. I've already explained that. I cannot definitely tell you what the right id is ... but read the last sentence of the Answer.
type: Comment
comment on: http://stackoverflow.com/a/20951676
score: 0

http://stackoverflow.com/q/20881714
has comment: http://stackoverflow.com/comment/104040562
downvote count: 0
has answer: http://stackoverflow.com/a/20881877
favorite count: 0
has body: I want to know difference between List and LinkedList programmatically. Can any one help me? List list=new LinkedList();
has comment: http://stackoverflow.com/comment/31336077
answer count: 4
has title: Differentiate programmatically between LinkedList and List
has comment: http://stackoverflow.com/comment/31336013
type: AnsweredQuestion
tagged with: list
tagged with: linked-list
has answer: http://stackoverflow.com/a/20881897
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/20881734
upvote count: 1
has answer: http://stackoverflow.com/a/20881831
has answer: http://stackoverflow.com/a/20881734
type: Question
accepted answer: http://stackoverflow.com/a/20881831
has comment: http://stackoverflow.com/comment/31336046

http://stackoverflow.com/q/20878862
has body: Very quick question. I am working on the deletion method of a trinary tree. My approach is simple, I delete and join by replacing the node object with the node.left object. public void delete(int key, Node node) { if (node == null) { throw new RuntimeException(); } else if (key &lt; node.key) { delete(key, node.left) ; } else if (key &gt; node.key) { delete(key, node.right); } else { //found the node to delete, delete from here. if (node.mid != null) { node = node.mid; } else if (node.left == null) { node = node.right; } else if (node.right == null) { node = node.left; //node.key=node.left.key; } else { node= findMin(node.right); } } } This is part of the code. However, it doesn't work, that is, its key node.key is still the same. else if (node.right == null){ node = node.left; } But if I write node.key explicitly, then it works. else if (node.right == null){ node.key=node.left.key; } Why was that? I can never understand the object and reference thing, geez... Thanks guys.
answer count: 2
tagged with: variables
linked to: http://stackoverflow.com/q/40480
downvote count: 1
has title: A Little Confuse on Object and Variable Updating
favorite count: 0
has answer: http://stackoverflow.com/a/20878896
has answer: http://stackoverflow.com/a/20879001
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31331134
tagged with: object
score: 1
tagged with: java
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/31331024

http://stackoverflow.com/a/21016429
answers question: http://stackoverflow.com/q/21016279
has comment: http://stackoverflow.com/comment/31589952
has comment: http://stackoverflow.com/comment/31611391
has comment: http://stackoverflow.com/comment/31589468
score: 0
accepted answer of: http://stackoverflow.com/q/21016279
type: Answer
has body: public class MimeUtility *This is a utility class that provides various MIME related functionality.* There are a set of methods to encode and decode MIME headers as per RFC 2047. Note that, in general, these methods are not needed when using methods such as setSubject and setRecipients; JavaMail will automatically encode and decode data when using these "higher level" methods. Im not sure exactly what is going on, but it might be the side effect of some kind of "double encoding". Try removing the unnecessary calls to MimeUtility.encodeText()
has comment: http://stackoverflow.com/comment/31590277
has comment: http://stackoverflow.com/comment/31629697
type: AcceptedAnswer

http://stackoverflow.com/comment/31354872
score: 0
has text: It seems that the values array still does not update.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20891454

http://stackoverflow.com/q/20974701
has answer: http://stackoverflow.com/a/20975214
favorite count: 0
has answer: http://stackoverflow.com/a/20974966
has answer: http://stackoverflow.com/a/20976179
linked to: http://stackoverflow.com/q/40471
answer count: 5
has title: Why do unsynchronized objects perform better than synchronized ones?
has comment: http://stackoverflow.com/comment/31511703
accepted answer: http://stackoverflow.com/a/20976179
has answer: http://stackoverflow.com/a/20976167
score: 4
tagged with: multithreading
downvote count: 1
has comment: http://stackoverflow.com/comment/31511930
type: Question
type: AnsweredQuestion
upvote count: 5
tagged with: java
possible better answer: http://stackoverflow.com/a/20974966
has body: Question arises after reading this one. What is the difference between synchronized and unsynchronized objects? Why are unsynchronized objects perform better than synchronized ones?
has answer: http://stackoverflow.com/a/32964736
tagged with: synchronized

http://stackoverflow.com/q/20991653
tagged with: regex
tagged with: java
has title: Confusion in Java Regular Expression
linked to: http://stackoverflow.com/q/8575281
type: Question
upvote count: 4
duplicate of: http://stackoverflow.com/q/8575281
has comment: http://stackoverflow.com/comment/31542987
score: 4
has body: What does these following two regular expression means? .*? and .+? Actually I understood usage these Quantifiers i.e. '.' -&gt; Any character '*' -&gt; 0 or more times '+' -&gt; once or more times '?' -&gt; 0 or 1 Indeed, I am literally confused!!! about using .*? and .+?.Could anybody show up with proper examples for these cases. And you'r most welcome to share good links that presents useful examples practices. Thanks in advance.
has answer: http://stackoverflow.com/a/20991891
has answer: http://stackoverflow.com/a/20991698
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/31542997
favorite count: 0
has comment: http://stackoverflow.com/comment/31543075
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20992516

http://stackoverflow.com/a/20961721
downvote count: 2
upvote count: 13
type: Answer
score: 11
has body: Readability Is Mostly Formatting Not readable... if(a.equals("x") || a.equals("y") || a.equals("z") || Any number of terms...... ) //Do something Now easy to real... if(a.equals("x") || a.equals("y") || a.equals("z") || Any number of terms...... ) //Do something Readability is very subjective to the person reading the source code. If I came across code that implements collections, loops or one of the many other complicated answers here. I'd shake my head in disbelieve. Separate The Logic From The Problem You are mixing two different things. There is the problem of making the business logic easy to read, and the problem of implementing the business logic. if(validState(a)) // Do something How you implement validState doesn't matter. What's important is that code with the if statement is readable as business logic. It should not be a long chain of Boolean operations that hide the intent of what is happening. Here is an example of readable business logic. if(!isCreditCard(a)) { return false; } if(isExpired(a)) { return false; } return paymentAuthorized(a); At some level there has to be code that processes basic logic, strings, arrays, etc.. etc.. but it shouldn't be at this level. If you find you often have to check if a string is equal to a bunch of other strings. Put that code into a string utility class. Separate it from your work and keep your code readable. By ensuring it shows what you're really trying to do.
answers question: http://stackoverflow.com/q/20952325

http://stackoverflow.com/comment/31572745
comment on: http://stackoverflow.com/q/21007276
has text: Yes I know it can be multicast, but does not have to be the `+` operator - obviously support will not be language level.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/20901932
downvote count: 1
type: Question
tagged with: network-programming
has title: How to simulate different server responses, including offline?
score: 0
favorite count: 0
has body: An app I am working on relies on connecting to a private, remote server to login via an API. The other day, I got an ANR message and I think it was due to the server being offline (its a Windows Server that was being updated). In my app, I am using the following code: new ReadJSONFeedTask().execute(url).get(); Which turns an AsyncTask into a synchronous task (I believe!) And because the server was offline, I think the app got hung up, causing the ANR (it's my only lead at the moment, and all seems to make sense, despite the code above is inside a Service class, which shouldn't cause an ANR, should it?) So, I want to try an simulate the server being offline. I tried replacing the URL with one that simply doesn't work, by removing some letters from the hostname, but that only triggered an "UnknownHostException". Is there any way to achieve this kind of simulation? I know there are tools for browsers to simulate low bandwidth etc, but have no idea what could be done when my app is running on Android and is trying to connect to a remote server that I can't really reboot at will.
has comment: http://stackoverflow.com/comment/31375100
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/49376002
has comment: http://stackoverflow.com/comment/31373667
has comment: http://stackoverflow.com/comment/31375403
answer count: 0
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/31375726

http://stackoverflow.com/comment/31392425
type: AnswerComment
comment on: http://stackoverflow.com/a/20901544
type: Comment
has text: Compare the headers in the two cases to figure out what's different. Your spam filter is probably triggering based on some difference in the headers or the message content.
score: 1

http://stackoverflow.com/a/23268679
has body: Without adding any element to the answer, I would like to add an alternative way of detecting the same issue. I'm not a tcpdump expert, then I analysed the issue with debugging and logging. In our case, a message was split in a number of smaller packets (given the frag_size parameter of FRAG2). Some of them (not necessarily the last one) were randomly not transmitted: typically, packets 1 to 19 were transmitted correctly, 21 was transmitted but 20 was missing. This was followed by a large number of round-trips between the 2 instances: The client would be missing packet #20, it acknowledges again #19 and asks for 20; the server would send #20 which is requested explicitely and #21 which has not been acknowledged The client missing #20 would receive #21 (but not #20), re-acknowledge #19, re-ask #20 and so on for a time from 1 second to 50 seconds. At the end, the client which is missing #20 generally completes (even if #20 has never been received) without saying anything.
answers question: http://stackoverflow.com/q/20982448
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/20901837
tagged with: java
type: Question
tagged with: mongodb
has body: From my Java application, I have stored the values in mongoDB in ArrayList(set of Java objects). How can I retrieve the data from DBObject I am storing the data in mongoDB like this: { "students" : [{"firstName" : "Jesse", "lastName" : "Varnell", "age" : "15", "gender" : "M" }, { "firstName" : "John", "lastName" : "Doe", "age" : "13", "gender" : "F"}] } I am having the Java Object for the Student like: public class Student { public String firstName; public String lastName; public String age; public String gender; // M, F } I am retrieving the data from mongoDB like: BasicDBObject query = new BasicDBObject(); query.put("user", username); DBCursor cursor = theCollection.find(query); while (cursor.hasNext()) { DBObject theObj = cursor.next(); //How to get the DBObject value to ArrayList of Java Object? }
possible better answer: http://stackoverflow.com/a/20902664
has answer: http://stackoverflow.com/a/20902664
answer count: 2
tagged with: mongodb-java
downvote count: 0
tagged with: dbobject
has answer: http://stackoverflow.com/a/20902402
favorite count: 0
score: 8
upvote count: 8
has title: Converting DBObject to Java Object while retrieve values from MongoDB
accepted answer: http://stackoverflow.com/a/20902402
type: AnsweredQuestion

http://stackoverflow.com/comment/31380359
type: QuestionComment
comment on: http://stackoverflow.com/q/20905509
score: 0
type: Comment
has text: Can you include the code you use to read the CSV file?

http://stackoverflow.com/comment/31537841
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/20988000
type: Comment
has text: @gowtham: from starting itself i m getting error in pom.xml file , i also updated the user settings and reindexed the local repository but not successed

http://stackoverflow.com/comment/31569111
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/21005444
has text: (When a double array is initialized, the elements are set to *exactly* 0.0, and an `==` compare to that value will always be true.)

http://stackoverflow.com/comment/32499814
score: 0
type: Comment
has text: i tried the switch from BoneCP to HikariCP (just like @brettw said0 but i'm getting `[com.zaxxer.hikari.HikariDataSource]: No default constructor found; nested exception is java.lang.NoSuchMethodException: com.zaxxer.hikari.HikariDataSource.<init>()` any ideas?
comment on: http://stackoverflow.com/a/20919015
type: AnswerComment

http://stackoverflow.com/comment/31451300
comment on: http://stackoverflow.com/q/20942147
type: Comment
type: QuestionComment
has text: @MGorgon not only the exchange, but all behind four parameter given values, it work well.
score: 0

http://stackoverflow.com/q/20997235
has title: object oriented design - should my value objects contain only getters?
has answer: http://stackoverflow.com/a/20997478
type: Question
has answer: http://stackoverflow.com/a/20997491
has body: In the business logic of my project I mostly have "value objects" and "managers" value objects are everywhere. They can be User, Car, Photo, Album and so. managers exist to control their value objects. It can be UserManager, CarManager, PhotoManager, AlbumManager and so. They do create/remove/getList and other manipulations with the value objects. Now I faced with the question: Should my value objects contain setters? My first opinion is no, because I think its better that value object state will be controlled only by his manager. But there is a bad side - code duplication and apparent double work. Without setters my manager will have methods like userManager.addPhoto(userToAddTo, photoToBeAdded), that internally calls user.addPhoto(photo) (method addPhoto exists in the implementation, but not in the interface). Its okay if there are only couple of such methods, but when its getting a lot such "setter" methods, the manager seems to be a lit bit ugly and it is apparent double work. So, should I use setters in my value objects or not?
upvote count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/20997505
type: UnansweredQuestion
answer count: 4
has answer: http://stackoverflow.com/a/20997379
score: 2
tagged with: oop
has comment: http://stackoverflow.com/comment/31552976
tagged with: java

http://stackoverflow.com/a/21003852
has comment: http://stackoverflow.com/comment/31565679
has comment: http://stackoverflow.com/comment/31566240
downvote count: 0
has comment: http://stackoverflow.com/comment/31566399
has comment: http://stackoverflow.com/comment/31566450
has comment: http://stackoverflow.com/comment/31565577
accepted answer of: http://stackoverflow.com/q/21003803
type: AcceptedAnswer
has body: if (e.getKeyCode() == KeyEvent.VK_LEFT) { movePadLeft(); } You are recieving event as e. That variable came from method argument public void keyBoard(KeyEvent e){ &lt;------ change it to event, that is more readable than simple e public void keyBoard(KeyEvent event){ if (event.getKeyCode() == KeyEvent.VK_LEFT) { movePadLeft(); }
answers question: http://stackoverflow.com/q/21003803
has comment: http://stackoverflow.com/comment/31574320
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/31565875
score: 2

decimal
tags question: http://stackoverflow.com/q/21017942
tag name: decimal
tags question: http://stackoverflow.com/q/21016712
tags question: http://stackoverflow.com/q/20863817
tags question: http://stackoverflow.com/q/20964127
tags question: http://stackoverflow.com/q/20970256
type: Tag

http://stackoverflow.com/comment/31495362
comment on: http://stackoverflow.com/a/20965766
score: 1
type: AnswerComment
has text: No.. It makes sense... In your function you can have 5 different try-catch blocks at different places to handle different exceptions (one for FileNotFound, another for ArrayIndexOutOfBounds another for some other file related problem..) Now, we can handle FileNotFound and someother file related exception by rethrowing a generalized FileBasedException.. and arrayIndexOutOfBounds by rethrowing some other common exception... This way, we can just declare that the function throws the exception category and force the caller to do all the thinking...
type: Comment

http://stackoverflow.com/q/20966133
tagged with: gwt
has answer: http://stackoverflow.com/a/20975263
tagged with: java
tagged with: gxt
type: Question
has body: I have added a ComboBoxCell on a Grid. Problem is when user select an element from ComboBoxCell then after selection the ComboBoxCell is not blurred and text box present in ComboBoxCell still shows cursor. So because of this an Image (which is a button for me) present on same row of GXT grid doesnt fire browse event because ComboBoxCell has the focus right now. Only when ComboBoxCell is blurred then browseEvent is fired on click of image. Any solution how can i blur the ComboBoxCell or how can I remove editing in ComboBoxCell Textbox? test.setTriggerAction(TriggerAction.ALL); test.setWidth(100); test.setSelectOnFocus(true);//doesnot work test.setForceSelection(true);//doesnot work Issue exist in sencha example as well http://www.sencha.com/examples/#ExamplePlace:cellgrid On selection element from ComboBoxCell and Click on button then even doesn't fire.
score: 0
answer count: 1
type: UnansweredQuestion
has title: How to prevent editing of GXT ComboBoxCell

http://stackoverflow.com/a/20991768
has body: System.out.println("== comparison "+ s1==s2); This should be changed to System.out.println("== comparison "+ (s1==s2)); in order to prepare the comparison result in advance of text output. Also get used to comparing Strings with .equals() method, because you probably want to compare the values, not check for reference equality. See How do I compare strings in Java?
type: Answer
score: 0
answers question: http://stackoverflow.com/q/20991495

http://stackoverflow.com/comment/31734195
has text: Time is: Sun Jan 12 23:00:00 EST 2014
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20982143
type: AnswerComment

http://stackoverflow.com/a/20977759
downvote count: 0
has comment: http://stackoverflow.com/comment/31552879
has comment: http://stackoverflow.com/comment/31517754
upvote count: 2
type: Answer
has body: The CONFIG module should be producing a JAR with the filtered resources in its root. The other modules should be able to access those resources via their classpaths, which should contain the CONFIG jar, using ClassLoader.getResource(String) or ClassLoader.getResourceAsStream(String). EDIT: after comment below. You don't need to re-declare the Resources plugin, you simple specify the resources in the build section of the pom like this: true src/main/resources **/context*.xml
score: 2
accepted answer of: http://stackoverflow.com/q/20977654
answers question: http://stackoverflow.com/q/20977654
type: AcceptedAnswer

http://stackoverflow.com/q/20923809
type: Question
has comment: http://stackoverflow.com/comment/31415932
tagged with: java
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31415446
score: -7
has body: f.getContentPane().add(new hellojava2(" hello, java")); i have this code in my program but it doesn' t have any effect. that means "hello,java" should appear in f frame but it does not. hellojava2 is the program itself. i do not get error message too.
favorite count: 0
has comment: http://stackoverflow.com/comment/31415478
has answer: http://stackoverflow.com/a/20924017
has title: f.getContentPane().add(new hellojava2(" hello, java"));
type: UnansweredQuestion
tagged with: swing
downvote count: 7

http://stackoverflow.com/comment/31366607
comment on: http://stackoverflow.com/a/20895858
type: AnswerComment
score: 0
type: Comment
has text: It is upto you based on the business logic you have. POST is usually for data modification and GET is usually for data retrieval

http://stackoverflow.com/a/20982512
downvote count: 0
upvote count: 8
type: Answer
answers question: http://stackoverflow.com/q/20981963
score: 8
has body: As mentioned by gtgaxiola: From the Calendar Documentation Under the Field Manipulation section: set(f, value) changes calendar field f to value. In addition, it sets an internal member variable to indicate that calendar field f has been changed. Although calendar field f is changed immediately, the calendar's time value in milliseconds is not recomputed until the next call to get(), getTime(), getTimeInMillis(), add(), or roll() is made. The problem is that your getTime() call recomputes the date but setTimeZone(..) doesn't set the internal member variable isTimeSet to false. So the last line in your first output is wrong for you because you expect the timezone to be considered which is not.

http://stackoverflow.com/comment/31339220
comment on: http://stackoverflow.com/a/20876570
type: Comment
has text: So what's your status now? Do you still get the error or this works just fine?
type: AnswerComment
score: 0

http://stackoverflow.com/q/20983866
tagged with: javascript
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/20984294
has body: I have a jsp page with two 's, which get displayed based on the selection is made using a drop down particular selected value. one of the div is by default displayed when a page is opened or refreshed. I needed to display some results onto second div which is not by default. Can anyone please suggest. Below is my code so far Form having a drop down Type of Report Top Choice Information Choice First div By select: //my logic Second DIV---- Enter value to get the information below: choice1 choice2 //display result logic once the dropdown chooses Info it changes the div and display, now when I select things from drop down and hit submit button, I need to display my output in that div itself. But currently, when I hit submit it redirects me to earlier default div instead and if I then select INFO option it then display that page. Below is my servlet code: if ("secondDivision".equals(pick)) { InformationDAOImpl ad = new InformationDAOImpl(); PResponse pr = null; String selection = req.getParameter("info"); String inputText = req.getParameter("dynamicText"); if (selection.equals("val1")) { String sql = "Select name, char from table2 where text='" + inputText + "'"; pr = ad.getProdData(sql); } else if (selection.equals("val2")) { String sql = "Select name, char from table2 where value2='" + inputText + "'"; pr = ad.getResult(sql); } requset.setAttribute("data", pr); Util.forward(req, resp, this, "/log/testPage.jsp "); Can anyone please guide, or suggest how can I change this line and have myself redirect to the same div. I assume I need to make change here Util.forward(req, resp, this, "/log/testPage.jsp"); Any help would be great. Thanks
type: UnansweredQuestion
type: Question
tagged with: java
tagged with: servlets
score: 0
has title: Forward request to same once submit is pressed using Servlet
answer count: 1
tagged with: jsp

http://stackoverflow.com/a/20990906
has comment: http://stackoverflow.com/comment/31543373
accepted answer of: http://stackoverflow.com/q/20990877
has comment: http://stackoverflow.com/comment/31543095
has comment: http://stackoverflow.com/comment/31542024
has body: when i am going to call this method from some where else that is not asking me to handle the exception. Yes, because both are RuntimeExceptions and must not be caught. Read the java tutorial about exceptions and unchecked exceptions. Sometimes you see methods that declare RuntimeExceptions, like your method does. It is a way to document the exceptions that might be thrown even if you don't catch them. In addition to user3168013's comment how can we able to convert unchecked exception to checked exception . Every exception can have a cause. A cause is another exception that lead to it. If it has no cause it is a root exception. So you can just create an instance of a checked exception, pass it the unchecked exception as it's cause and throw the checked expection. For example define your checked exception public class DataFormatException extends Exception { public DataFormatException(Throwable cause) { super(cause); } } and then throw your own void set(String data[]) throws DataFormatException { try { a = Integer.parseInt(data[0]);// convert the string into int. // eg1.("12" // ---&gt; 12) eg2.("df23" ---&gt; fail) b = Integer.parseInt(data[1]); c = 0; } catch (NumberFormatException e) { throw new DataFormatException(e); } catch (ArrayIndexOutOfBoundsException e) { throw new DataFormatException(e); } } Of course it would be better to give a detailed exception message depending on the cause, but this is just a short example.
has comment: http://stackoverflow.com/comment/31544340
type: Answer
has comment: http://stackoverflow.com/comment/31544227
downvote count: 0
has comment: http://stackoverflow.com/comment/31541885
has comment: http://stackoverflow.com/comment/31546695
score: 3
has comment: http://stackoverflow.com/comment/31544029
has comment: http://stackoverflow.com/comment/31542253
has comment: http://stackoverflow.com/comment/31545180
has comment: http://stackoverflow.com/comment/31544336
upvote count: 3
has comment: http://stackoverflow.com/comment/31548674
has comment: http://stackoverflow.com/comment/31544393
answers question: http://stackoverflow.com/q/20990877
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31547011

http://stackoverflow.com/comment/31395143
type: Comment
has text: @Andreas "What is a content repository? A content repository is an information management system that provides various services for storing, accessing, and managing content. In addition to a **hierarchically structured** storage"
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20909877

http://stackoverflow.com/a/20908146
type: Answer
has body: ok so the resolution is: you can use just archive attribute with relative path, but you need to set privacy settings of tomcat or you can use archive and codebase attribute, where codebase attribute is path of the dir where archive resides. Very "nice" that it spits this cumbersome error message...
score: 0
answers question: http://stackoverflow.com/q/20904473

http://stackoverflow.com/comment/31279904
type: QuestionComment
has text: Calculate the "average=sum/records.size();" outside the for loop
comment on: http://stackoverflow.com/q/20851921
score: 0
type: Comment

http://stackoverflow.com/comment/31465838
type: Comment
score: 1
has text: Do you mean byte[] not Byte[]?
comment on: http://stackoverflow.com/q/20950424
type: QuestionComment

http://stackoverflow.com/q/20956769
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/20956822
type: UnansweredQuestion
tagged with: io
has title: JAVA storing data into outputBuffer array and when it is full write it into file
tagged with: java
type: Question
has body: before starting I would like to say that I've just a couple hours experience with java.Therefore if its a bit easy question sorry about it. Now, I have a byte array and I stores bytes into it.When it reaches maximum capacity, I want to write it into binary file and continue to my loop. To do that I've implemented the following piece of code. // I have an byte array my_array which has already been full OutputStream output=null; output = new BufferedOutputStream(new FileOutputStream(outputFName)); //I'm not sure this byte [] outputBuffer=new byte[PageSize]; int index=0; // shows the last used index in outputBuffer for(int i=0;i&lt;13;i++){ // if my_array[i] holds condition{ // if index&gt;=PageSize{ // write the content of outputBuffer into outputFname index=0; } // else{ outputBuffer[index+1]=my_array[i]; } } } Now I dont know how to write it into file. Is there anyone to help me ? Thanks in advance.
tagged with: arrays

http://stackoverflow.com/comment/31545363
type: QuestionComment
has text: Solution did work or any further complications?
comment on: http://stackoverflow.com/q/20947540
score: 0
type: Comment

http://stackoverflow.com/comment/31528821
has text: Can you explain what you are trying to do?
comment on: http://stackoverflow.com/q/20983111
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20854214
has comment: http://stackoverflow.com/comment/31289758
favorite count: 0
has comment: http://stackoverflow.com/comment/31285784
has title: java.lang.NoClassDefFoundError: Could not initialize class org.apache.axis.utils.XMLUtils
has comment: http://stackoverflow.com/comment/31283583
has answer: http://stackoverflow.com/a/20854234
linked to: http://stackoverflow.com/q/1457863
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20854286
has answer: http://stackoverflow.com/a/20854331
tagged with: java
accepted answer: http://stackoverflow.com/a/20858064
has body: java.lang.NoClassDefFoundError: Could not initialize class org.apache.axis.utils.XMLUtils I am getting this error. How to avoid this exception. Please suggest me a solution.
type: Question
score: 5
has answer: http://stackoverflow.com/a/20858064
tagged with: tomcat
downvote count: 2
upvote count: 7
possible better answer: http://stackoverflow.com/a/20854234
has comment: http://stackoverflow.com/comment/31283607

http://stackoverflow.com/q/20985517
type: Question
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/21069981
tagged with: minecraft
downvote count: 1
has answer: http://stackoverflow.com/a/21448189
favorite count: 0
accepted answer: http://stackoverflow.com/a/21448189
possible better answer: http://stackoverflow.com/a/21069981
has body: This is my code for a new Inventory in Bukkit. package com; import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftInventoryCustom; import org.bukkit.inventory.*; public class Server_Doc extends CraftInventoryCustom implements CraftingInventory, Inventory { InventoryHolder IH; public Server_Doc(InventoryHolder owner, int size) { super(owner, size); ItemStack items = new ItemStack(278); ((Inventory) owner).addItem(items); // TODO Auto-generated constructor stub } @Override public ItemStack[] getMatrix() { // TODO Auto-generated method stub return null; } @Override public Recipe getRecipe() { // TODO Auto-generated method stub return null; } @Override public ItemStack getResult() { // TODO Auto-generated method stub return null; } @Override public void setMatrix(ItemStack[] contents) { // TODO Auto-generated method stub } @Override public void setResult(ItemStack newResult) { // TODO Auto-generated method stub } //Inventory inv = Server_Doc(IH,8); } How could I open the inventory, once created?
type: AnsweredQuestion
has title: Create a custom inventory in bukkit
score: 1
tagged with: java
tagged with: bukkit

http://stackoverflow.com/q/20916686
has answer: http://stackoverflow.com/a/20916765
tagged with: java
type: Question
has body: I want to compute depth of a tree I have written code below My question is that : what is the order of this code? Is it O(n) [n is number of tree Nodes] Is there any other way which you think is better and faster? Thanks in advance public int height(Node n) { if(n == null) return 0; return 1 + Math.max(height(n.left), height(n.right)); }
tagged with: depth
has answer: http://stackoverflow.com/a/20916809
has answer: http://stackoverflow.com/a/20916726
type: UnansweredQuestion
score: 0
has answer: http://stackoverflow.com/a/20916742
has title: better way to find depth of a node in tree
answer count: 4
tagged with: tree

http://stackoverflow.com/a/20885346
upvote count: 2
accepted answer of: http://stackoverflow.com/q/20884779
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20884779
type: Answer
has body: It looks like you believe you can't change the layout because you're dealing with the content pane of a JFrame and you don't want to change the rest of the window. If that's the case, you can use nested layouts by adding the two JLabels to a separate JPanel (let's call it labelPanel) and adding that to the content pane. It would look something like this: JPanel labelPanel = new JPanel(); labelPanel.setLayout(new BoxLayout(labelPanel, BoxLayout.X_AXIS)); labelPanel.add(leftLabel); labelPanel.add(Box.createGlue()); //creates space between the JLabels labelPanel.add(rightLabel); contentPane.add(labelPanel);
score: 2
downvote count: 0

http://stackoverflow.com/comment/102691350
type: Comment
score: 1
comment on: http://stackoverflow.com/a/20932225
has text: i run these code and get `su error=13, permission denied`, does it need root privilege?
type: AnswerComment

http://stackoverflow.com/a/20967125
has body: Basically I would say this is pretty hard or impossible to do with Java only. The reason is Java is a cross platform language and all this is handled by the underlying operating system. Please keep in mind, that it's hard to find a robust, cross platform solution for this problem. You're asking how to detect, if a monitor is connected or disconnected: Under Windows you can hook on WM_DEVICECHANGE via Java Native Access. Maybe an idea is to check from time to time getScreenDevices() and detect changes, but this is more a workaround than a real solution. You're also asking how you can change the primary display. There is an example how you can use the WinAPI for this task. For other operating system you need to find other ways. I hope this answer gives an idea, that this could be quite hard to solve, especially with Java.
score: 1
answers question: http://stackoverflow.com/q/20966385
downvote count: 0
upvote count: 1
type: Answer

http://stackoverflow.com/q/20950105
has answer: http://stackoverflow.com/a/20950119
has title: java put null in int variable
has answer: http://stackoverflow.com/a/20950267
tagged with: int
score: 0
has answer: http://stackoverflow.com/a/20951141
tagged with: string
has answer: http://stackoverflow.com/a/20950441
has answer: http://stackoverflow.com/a/20950148
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20950200
has answer: http://stackoverflow.com/a/20950123
has answer: http://stackoverflow.com/a/20950201
has body: I have a code public int getValue() { int i = null; if(condition) { i = 10; } return i; } This works fine for String variables. How to do the same with int variables ?
tagged with: java
type: Question
answer count: 8
tagged with: if-statement

jsoup
tags question: http://stackoverflow.com/q/20926761
tags question: http://stackoverflow.com/q/20871734
tags question: http://stackoverflow.com/q/20978998
tags question: http://stackoverflow.com/q/20992998
tags question: http://stackoverflow.com/q/20991500
tags question: http://stackoverflow.com/q/20933275
tags question: http://stackoverflow.com/q/20975965
tags question: http://stackoverflow.com/q/21016144
tags question: http://stackoverflow.com/q/20940132
type: Tag
tag name: jsoup
tags question: http://stackoverflow.com/q/20973268
tags question: http://stackoverflow.com/q/20980098
tags question: http://stackoverflow.com/q/20976907
tags question: http://stackoverflow.com/q/20893950
tags question: http://stackoverflow.com/q/20951586
tags question: http://stackoverflow.com/q/20910264
tags question: http://stackoverflow.com/q/20951951
tags question: http://stackoverflow.com/q/20953293
tags question: http://stackoverflow.com/q/20908946
tags question: http://stackoverflow.com/q/20906620
tags question: http://stackoverflow.com/q/21000633
tags question: http://stackoverflow.com/q/20946618
tags question: http://stackoverflow.com/q/20909244
tags question: http://stackoverflow.com/q/20978031
tags question: http://stackoverflow.com/q/20862067

http://stackoverflow.com/q/21001561
has body: I want to write a SpringBatch Tasklet, that automatically activates or de-activates all indexes for a given database table. The code needs to work independantly of the DBMS (SQL Server, Oracle and HSQLDB are required). This is what I have tried so far: DatabaseMetaData dbMetaData = connection.getMetaData(); ResultSet rs = dbMetaData.getIndexInfo(null, null, tableName, true, false); while (rs.next()) { // work with ResultSet } However, I do not get the names of the Indexes or any useful information. So could anyone give some hints on how to set all indexes of table to active or inactive with just a JDBC connection object?
linked to: http://stackoverflow.com/q/6146024
upvote count: 7
has answer: http://stackoverflow.com/a/62772326
favorite count: 0
has comment: http://stackoverflow.com/comment/31561543
has title: Retrieve all Indexes for a given Table with JDBC
possible better answer: http://stackoverflow.com/a/38670382
tagged with: jdbc
accepted answer: http://stackoverflow.com/a/21014023
has answer: http://stackoverflow.com/a/55261323
has answer: http://stackoverflow.com/a/38670382
answer count: 4
type: AnsweredQuestion
downvote count: 0
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/21014023
has comment: http://stackoverflow.com/comment/31584496
type: Question
tagged with: indexing

http://stackoverflow.com/q/21015231
has comment: http://stackoverflow.com/comment/31586636
has answer: http://stackoverflow.com/a/21015545
type: UnansweredQuestion
tagged with: android
has body: i work on database application store data like image on oncreate method of application now problem is every time i launch app there add multiple duplicate values in my database table so help me about this problem my db class package handler; import java.sql.Blob; import java.util.ArrayList; import property.property; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase.CursorFactory; import android.database.sqlite.SQLiteOpenHelper; public class handler extends SQLiteOpenHelper { static String Database_Name="image5.db"; String Table_Name="img_demo"; String Image="image"; String ID="id"; String Image_Name="image_name"; String Web="website"; String Image_No="image_no"; public handler(Context context) { super(context,Database_Name, null, 1); // TODO Auto-generated constructor stub } @Override public void onCreate(SQLiteDatabase db) { db.execSQL("create table img_demo(id integer primary key autoincrement,image_name text,website text,image_no integer,image blob)"); } public void insertdata(ArrayList&lt;String&gt; str1,ArrayList&lt;String&gt; str2,ArrayList&lt;Integer&gt; no,ArrayList&lt;byte[]&gt; im) { SQLiteDatabase sd=getWritableDatabase(); for(int i=0;i&lt;str2.size();i++) { ContentValues cv=new ContentValues(); String nm=str1.get(i); String web=str2.get(i); int no1=no.get(i); byte[] img=im.get(i); cv.put(Image_Name, nm); cv.put(Image_No, no1); cv.put(Web, web); cv.put(Image, img); sd.insert(Table_Name, null, cv); } sd.close(); } public ArrayList&lt;property&gt; show() { SQLiteDatabase sd=getReadableDatabase(); Cursor c=sd.query(Table_Name, null, null, null, null, null, null); ArrayList&lt;property&gt; ap=new ArrayList&lt;property&gt;(); property p; while(c.moveToNext()) { p=new property(); int id= c.getInt(0); String nm= c.getString(1); byte[] b=c.getBlob(4); p.setId(id); p.setName(nm); p.setImage(b); ap.add(p); } return ap; } @…
has comment: http://stackoverflow.com/comment/31587130
tagged with: java
has title: duplicate value store in database like adding new row on on click
type: Question
tagged with: database
score: 0
tagged with: sqlite
answer count: 1
has comment: http://stackoverflow.com/comment/31586753

http://stackoverflow.com/a/20956861
has comment: http://stackoverflow.com/comment/31481157
has body: You are calling a non-parameterized/default constructor from a parameterized constructor. The JVM in this case unable to create the default constructor. Hence in this case you need to include non-parameterized constructor explicitly into your class. public class Rectangle { public Rectangle(int x, int y, int width, int length) { x = 5; y = 10; width = 20; length = 30; Rectangle box = new Rectangle(5, 10, 20, 30); System.out.println(new Rectangle()); } public Rectangle(){} } This will be error free.
score: 0
answers question: http://stackoverflow.com/q/20956561
type: Answer

http://stackoverflow.com/q/20942506
possible better answer: http://stackoverflow.com/a/20942558
has body: Background Information: I am developing a small application. The way it works right now is the moment the app is launched, the user is prompted with the main activity. Then from there, the user clicks on the login button which prompts the login activity. Now in my login activity, I have set an Intent that gets the user's username and then stores it in the Shared Preferences. If the login is successful then the user goes to the mainloggedinpage where the user sees: [Welcome back {username}] The problem is the following: If the user is accessing the mainloggedinpage via loginactivity then you can easily see his username which is exactly what I want. But the thing is that on the main page, I have other buttons which goes to other activities. The moment the user click on any of those activities and then returns to the mainloggedin page, then all you see is: [Welcome Back {}]. His username is not displayed anymore. My question: Can anyone suggest a quick fix that will allow me to display the username so even when the user goes to another activity from the mainloggedinpage and then comes back to the mainloggedinpage, the user will still see: [Welcome Back {username}]? My Code for Login Activity [This is where I am getting the username]: @Override protected String doInBackground(String... args) { // TODO Auto-generated method stub // Check for success tag int success; String username = user.getText().toString(); String password = pass.getText().toString(); try { // Building Parameters List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;(); params.add(new BasicNameValuePair("username", username)); params.add(new BasicNameValuePair("password", password)); Log.d("request!", "starting"); // getting product details by making HTTP request JSONObject json = jsonParser.makeHttpRequest( LOGIN_URL, "POST", params); // check your log for json response Log.d("Login attempt", json.toString()); // json success tag success = json.getInt(TAG_SUCCESS); if (success == 1) { …
has title: Accessing username from all classes: Android
tagged with: android
has answer: http://stackoverflow.com/a/20942558
tagged with: php
type: AnsweredQuestion
tagged with: java
tagged with: sharedpreferences
type: Question
tagged with: http://stackoverflow.com/tag/json
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/20942629
accepted answer: http://stackoverflow.com/a/20942629

http://stackoverflow.com/a/20872817
has body: According to the documentation, it works like this: Check to see if an image with that name has already been defined. If so, return that image. Check to see if there is a resource available with that name whose contents can be read as an Image. If so, read the image from the resource file. Load the image from a file with the specified name, relative to the application directory or the applet code base. If it's complaining about escape characters try using \\ instead of \ in the image path.
has comment: http://stackoverflow.com/comment/31319970
has comment: http://stackoverflow.com/comment/31320006
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20872773

http://stackoverflow.com/q/20865517
tagged with: java
has comment: http://stackoverflow.com/comment/31306047
type: Question
has answer: http://stackoverflow.com/a/20866392
answer count: 2
upvote count: 1
tagged with: arrays
possible better answer: http://stackoverflow.com/a/20866392
favorite count: 0
has title: Android - Accessing Array in multiple activities
accepted answer: http://stackoverflow.com/a/20865606
tagged with: android
tagged with: public
has body: Just a real quick question. I've defined an array in one activity and I'm trying to access it in another one. I was planing to extend it as so: public class MyChallenges extends Main { But I need to extend 'ListActivity' to get my code to work, as I am using a custom listview, so I can't extend two activities. As shown: public class MyChallenges extends ListActivity { Is there any other way, apart from extending the main activity? This is the array I'm trying to access for read and write: public String[][] arr = new String[2][6]; So, in short, how can I access the array 'arr' from another class? Thanks guys!
downvote count: 0
has answer: http://stackoverflow.com/a/20865606
has comment: http://stackoverflow.com/comment/31306073
type: AnsweredQuestion
score: 1

http://stackoverflow.com/q/20959456
tagged with: java
linked to: http://stackoverflow.com/q/15620590
has comment: http://stackoverflow.com/comment/31483749
has title: Bounding box doesn't follow sprite correctly. (Java)
tagged with: polygon
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/20959543
has body: In a Java 2D game, I have a rectangular sprite of a tank. The sprite can rotate in any angle, and travel in the direction of that angle. This sprite needs to have a bounding box, so I can detect collision to it. This bounding box needs to: Follow the sprite around the screen. Rotate when the sprite rotates. Obviously it should be invisible, but right now I'm drawing the box on the screen to see if it works. It doesn't. My problem is this: When the sprite travels parallel to the x axis or y axis, the box follows correctly and keeps 'wrapping' the sprite precisely. But when the sprites travles diagonaly, the box doesn't follow the sprite correctly. Sometimes it moves too much along the x axis and too little along the y axis. Sometimes the opposite. And maybe sometimes too much both or too little on both. Not sure. Could you look at my code and tell me if you see anything wrong? (Please note: The bounding box most of the time is actually just two arrays of coordinates, each one containing 4 values. The coordinates are used to form a Polygon when collision is checked, or when the box is drawn to the screen). Relevant code from the Entity class, the superclass of Tank: int[] xcoo = new int[4]; // coordinates of 4 vertices of the bounding box. int[] ycoo = new int[4]; double x,y; // current position of the sprite. double dx,dy; // how much to move the sprite, and the vertices of the bounding box. double angle; // current angle of movement and rotation of sprite and bounding-box. // Returns a Polygon object, that's the bounding box. public Polygon getPolyBounds(){ return new Polygon(xcoo,ycoo,xcoo.length) ; } public void move(){ // Move sprite x += dx; y += dy; // Move vertices of bounding box. for(int i=0;i&lt;4;i++){ xcoo[i] += dx; ycoo[i] += dy; } // Code to rotate the bounding box according to the angle, will be added later. // .... } Relevant code from the Board class, the class that runs most of the game. This is from the game-loop. // keysPressed1 is an array of fla…
favorite count: 0
upvote count: 2
tagged with: bounding-box
accepted answer: http://stackoverflow.com/a/20959543
tagged with: sprite
type: Question
score: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/31475634
score: 0
has text: @ErickFilho: Thanks for the immediate comment ;-) "myApp" is actually the package (and the project name). I admit that's misleading, I will fix it. However, using package myApp.test as targetPackage does not change anything. What is the meaning of targetPackage, by the way ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20955317

http://stackoverflow.com/a/20877340
answers question: http://stackoverflow.com/q/20877199
has body: Unless for some reason you're bound to using only primitives, Tim's answer solves the sorting problem. To implement multiple "solutions", just create two different functions which take the list of numbers and the value n as parameters: public void firstSolution(int[] numbers, int n) { // one implementation } public void secondSolution(int[] numbers, int n) { // another implementation } Then simply make the appropriate function calls in main.
score: 0
type: Answer

http://stackoverflow.com/q/20969977
score: 4
has answer: http://stackoverflow.com/a/20970518
upvote count: 4
has answer: http://stackoverflow.com/a/38013699
downvote count: 0
favorite count: 0
answer count: 5
type: UnansweredQuestion
has body: While Automating the search functionality, enter some search key word and click on Search button, the results need to load in grid. It takes few seconds time to load and displaying "Loading..." text like this in fallowing div. Loading... How could I wait until this message disappear.
tagged with: java
has answer: http://stackoverflow.com/a/20970169
tagged with: selenium
has answer: http://stackoverflow.com/a/30607197
has title: Waiting the driver until an element to disappear
type: Question
has answer: http://stackoverflow.com/a/64209923

http://stackoverflow.com/comment/31450488
comment on: http://stackoverflow.com/q/20941624
has text: @SotiriosDelimanolis sorry for my mistake. How does the space affect it though? I am new to this site.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31329125
type: AnswerComment
comment on: http://stackoverflow.com/a/20877795
type: Comment
has text: I would rewrite `(billion|million)` as `[mb]illion`. No need for the capture group.
score: 2

filter
tags question: http://stackoverflow.com/q/20958513
tags question: http://stackoverflow.com/q/20977654
tag name: filter
tags question: http://stackoverflow.com/q/20982077
tags question: http://stackoverflow.com/q/20913410
type: Tag
tags question: http://stackoverflow.com/q/20946815

http://stackoverflow.com/q/20942518
tagged with: arraylist
has answer: http://stackoverflow.com/a/20942534
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31451873
type: Question
score: -2
has body: I'm doing this assignment and it wants me to store grades (integers that a user enters) into arrays that are named levelOne, levelTwo, levelThree, levelFour. It's also asking me to make calculations, based on the input grades, such as average grade and median grade. Instead of finding the average of each array, I'm trying to store all the data into a "parent" array (where the other arrays should be stored) so I can do all that in one calculation. Is that possible, and if so, how can I do this? This is how my "children" arrays look: List&lt;Integer&gt; levelFour = new ArrayList(); List&lt;Integer&gt; levelThree = new ArrayList(); List&lt;Integer&gt; levelTwo = new ArrayList(); List&lt;Integer&gt; levelOne = new ArrayList(); List&lt;Integer&gt; levelR = new ArrayList();
tagged with: java
answer count: 2
downvote count: 2
has title: Arrays inside Arrays
has comment: http://stackoverflow.com/comment/31451998
has answer: http://stackoverflow.com/a/20942659
has comment: http://stackoverflow.com/comment/31451875
tagged with: arrays
type: UnansweredQuestion
tagged with: sorting

http://stackoverflow.com/comment/31545836
has text: he should use the constructor with two parameters of File instead. In turns that constructor makes use of File.Separator
type: Comment
score: 1
comment on: http://stackoverflow.com/a/20993108
type: AnswerComment

http://stackoverflow.com/q/21008492
type: Question
has comment: http://stackoverflow.com/comment/98546065
has answer: http://stackoverflow.com/a/55946688
has comment: http://stackoverflow.com/comment/31575173
has comment: http://stackoverflow.com/comment/31575262
has answer: http://stackoverflow.com/a/21008667
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/21008518
type: UnansweredQuestion
downvote count: 1
score: 2
has body: I have this simple ldap client which uses obsolete Hashtable collection. class SAuth { public static void main(String[] args) { Hashtable env = new Hashtable(11); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, "ldap://xx.xx.xx.xx:yyyy/"); // Authenticate as S. User and password "mysecret" env.put(Context.SECURITY_AUTHENTICATION, "simple"); env.put(Context.SECURITY_PRINCIPAL, "cn=orcladmin"); env.put(Context.SECURITY_CREDENTIALS, "password"); try { DirContext ctx = new InitialDirContext(env); System.out.println(" i guess the connection is sucessfull :)"); // Do something useful with ctx // Close the context when we're done ctx.close(); } catch (NamingException e) { e.printStackTrace(); } } } Is there any modern collection which I can use without breaking the code instead of Hashtable? Update: class tSAuth { public static void main(String[] args) { Map&lt;String, String&gt; env = new HashMap&lt;String, String&gt;(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, "ldap://xx.xx.xx.xx:yyyy/"); // Authenticate as S. User and password "mysecret" env.put(Context.SECURITY_AUTHENTICATION, "simple"); env.put(Context.SECURITY_PRINCIPAL, "cn=orcladmin"); env.put(Context.SECURITY_CREDENTIALS, "password"); try { DirContext ctx = new InitialDirContext((Hashtable&lt;?, ?&gt;) env); System.out.println(" i guess the connection is sucessfull :)"); // Do something useful with ctx // Close the context when we're done ctx.close(); } catch (NamingException e) { e.printStackTrace(); } } }
upvote count: 3
has title: Replace obsolete `Hashtable` collection
tagged with: java

http://stackoverflow.com/a/21004434
type: Answer
score: 0
has body: http://developer.android.com/reference/android/hardware/input/InputManager.html As per documentation this has a nested class Nested Classes interface -- InputManager.InputDeviceListener -- Listens for changes in input devices. Just a lead, not sure about the usage though
answers question: http://stackoverflow.com/q/20854980

http://stackoverflow.com/q/20999027
has comment: http://stackoverflow.com/comment/31557820
type: Question
has answer: http://stackoverflow.com/a/20999057
has comment: http://stackoverflow.com/comment/31557043
has body: I have servlet call to another servlet Using PrintWriter .Unable to redirect particular target URL.My code is PrintWriter pw= null; pw= response.getWriter(); pw.print("URL TO Redirect"); pw.close(); Websphere SystemErrorLog: java.lang.NullPointerException at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:485) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:301) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:275) at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214) at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113) at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:557) at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:607) at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:984) at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1069) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1563)
tagged with: servlets
has title: NullPointerException exception at Websphere?
score: 0
tagged with: websphere
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31557487
has comment: http://stackoverflow.com/comment/31557026
tagged with: java

http://stackoverflow.com/comment/31598771
type: QuestionComment
has text: Because that implies Scanners, building up a Syntax - Tree and compiling that Tree to the SQL - Statement that is executed against the database via the JDBC.
comment on: http://stackoverflow.com/q/21018395
score: 0
type: Comment

jvm
tags question: http://stackoverflow.com/q/20943476
type: Tag
tags question: http://stackoverflow.com/q/20963575
tags question: http://stackoverflow.com/q/20970165
tags question: http://stackoverflow.com/q/20884717
tags question: http://stackoverflow.com/q/20889272
tags question: http://stackoverflow.com/q/20978381
tags question: http://stackoverflow.com/q/20937907
tags question: http://stackoverflow.com/q/20867949
tags question: http://stackoverflow.com/q/20975043
tags question: http://stackoverflow.com/q/20971198
tag name: jvm
tags question: http://stackoverflow.com/q/20992009
tags question: http://stackoverflow.com/q/20915991
tags question: http://stackoverflow.com/q/20880231
tags question: http://stackoverflow.com/q/20860880
tags question: http://stackoverflow.com/q/20952157
tags question: http://stackoverflow.com/q/20968433
tags question: http://stackoverflow.com/q/20918188
tags question: http://stackoverflow.com/q/20929681
tags question: http://stackoverflow.com/q/20880716
tags question: http://stackoverflow.com/q/21005043
tags question: http://stackoverflow.com/q/21004928
tags question: http://stackoverflow.com/q/20914392

http://stackoverflow.com/comment/31378989
score: 1
has text: I've subsequently noticed that whilst this approach works when the sub-classed lists (such as `ExternalFacilities`) work when they are elements of another `XmlRootElement` object (such as `ExternalOrganisation` above), they don't work when passed back as the JAX-RS response entity. Is that expected?
type: AnswerComment
comment on: http://stackoverflow.com/a/20893043
type: Comment

http://stackoverflow.com/comment/31400788
score: 0
comment on: http://stackoverflow.com/q/20915634
type: QuestionComment
type: Comment
has text: How's `parsing` done in Option 1?

http://stackoverflow.com/q/20915445
tagged with: primefaces
has title: Update components with URL
score: 0
has answer: http://stackoverflow.com/a/20920874
answer count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20920874
tagged with: jsf
has body: I want to update other components but they are not being found. How must the path be set? I always get the followig Message: Cannot find component with identifier ":test" referenced from "tabViewCompAll:inboxTable". I'm using JSF 2.1 and Primefaces 3.5 Here is my code: &lt;ui:define name="contentLeft"&gt; &lt;p:tabView id="tabViewPosts"&gt; &lt;p:tab title="Inbox"&gt; &lt;p:dataTable id="inboxTable" var="task" value="#{taskboxBean.taskboxList}" paginator="true" rows="10" selection="#{taskboxBean.taskbox}" selectionMode="single" rowKey="{task.TB_ID}"&gt; &lt;p:ajax event="rowSelect" update=":test" /&gt; &lt;p:column headerText="Post"&gt; &lt;h:outputText value="#{task.FROM_USER.FIRST_NAME} #{task.FROM_USER.LAST_NAME} (#{task.FROM_USER.EMAIL})" /&gt; &lt;br /&gt; &lt;h:outputText value="#{task.TASKTYPE.NAME}" /&gt; &lt;br /&gt; &lt;h:outputText value="#{task.CREATE_TIMESTAMP}" /&gt; &lt;/p:column&gt; &lt;/p:dataTable&gt; &lt;/p:tab&gt; &lt;/p:tabView&gt; &lt;/ui:define&gt; &lt;ui:define name="contentRight"&gt; &lt;div id="test"&gt; &lt;p:commandButton value="New Message"/&gt; &lt;h:outputText value="#{taskboxBean.taskbox.FIRST_NAME} #{taskboxBean.taskbox.LAST_NAME} "/&gt; &lt;h:outputText value="(#{taskboxBean.taskbox.EMAIL})"/&gt; &lt;h:outputText value="#{taskboxBean.taskbox.TASKTYPE.NAME}"/&gt; &lt;h:outputText value="#{taskboxBean.taskbox.CREATE_TIMESTAMP}}"/&gt; &lt;/div&gt; &lt;/ui:define&gt;
tagged with: java
type: Question

http://stackoverflow.com/q/20990463
has body: I search through this forum but I can't find a good explanation on this topic. Is there any different from the below statements? Which way is the better way to trigger this event? if (evt.getButton() == 3) Vs. if (SwingUtilities.isRightMouseButton(evt))
answer count: 1
has answer: http://stackoverflow.com/a/20990589
has title: Right click mouse event
tagged with: mouselistener
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
tagged with: mouseevent
type: Question
accepted answer: http://stackoverflow.com/a/20990589
tagged with: awt
favorite count: 0
tagged with: swingutilities
upvote count: 3

http://stackoverflow.com/q/20860578
has title: Android - Listview - setOnItemClickListener doesnt work
score: -3
has comment: http://stackoverflow.com/comment/31296057
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20860827
tagged with: java
possible better answer: http://stackoverflow.com/a/20860758
downvote count: 3
tagged with: listview
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/20860827
upvote count: 0
tagged with: adapter
tagged with: android-listview
tagged with: android
has answer: http://stackoverflow.com/a/20860758
has body: I've implemented a Listview which contain a picture and a text. It works fine , I can select an item and the selected item's background color changes to the Selector's color.. but the OnItemClick listener doesnt fire! I set my list's setOnItemClickListener. Iv'e read about focusable, clickable etc.. didnt help me. I set all the listview items' focusable and clickable to false, then tried on the layout containing the items android:descendantFocusability="blocksDescendants" still nothing seems to help. What freaks me out that the selector indication works. Any help? Edit: The Listview is inside a popup if it matters.
favorite count: 0

http://stackoverflow.com/q/20875546
tagged with: sorting
tagged with: arraylist
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/20875562
has answer: http://stackoverflow.com/a/20875562
favorite count: 0
has answer: http://stackoverflow.com/a/20875663
has comment: http://stackoverflow.com/comment/31325373
upvote count: 1
has title: Insertion sorting an double array list, first item doesn't get sorted
type: AnsweredQuestion
has body: arraylist insertion sorting in the sorting class: public void insertionSort(ArrayList &lt;Double&gt;list){ double temp; int previousIndex; for(int index = 1; index &lt; list.size(); index++){ temp = list.get(index); previousIndex = index - 1; while((list.get(previousIndex) &gt; temp) &amp;&amp; (previousIndex &gt; 0)){ list.set((previousIndex+1), list.get(previousIndex)); previousIndex-=1; } if(list.get(previousIndex) &gt; temp){ list.set((previousIndex+1), list.get(previousIndex)); list.set((previousIndex+1), temp); }else{ list.set((previousIndex+1), temp); } } } main class: package sorts; import java.util.*; public class TestSorts { public static void displayArrayList(ArrayList &lt;Double&gt; list){ for (int i=0; i&lt;list.size();i++){ System.out.print(list.get(i)+" \n"); } System.out.println("\n"); } public static void main(String[] args) { Scanner in=new Scanner(System.in); int numItems,searchNum,location; Sorts sort=new Sorts(); Scanner in=new Scanner(System.in); int numItems,searchNum,location; Sorts sort=new Sorts(); System.out.print("Enter the number of elements: "); numItems=in.nextInt(); ArrayList &lt;Double&gt; list=new ArrayList&lt;&gt;(); for (int i=0;i&lt;numItems;i++){ list.add((int)100*Math.random()); } System.out.println("Unsorted: "); displayArrayList(list); sort.insertionSort(list); System.out.println("Sorted: "); displayArrayList(list); } } basically what's happening right now is that numbers will be generated fine, and sorted fine, except for when it's sorted, the very first item in the sorted list will be incorrect. such as: Unsorted: 58.754608713273925 77.15776272269233 61.752499151303795 1.9942069463339207 55.30460705281677 78.06371704304172 Sorted: 58.754608713273925 1.9942069463339207 55.30460705281677 61.752499151303795 77.15776272269233 78.06371704304172 so it seems everything sorts fine but the very first random number in the list never gets sorted, and ends up staying in the exact same position as before.
tagged with: java
downvote count: 1
accepted answer: http://stackoverflow.com/a/20875663
type: Question

http://stackoverflow.com/q/20923556
has answer: http://stackoverflow.com/a/20924830
has comment: http://stackoverflow.com/comment/31414979
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/20923616
downvote count: 0
favorite count: 0
has title: Math.pow(2,63) - 1 == Math.pow(2,63) - 512 is TRUE
has body: I thought this was kind of interesting: System.out.println( (long)(Math.pow(2,63) - 1) == Long.MAX_VALUE); // true System.out.println( (long)(Math.pow(2,63) - 5) == Long.MAX_VALUE); // true System.out.println( (long)(Math.pow(2,63) - 512) == Long.MAX_VALUE); // true System.out.println( (long)(Math.pow(2,63) - 513) == Long.MAX_VALUE); // false The last three lines should print false, but in fact only the last one, where I subtracted 513 gave the correct answer. Why is 512/513 the breaking point for the inaccuracy? The only connection I could make to that is that 512 is half of a kilobyte. I know that the cause of this is the double inaccuracy which stems from Math.pow(int, int) returning a double I tried this with java.math.BigInteger and this is what I got: BigInteger b = new BigInteger("2"); System.out.println( (b.pow(63).longValue() - 1) == Long.MAX_VALUE ); // true System.out.println( (b.pow(63).longValue() - 5) == Long.MAX_VALUE ); // false System.out.println( (b.pow(63).longValue() - 512) == Long.MAX_VALUE ); // false System.out.println( (b.pow(63).longValue() - 513) == Long.MAX_VALUE ); // false
tagged with: double
possible better answer: http://stackoverflow.com/a/20924830
type: AnsweredQuestion
score: 3
upvote count: 3
accepted answer: http://stackoverflow.com/a/20923616
tagged with: java

http://stackoverflow.com/q/20864268
has comment: http://stackoverflow.com/comment/31312173
tagged with: design-patterns
has title: How to implement a simple scenario the OO way
has comment: http://stackoverflow.com/comment/31312111
tagged with: oop
type: UnansweredQuestion
tagged with: java
type: Question
has body: After starting to read a book on OO programming, I am attempting to make my android app more OO. However I am stumped on a simple scenario. I have a Book object, which can have many say Chapter objects. I also have a search function which searches across multiple books, 97 of them. I end up with many Chapter objects from the Sqlite table. I felt that it would be useful to the user to be able to see the title of the book on each result, otherwise it might be confusing if there are say two "chapter 5" results. For that to happen, I need the book title. Should I make it part of my chapter object, like : chapter.getBookTitle() Which kind of does not seem right, as I have glued the book name onto a chapter... The alternative is to instantiate a book object for each chapter and somehow reference it, which has its own problems including in android with regards to not being able to pass a reference to an in-memory object to another activity. Also a book may have many other chapters which were not results in the search, and it may seem like they would return if I was to just instantiate the book. What is the correct OO solution to this seemingly simple issue? Is it just a matter of learning when not to be dogmatic about the whole OO thing? More Info: I am using FTS4 in Sqlite, which accounts for over half of my actual DB size of 80mb. What I am storing is text from 97 books, with chapters in 4 languages. So my FTS at the moment stores: ChapterId, ChapterNo (withinBook), Lang1, Lang2, Lang3, Lang4, Tags, Notes The searching is very fast, I retrieve only 50 results. I match any column with a string term, and not one column in particular. So if I type "apple" it will search all the fields above. Currently as part of my FTS query I am join a join onto Book, fetching the BookId, I later use that to get me the title of the book. However its all in a procedural like style, with no regard to where the information "belongs". I need the title so I can display it in the results, just f…
has comment: http://stackoverflow.com/comment/31303851
score: 0
has answer: http://stackoverflow.com/a/20864361
answer count: 3
has answer: http://stackoverflow.com/a/20864346
has comment: http://stackoverflow.com/comment/31303828
has answer: http://stackoverflow.com/a/20864378
tagged with: android

serialization
tags question: http://stackoverflow.com/q/20978526
tags question: http://stackoverflow.com/q/20955527
tags question: http://stackoverflow.com/q/20957393
tags question: http://stackoverflow.com/q/20867740
tags question: http://stackoverflow.com/q/20939129
tags question: http://stackoverflow.com/q/20915372
tag name: serialization
tags question: http://stackoverflow.com/q/21015649
tags question: http://stackoverflow.com/q/20941689
tags question: http://stackoverflow.com/q/20961956
tags question: http://stackoverflow.com/q/20949311
tags question: http://stackoverflow.com/q/20956610
tags question: http://stackoverflow.com/q/20943250
tags question: http://stackoverflow.com/q/20942291
tags question: http://stackoverflow.com/q/20950486
type: Tag
tags question: http://stackoverflow.com/q/20881157
tags question: http://stackoverflow.com/q/20963110
tags question: http://stackoverflow.com/q/21016644
tags question: http://stackoverflow.com/q/20914158
tags question: http://stackoverflow.com/q/21009813
tags question: http://stackoverflow.com/q/20966204
tags question: http://stackoverflow.com/q/20978922
tags question: http://stackoverflow.com/q/21014712
tags question: http://stackoverflow.com/q/20931194

http://stackoverflow.com/comment/31296745
has text: Hold the thread reference - You just Google how to stop the thread. Before stopping the thread close the client socket(s).
comment on: http://stackoverflow.com/a/20859831
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/20968735
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/20876951
has body: Ok, since you have clarified your question, you need 2 ways to be able to do your data processing: firstly via the cron schedule and then manually. I am going to suggest you break it into 3 routes (this is obviously java DSL, but you can easily convert it to xml). First route is the quartz schedule- it calls the processing route. from("quartz://schedule?cron=0+1+0+*+*+?+*") .to("direct:doProcessing") ; Second route does the processing from("direct:doProcessing") // do awesome stuff here... ; Third route is your manual restart from("timer://manualRestart?repeatCount=1") .routeId("manualRestart") .noAutoStartup() .to("direct:doProcessing") ; Now, you can start the route with id "manualRestart" using the route-start command on the command line, or via a tool like fmc. Hope this helps.
type: Answer
score: 3

http://stackoverflow.com/comment/31579354
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20995715
score: 0
has text: The elegant solution is just Guava's `CacheBuilder`. It does exactly what you want behind the scenes in terms of lazy initialization.

http://stackoverflow.com/q/21010295
has title: How do I convert a 1D array to a 3D array?
type: Question
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/21010345
tagged with: java
has body: I have a text file composed of 4096 (16^3) bytes that I need to load up and throw into a 3D array. Each byte represents a tile ID in a 16^3 chunk, so how can I create a 3D array based off a 1D array with 16 length, width and depth? I know the algorithm is something like this: i = x + WIDTH * (y + HEIGHT * z); z = Math.round(i / (WIDTH * HEIGHT)); y = Math.round((i - z * WIDTH * HEIGHT) / WIDTH); x = i - WIDTH * (y + HEIGHT * z); How do I find i though? I don't understand, considering i is a variable in calculating the x, y, and z variables.
has answer: http://stackoverflow.com/a/21010383
type: AnsweredQuestion
score: 2
tagged with: arrays
downvote count: 0
accepted answer: http://stackoverflow.com/a/21010345
favorite count: 0
possible better answer: http://stackoverflow.com/a/21010383

http://stackoverflow.com/comment/31509420
has text: So this is when a Swing repaint request comes in so you know the dirty area to redraw?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20972892
score: 0

http://stackoverflow.com/a/20992641
has comment: http://stackoverflow.com/comment/31545426
has comment: http://stackoverflow.com/comment/31545883
type: Answer
has comment: http://stackoverflow.com/comment/31546156
accepted answer of: http://stackoverflow.com/q/20991860
has comment: http://stackoverflow.com/comment/31544811
answers question: http://stackoverflow.com/q/20991860
has body: I have copy pasted same code and it is working fine. I think u dont have administrator permission on C drive. login As Administrator and run . it will work. Access Denied Exception will come when u don have administrator level of permission on C drive.
has comment: http://stackoverflow.com/comment/31544982
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/20903652
type: AnsweredQuestion
tagged with: wso2
has answer: http://stackoverflow.com/a/20921259
tagged with: java
tagged with: apache-axis
type: Question
has body: We are sending a transaction to our customers using SOAP web service. Our enviornment: Container : None (Component is running as stand alone) Axis version : 1.6.2 Requirment: If the transaction size is small, we need to send the content as part of Body. If the transaction is huge, need to send the content as an attachment. Code snippet: final ServiceClient sender = new ServiceClient(); final Options options = new Options(); options.setTo(endpointRef); options.setTransportInProtocol(Constants.TRANSPORT_HTTP); options.setProperty(Constants.Configuration.ENABLE_MTOM,Constants.VALUE_TRUE); sender.setOptions(options); final OMFactory omFactory = OMAbstractFactory.getOMFactory(); . . . DataHandler dataHandler = new DataHandler(new FileDataSource(new File("C://KB_9.9.xml"))); OMText omText = omFactory.createOMText(dataHandler, true); final OMElement inputData = omFactory.createOMElement("inputData",null); inputData.addChild(omText); method.addChild(inputData); sender.fireAndForget(omElement); Our issue: It is working fine and the data reached successfully. But the issue is attachment is not encoded. It is displaying the content of the file as it is. My question is do we need to enable any of the property of axis to encode the attachment content or we need to manually perform the Base64 Encoding. Sample Output: ***--MIMEBoundary_5e6b57717e6fc299242f9cc2ec3ab3d6cd5ef851033370e3*** Content-Type: application/xop+xml; charset=UTF-8; type="text/xml" Content-Transfer-Encoding: binary Content-ID: &lt;0.d5d9e693c8e32f0069b7cbb392d60e7f8b08366c7cb4384d@apache.org&gt; &lt;?xml version='1.0' encoding='UTF-8'?&gt; xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:1.7e6b57717e6fc299242f9cc2ec3ab3d6cd5ef851033370e3@apache.org" ***--MIMEBoundary_5e6b57717e6fc299242f9cc2ec3ab3d6cd5ef851033370e3*** Content-Type: application/octet-stream Content-Transfer-Encoding: binary Content-ID: &lt;1.7e6b57717e6fc299242f9cc2ec3ab3d6cd5ef851033370e3@apache.org&gt; My test file..... …
accepted answer: http://stackoverflow.com/a/20921259
score: 0
answer count: 1
has title: Axis2 - Attachment is not encoded

http://stackoverflow.com/a/23529322
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/20863919
has body: I think the best thing to do is simply piggy-back off the try-with-resources construct if you find that you have an AutoCloseable, something like this: /** * @throws NoSuchElementException */ public static &lt;T&gt; T getOne(Iterable&lt;T&gt; iterable) { Iterator&lt;T&gt; iterator = iterable.iterator(); if (iterator instanceof AutoCloseable) { try (AutoCloseable c = (AutoCloseable) iterator) { return iterator.next(); } } else { return iterator.next(); } } Then the language-level construct will take care of exceptions (including in the close method) in the correct way.
answers question: http://stackoverflow.com/q/20863919
score: 3

http://stackoverflow.com/q/20952160
type: Question
score: 3
has title: Access private map through reflection in unit test
has answer: http://stackoverflow.com/a/29077166
possible better answer: http://stackoverflow.com/a/20952237
upvote count: 3
has body: I need to access a private map for unit testing but unable to do that. Main class: public class TestMe{ private Map&lt;String, SomeObject&gt; testMap = new HashMap&lt;String, SomeObject&gt;(); } Unit Test: public class TestMeTester{ public testTestMe(){ TestMe obj = new TestMe(); Class clazz = obj.getClass(); Field field = clazz.getDeclaredField("testMap"); field.setAccessible(true); Map&lt;String, SomeObject&gt; refMap = (HashMap&lt;String, SomeObject&gt;) field.get(new HashMap&lt;String, Object&gt;()); System.out.println("==&gt;" + refMap); } } Exception: java.lang.IllegalArgumentException: Can not set java.util.Map field com.xx.TestMe.testMap to java.util.HashMap at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:164) at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:168) at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:55) at sun.reflect.UnsafeObjectFieldAccessorImpl.get(UnsafeObjectFieldAccessorImpl.java:36)
favorite count: 0
has answer: http://stackoverflow.com/a/20952237
has answer: http://stackoverflow.com/a/20952316
answer count: 4
type: AnsweredQuestion
downvote count: 0
tagged with: reflection
tagged with: java
has answer: http://stackoverflow.com/a/20952235
accepted answer: http://stackoverflow.com/a/20952235
tagged with: unit-testing

http://stackoverflow.com/a/20948723
has comment: http://stackoverflow.com/comment/31494032
type: Answer
has comment: http://stackoverflow.com/comment/31494196
score: 0
has comment: http://stackoverflow.com/comment/31465007
has body: You have make sure you return null if no account matches the id passed. public Account getAccount(int id){ for (Account account : accounts) { if(account.getId()==id){ return (account); } } return null; }
answers question: http://stackoverflow.com/q/20948637

http://stackoverflow.com/a/20854580
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/20854514
accepted answer of: http://stackoverflow.com/q/20854514
upvote count: 2
has body: You need to initialize Elm32x.so the part of code will be public class FrameBaglanti extends javax.swing.JFrame { Elm32x elm = new Elm32x(); //remaining code

http://stackoverflow.com/q/20869537
has body: We received a question on making a program for entering the name of people and their gender(n number) and to store the boys and girls in two separate arrays. I wrote the following code but it does not accept both the name and the gender from the second loop. Why? import java.io.*; class arrays { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); void main()throws IOException { String name=""; System.out.println("enter number of students"); int n=Integer.parseInt(br.readLine()); String[] c=new String[n];//5 String[] b=new String[n];//5 String[] g=new String[n];//5 char[] s=new char[n]; System.out.println("enter the name and gender of "+n+" students"); int i=0; do { System.out.println("enter the data of "+(i+1)+" student"); c[i]=br.readLine(); s[i]=(char)br.read(); i++; } while(i&lt;n); for(int j=0;j&lt;n;j++) { if(s[j]=='b'||s[j]=='B') { System.arraycopy(c,j,b,j,1); } else if(s[j]=='g'||s[j]=='G') { System.arraycopy(c,j,g,j,1); } } for(int j=0;j&lt;n;j++) { System.out.print("boys are:-"+b[j]); System.out.println("girls are:-"+g[j]); } } }
has answer: http://stackoverflow.com/a/20869669
type: UnansweredQuestion
has title: java arrays and loop situation
has comment: http://stackoverflow.com/comment/31313395
tagged with: java
tagged with: loops
has answer: http://stackoverflow.com/a/20869856
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31313404
tagged with: arrays

ruby-on-rails-4
type: Tag
tags question: http://stackoverflow.com/q/20970123
tag name: ruby-on-rails-4

http://stackoverflow.com/q/20868745
tagged with: encryption
tagged with: android
has answer: http://stackoverflow.com/a/20900108
has body: I am creating an Android application that encrypts a string using a user-chosen password. The system will display the encrypted string in the edit text. This is the method that I try to encrypt with. Can anyone tell me where is the error that do not allow the system to show the result? The system stops before the line cipher.init(). Log cat 01-01 12:37:37.756: D/libEGL(2810): loaded /system/lib/egl/libEGL_genymotion.so 01-01 12:37:37.756: D/(2810): HostConnection::get() New Host Connection established 0xb8d1bce8, tid 2810 01-01 12:37:37.872: D/libEGL(2810): loaded /system/lib/egl/libGLESv1_CM_genymotion.so 01-01 12:37:37.872: D/libEGL(2810): loaded /system/lib/egl/libGLESv2_genymotion.so 01-01 12:37:38.112: W/EGL_genymotion(2810): eglSurfaceAttrib not implemented 01-01 12:37:38.112: E/OpenGLRenderer(2810): Getting MAX_TEXTURE_SIZE from GradienCache 01-01 12:37:38.180: E/OpenGLRenderer(2810): Getting MAX_TEXTURE_SIZE from Caches::initConstraints() 01-01 12:37:38.196: D/OpenGLRenderer(2810): Enabling debug mode 0 01-01 12:37:47.508: W/EGL_genymotion(2810): eglSurfaceAttrib not implemented 01-01 12:37:52.344: W/EGL_genymotion(2810): eglSurfaceAttrib not implemented 01-01 12:37:52.452: D/dalvikvm(2810): GC_FOR_ALLOC freed 125K, 1% free 16924K/17072K, paused 14ms, total 16ms 01-01 12:37:56.420: E/PBEkEYsPEC(2810): javax.crypto.spec.PBEKeySpec@52de0e0c 01-01 12:37:56.492: E/PBEkEYsPEC(2810): com.android.org.bouncycastle.jcajce.provider.symmetric.util.BCPBEKey@52e0076c 01-01 12:37:56.492: E/PBEkEYsPEC(2810): javax.crypto.spec.PBEParameterSpec@52e00df8 Code public String Padding_key() { try { PBEKeySpec pbeKeySpec = new PBEKeySpec(STReditTxtPass.toCharArray()); Log.e("PBEkEYsPEC", pbeKeySpec.toString()); Toast.makeText(this, "step 1", Toast.LENGTH_SHORT).show(); Cipher cipher = Cipher.getInstance("AES"); Toast.makeText(this, "after ciphering", Toast.LENGTH_SHORT).show(); SecretKeyFactory keyFactory = SecretKeyFactory .getInstance("PBEWithMD5AndDES"); Toast.makeText(this, "a…
has comment: http://stackoverflow.com/comment/31311761
has comment: http://stackoverflow.com/comment/31311812
tagged with: java
type: Question
score: 0
tagged with: jce
answer count: 1
has comment: http://stackoverflow.com/comment/31369248
has title: Android string encryption stops before cipher.init() method
type: UnansweredQuestion

http://stackoverflow.com/q/20892040
tagged with: java
has body: I am having trouble adding dependancies that are located in my working directory, to my .jar. When I try to run the .jar from command line I get errors saying that files I am attempting to access do not exist. Why does netbeans not include the working directory in the build dependancies, seems like a pretty easy and obvious thing to do.... I am simply trying to read a file, located at res/settings/settings.txt. I have made my working directory the res folder so that in netbeans I access that file successfully through 'settings/settings.txt'. I attempted to make the settings folder a library so it would be added to the build, however it refused to copy it because it was a directory. How can I add this file to the build so i can run it from command line?
has title: Add working directory to build
type: Question
has comment: http://stackoverflow.com/comment/31355960
downvote count: 0
has answer: http://stackoverflow.com/a/20892398
tagged with: netbeans-7
favorite count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31356240
tagged with: netbeans
accepted answer: http://stackoverflow.com/a/20892398
upvote count: 1
type: AnsweredQuestion
score: 1

http://stackoverflow.com/comment/31532841
type: Comment
has text: You're missing a closing brace (`}`) after `g.dispose`
type: QuestionComment
comment on: http://stackoverflow.com/q/20985529
score: 0

http://stackoverflow.com/comment/31563139
type: Comment
type: QuestionComment
score: 7
comment on: http://stackoverflow.com/q/21002537
has text: You're getting downvotes because you haven't shown any research, and your third point is at best incorrect, and at worst just trolling. The answers to your question are: 1. both, 2. neither, 3. it doesn't.

http://stackoverflow.com/a/20991828
has body: Code shown above is correct. Problem was that the connection was closed before reading the stream was finished. Overlooked that because get requests for string (JSON) were fine (small response size).
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/20973658
answers question: http://stackoverflow.com/q/20973658

http://stackoverflow.com/q/20957966
has answer: http://stackoverflow.com/a/20958212
has answer: http://stackoverflow.com/a/20958042
tagged with: inheritance
accepted answer: http://stackoverflow.com/a/20958042
has comment: http://stackoverflow.com/comment/31480597
has body: I have a homework assignment and there's one thing I can't get hold of. I have an abstract class, which contains methods. I must create a subclass that inherits and extends those methods. And there's one method in that abstract class which I don't understand. Does anybody know what this piece of code does? All other methods in this class do different things with arrays (like add or remove specific integer). Some other methods create a LiFo stack (push, pop, peek, I hope you know what I mean). But I have no problems with other methods it's just this one I don't understand: /*This is a method which I can use in my subclass and main method: */ public Iterator&lt;Integer&gt; iterator() { return new IntIterator(); } /*This is a private inner class used by iterator() */ class IntIterator implements Iterator&lt;Integer&gt; { private int count = 0; public Integer next() {return values[count++];} public boolean hasNext() {return count&lt;size;} public void remove() { throw new RuntimeException("remove() is not implemented"); } } "Size" variale represents actual array or stack size, "values" is an array which stores all integers. Thank you in advance.
score: 0
has comment: http://stackoverflow.com/comment/31480598
answer count: 2
tagged with: iterator
has title: Homework: Iterator method which uses private iterator class
possible better answer: http://stackoverflow.com/a/20958212
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31481199
type: Question

http://stackoverflow.com/q/20937907
answer count: 1
tagged with: stack-overflow
tagged with: jvm
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31443207
tagged with: recursion
has comment: http://stackoverflow.com/comment/31443281
has title: Various stack size for multiple recursive method invocations
tagged with: java
has answer: http://stackoverflow.com/a/20938263
tagged with: eclipse
has comment: http://stackoverflow.com/comment/31443213
type: Question
has comment: http://stackoverflow.com/comment/31443324
has comment: http://stackoverflow.com/comment/31443426
has comment: http://stackoverflow.com/comment/31443709
has body: During experiments I've found very interesting issue related to Stack overflow error. Take a look at this code: Foo class: public class Foo { private int i; public void doFoo() { i++; doBar(); } public void doBar() { doFoo(); } public int getI() { return i; } public void reset() { i = 0; } } App class: public class App { public static void main(String[] args) { Foo foo = new Foo(); try { foo.doFoo(); } catch (StackOverflowError e) { System.out.println(foo.getI()); } } } It's obvious that recursive invoking doFoo and doBar methods will cause stackOverflowError. But what value will have foo.i after this? I've tested it few times with default VM stack size - here it is what System.out.println(foo.getI()); prints: 1st run: 4372 2nd run: 8364 3th run: 3381 4th run: 8406 5th run: 3485 Can you see it? Constantly running this app, i variable will be always ~4500 greater / smaller than previous run. And what if we will increase stack size? when added -Xss1m parameter to VM args, here are the results: 1st run: 33364 2nd run: 38404 3th run: 33787 4th run: 38434 5th run: 33805 It's the same thing! i value is still ~4500 greater/smaller than previous run! Hoever, when we change main method to this: for (int i = 0; i &lt; 10; i++) { try { foo.doFoo(); foo.reset(); } catch (StackOverflowError e) { System.out.println(foo.getI()); } } we will have predictable results: 38398 80796 123194 165592 207990 250388 292786 335184 377582 419980 It may be due to more and more stack free space after JVM initialization. But, why there are ~4500 oscillations when program is invoked again and again? PS. I'm running this app from Eclipse directly (if that matters). ==== Edit: ok, so I can now see, that foo.reset() is never invoked, because Error is thrown before it. When foo.dooFoo() is swapped with foo.reset(), we have now constant result: 38394 42394 42394 42394 42394 42394 42394 42394 42394 42394 But, question why there are ~4500 oscillations when running program run by run, is still open. ==EDI…
score: 0
has comment: http://stackoverflow.com/comment/31453856
has comment: http://stackoverflow.com/comment/31442973

http://stackoverflow.com/a/20890503
has comment: http://stackoverflow.com/comment/31355413
has comment: http://stackoverflow.com/comment/31355088
type: Answer
has comment: http://stackoverflow.com/comment/31355846
has comment: http://stackoverflow.com/comment/31355711
has comment: http://stackoverflow.com/comment/31355213
has comment: http://stackoverflow.com/comment/31356173
upvote count: 1
has comment: http://stackoverflow.com/comment/31354137
has comment: http://stackoverflow.com/comment/31352915
has comment: http://stackoverflow.com/comment/31353681
score: 1
has comment: http://stackoverflow.com/comment/31353804
answers question: http://stackoverflow.com/q/20884891
has comment: http://stackoverflow.com/comment/31355072
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31355299
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20884891
has comment: http://stackoverflow.com/comment/31354944
has body: Try to do this way: implement Callable interface and put your code in call method submit your task to ExecutorService and get instance of the Future object call get on the Future object. This method will block until response is returned otherwise TimeoutException will be thrown. Solution: public static String execute(final String executable, final String workingdir, final String input) { ExecutorService executor = Executors.newCachedThreadPool(); Callable&lt;String&gt; task = new Callable&lt;String&gt;() { public String call() throws Exception { // Execution in another thread. String line = ""; try { Command command = new Command(input, executable, "-a", workingdir + "ndrg.gg"); command.execute(); line = command.getErrorOutput(); if (line.contains("1 records processed")) { line = command.getOutput(); if (line.length() &gt; input.length() + 1) { line = command.getOutput().substring( input.length() + 1); } else { line = "ERROR:1- " + line; } } else { line = "ERROR: " + line; } } catch (Exception ex) { ex.printStackTrace(); line = "ERROR: " + ex.getMessage(); } return line; } }; Future&lt;String&gt; future = executor.submit(task); String response = ""; try { // Wait 10s for response. response = future.get(10, TimeUnit.SECONDS); } catch (InterruptedException e) { e.printStackTrace(); // Write something meaningful response = "InterruptedException" } catch (ExecutionException e) { e.printStackTrace(); // Write something meaningful response = "ExecutionException" } catch (TimeoutException e) { e.printStackTrace(); // Do something if response is not ready within 10s. response = "TimeoutException" } return response; }

http://stackoverflow.com/comment/31382550
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20905985
has text: I think that isn't thread safe as rest of methods in Java7
score: 0

http://stackoverflow.com/comment/31301050
comment on: http://stackoverflow.com/a/20861971
type: AnswerComment
score: 0
type: Comment
has text: response.getWriter gives a PrintWriter object which can print out the object in the browser. Though I agree it is said to be a bad practice, it is not necessary for the HTML code to belong to JSP file.

http://stackoverflow.com/a/20945106
type: Answer
accepted answer of: http://stackoverflow.com/q/20944990
has body: Try and define your timestamp at a more granular level - like millis: SimpleDateFormat sd = new SimpleDateFormat("DD MMM YYYY hh:mm:ss.SSS aa"); System.out.println(sd.format(Calendar.getInstance().getTimeInMillis())); Output: 06 Jan 2014 01:05:02.894 PM
upvote count: 1
type: AcceptedAnswer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20944990

http://stackoverflow.com/q/20922779
has comment: http://stackoverflow.com/comment/31422947
has body: I'm getting the following error: !ENTRY org.eclipse.ui 4 0 2014-01-03 19:04:22.670 !MESSAGE Unhandled event loop exception !STACK 0 java.lang.NoClassDefFoundError: Could not initialize class com.google.gdt.eclipse.login.GoogleLogin at com.google.appengine.eclipse.core.deploy.ui.DeployProjectHandler.execute(DeployProjectHandler.java:67) at com.google.appengine.eclipse.core.deploy.ui.DeployProjectAction.run(DeployProjectAction.java:27) at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4166) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1466) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1489) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1474) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1279) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4012) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3651) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)…
tagged with: eclipse
score: 0
has comment: http://stackoverflow.com/comment/31476639
type: UnansweredQuestion
tagged with: google-app-engine
answer count: 0
tagged with: java
tagged with: google-plugin-eclipse
has title: Deploy to app engine stopped working: NoClassDefFoundError GoogleLogin
type: Question
tagged with: gwt

http://stackoverflow.com/q/20958350
upvote count: 6
has comment: http://stackoverflow.com/comment/31481814
has answer: http://stackoverflow.com/a/20958434
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31481675
has answer: http://stackoverflow.com/a/20958452
has answer: http://stackoverflow.com/a/20958367
has comment: http://stackoverflow.com/comment/31481752
score: 6
type: Question
has body: What is the most condense way to invert a boolean if another boolean is true. In other words, what is the shortest way of writing condition ? !value : value, preferably evaluating value only once? Edit: Just so you know, I am passing the result to a method
has answer: http://stackoverflow.com/a/20958424
has answer: http://stackoverflow.com/a/62611585
tagged with: java
has comment: http://stackoverflow.com/comment/31481391
accepted answer: http://stackoverflow.com/a/20958452
tagged with: boolean
linked to: http://stackoverflow.com/q/610916
has comment: http://stackoverflow.com/comment/31481651
has comment: http://stackoverflow.com/comment/31481639
downvote count: 0
answer count: 7
has comment: http://stackoverflow.com/comment/31481756
has comment: http://stackoverflow.com/comment/31481410
has answer: http://stackoverflow.com/a/20958409
favorite count: 0
possible better answer: http://stackoverflow.com/a/20958390
has answer: http://stackoverflow.com/a/20958390
has title: Invert bool if true

http://stackoverflow.com/a/20890090
has comment: http://stackoverflow.com/comment/31388315
upvote count: 2
has comment: http://stackoverflow.com/comment/31372281
has comment: http://stackoverflow.com/comment/31356130
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/31351978
accepted answer of: http://stackoverflow.com/q/20890023
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/20890023
has body: search is an int which cannot be dereferenced (i.e. you cannot use . with it). It seems like using == may work if it is an integer, but perhaps getCourseTitle returns a string. In that case, convert the integer to a string. while (i &lt; a.length &amp;&amp; Integer.toString(search).equals // etc.
has comment: http://stackoverflow.com/comment/31354587
has comment: http://stackoverflow.com/comment/31380413

http://stackoverflow.com/comment/138029001
type: Comment
score: 0
has text: Any idea if there is an upper limit to for the size of each cache entry? Using your exemple some of my entry can have up to 20mb, and testing with filters that get near that, end up with no insert into cache and so no cache for the next execution as well.
type: AnswerComment
comment on: http://stackoverflow.com/a/21021240

http://stackoverflow.com/a/20891164
has body: I resolved the issue by changing the getEmplByPostReqParam() as follows: @POST @Path("/get") public Response getEmplByPostReqParam(@FormParam("param1") String id) { EmployeeDAO dbHandler = new EmployeeDAOImpl(); System.out.println("getEmplByPostReqParam"); Employee fetchedEmployee = dbHandler.findEmployee(Integer.parseInt(id)); ResponseBuilder rb = new ResponseBuilderImpl(); rb.type(MediaType.APPLICATION_ATOM_XML); rb.entity(fetchedEmployee); return rb.build(); } This is working fine for me, if there is some better approach or there is something wrong with this approach, please post a comment.
accepted answer of: http://stackoverflow.com/q/20890340
answers question: http://stackoverflow.com/q/20890340
downvote count: 0
type: Answer
upvote count: 1
score: 1
type: AcceptedAnswer

http://stackoverflow.com/q/20986833
tagged with: java
tagged with: jpanel
tagged with: image
type: Question
downvote count: 0
has body: I'm going to make a game with Java, my game will have a menu. the menu is having a background, and 2 JLabel objects. I've make them on separate class, which is passed to one JFrame. And my problem is, I've load 2 of them on a single frame, but one of them always hidden by another. this is the code: JFrame class @SuppressWarnings("serial") public class Sistem extends JFrame{ private final int lebar=954; private final int tinggi=540; private Image bg; File gbr=new File("res/a.jpg"); public Sistem(){ this.setTitle("Unknown man Unkown power"); this.setSize(new Dimension(lebar,tinggi)); this.setFocusable(true); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setResizable(false); this.setContentPane(new Ngrep()); //this.setContentPane(new Menu()); this.setVisible(true); //loadfont(); //loadbg(); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { // TODO Auto-generated method stub new Sistem(); } }); } } background class @SuppressWarnings("serial") public class Ngrep extends JPanel{ private int l=954; private int t=540; private BufferedImage bg; File gbr=new File("res/a.jpg"); public Ngrep(){ loadbg(); } private void loadbg() { // TODO Auto-generated method stub try { bg=ImageIO.read(gbr); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } @Override public void paint(Graphics g) { // TODO Auto-generated method stub super.paint(g); g.drawImage(bg, 0, 0, l, t, null); } } menu class @SuppressWarnings("serial") public class Menu extends JPanel implements Runnable,KeyListener{ private int l=954; private int t=540; JLabel menu1=new JLabel("MULAI BARU"); JLabel menu2=new JLabel("KELUARRR"); private File fo=new File("res/Mawns.ttf"); JLayeredPane p=new JLayeredPane(); public Menu(){ loadfont(); this.add(menu1); this.add(menu2); } public void loadfont(){ try { FileInputStream fi=new FileInputStream(fo); Font f=Font.createFont(Font.TRUETYPE_FONT, fi).deriveFont(Font.TRUETYP…
has title: How to load two extended JPanel class to one JFrame?
favorite count: 0
has answer: http://stackoverflow.com/a/20988475
answer count: 3
possible better answer: http://stackoverflow.com/a/20986871
has answer: http://stackoverflow.com/a/20986871
tagged with: paint
has answer: http://stackoverflow.com/a/20986916
upvote count: 2
tagged with: swing
accepted answer: http://stackoverflow.com/a/20986916
score: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/31513999
type: QuestionComment
has text: it may also start without a string written
comment on: http://stackoverflow.com/q/20975592
score: 0
type: Comment

http://stackoverflow.com/a/20916340
score: 0
answers question: http://stackoverflow.com/q/20916268
accepted answer of: http://stackoverflow.com/q/20916268
has comment: http://stackoverflow.com/comment/31402136
has body: try { Playnow.setIcon(new ImageIcon(new URL("https://i.sstatic.net/JMQMX.png"))); } catch (MalformedURLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } this worked for me at the moment when i tried using ur code. however, if you wanna load it locally, you should try: Playnow.setIcon(new ImageIcon(getClass().getResource("test.png"))); and test.png is in the same directory as the class file this code is in. hope this helps :)
has comment: http://stackoverflow.com/comment/31402635
has comment: http://stackoverflow.com/comment/31402042
has comment: http://stackoverflow.com/comment/31402275
has comment: http://stackoverflow.com/comment/31402164
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31402311
has comment: http://stackoverflow.com/comment/31402598
has comment: http://stackoverflow.com/comment/31402019
type: Answer
has comment: http://stackoverflow.com/comment/31402065
has comment: http://stackoverflow.com/comment/31402463

http://stackoverflow.com/comment/31366011
has text: When you find that you're duplicating code, it's a good thing to put it into a method
comment on: http://stackoverflow.com/q/20897588
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/31423877
comment on: http://stackoverflow.com/a/20927846
score: 0
has text: @DoorknobofSnow no, I think strings should be the default for both quote styles since strings are orders of magnitude more common than char.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/20936831
has comment: http://stackoverflow.com/comment/31441334
upvote count: 2
has body: Toast shouldn't be used that way. Toast.LENGTH_SHORT will remain there for 3 seconds before disappearing, however timer will tick every second so obviously Toast is slow. If you want to show timer to user then you must use a TextView, if you want timer for your own then you can use Log.d(); Update :- After a bit searching I found out that you cannot set Toast for custom time. The Toast has only two values Toast.LENGTH_LONG and Toast.LENGTH_SHORT. See this question here Can an Android Toast be longer than Toast.LENGTH_LONG?. As a work around,if you really want to set the Toast for just 1 second, then you can do this final Toast toast = Toast.makeText(ctx, "This message will disappear in 1 second", Toast.LENGTH_SHORT); toast.show(); Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { toast.cancel(); } }, 1000);
has comment: http://stackoverflow.com/comment/31440588
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/20936772
answers question: http://stackoverflow.com/q/20936772
has comment: http://stackoverflow.com/comment/31440809
score: 2
has comment: http://stackoverflow.com/comment/31440568

http://stackoverflow.com/q/20899467
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20899717
downvote count: 3
has answer: http://stackoverflow.com/a/20899510
type: Question
has comment: http://stackoverflow.com/comment/31369426
has comment: http://stackoverflow.com/comment/31369048
has answer: http://stackoverflow.com/a/20899499
upvote count: 0
has title: How to access the java constructor?
tagged with: class
possible better answer: http://stackoverflow.com/a/20899499
has answer: http://stackoverflow.com/a/20899566
accepted answer: http://stackoverflow.com/a/20899717
favorite count: 0
has comment: http://stackoverflow.com/comment/31369083
answer count: 5
has comment: http://stackoverflow.com/comment/31369088
score: -3
has body: A class WeightedQuick union is defined but there is public QuickunionFind(int N) what is it ?Is it a method then how do i pass it the value N, or if it something else how shoulf the value of N be passed to it or how can it be acessed Thank you for everyone who answered, I am new to coding, realized the question was silly. public class WeightedQuickUnionUF { private int[] id; // id[i] = parent of i private int[] sz; // sz[i] = number of objects in subtree rooted at i private int count; // number of components /** * Initializes an empty union-find data structure with N isolated components 0 through N-1. * @throws java.lang.IllegalArgumentException if N &lt; 0 * @param N the number of objects */ public WeightedQuickUnionUF(int N) { count = N; id = new int[N]; sz = new int[N]; for (int i = 0; i &lt; N; i++) { id[i] = i; sz[i] = 1; } }
has comment: http://stackoverflow.com/comment/31369041
has answer: http://stackoverflow.com/a/20899500

http://stackoverflow.com/a/21015978
has body: I just run your code,and it println "true"
has comment: http://stackoverflow.com/comment/31588542
has comment: http://stackoverflow.com/comment/31587942
answers question: http://stackoverflow.com/q/21015833
score: 0
type: Answer

http://stackoverflow.com/q/20907418
tagged with: java
has body: I'm trying to get a package-object (get by id) from the repository of Enterprise Architect (Sparx Systems) and get the package name. Here's a code snippet: org.sparx.Package oPackage = null; oPackage = repo.GetPackageByID(Integer.parseInt(packageID)); String sName = oPackage.Name; When I run my script, I get the following compilation error: deleteExternalRef.java:44: error: cannot find symbol String sName = oPackage.Name; ^ symbol: variable Name location: variable oPackage of type Package 1 error Am I doing something wrong in the Java code or am I using the EA-API in a wrong way? I can use methods of the Package class. Only when I try to use the variables, I get this error.
type: Question
tagged with: enterprise
has comment: http://stackoverflow.com/comment/31384100
tagged with: compilation
score: 0
has comment: http://stackoverflow.com/comment/31384044
answer count: 1
accepted answer: http://stackoverflow.com/a/27021286
has comment: http://stackoverflow.com/comment/31457965
has title: Java "Cannot find symbol" in Enterprise Architect API
has answer: http://stackoverflow.com/a/27021286
type: AnsweredQuestion

http://stackoverflow.com/a/20886200
score: 5
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/31344052
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20886168
has comment: http://stackoverflow.com/comment/31344221
type: Answer
has comment: http://stackoverflow.com/comment/31344181
answers question: http://stackoverflow.com/q/20886168
has body: Use Ctrl + Shift + Cursor Up/Down.
has comment: http://stackoverflow.com/comment/31344432

http://stackoverflow.com/a/20963663
type: Answer
upvote count: 2
score: 2
has body: You shall read an XML as an InputStream to pass it to DOM parser. The only point is where the XML file is, and according to each location you can use a different mechanism. If you know the exact location of the XML file and you want to hard-code it in your application you can do something like: InputSteram is = new FileInputStream("/path/to/xml/file.xml"); If you are storing your XML in your classpath (between your classes or in an JAR file which is included in class-path), you shall find it by a proper ClassLoader. InputSream is = ClassLoader.getSystemResourceAsStream("yql.xml"); If you are developing a WEB application and your XML is your WEB-INF folder, you shall use something like: InputStream is = servletContext.getResourceAsStream("/WEB-INF/relative/path/to/xml/file.xml"); and so on (there could be other solutions, such as retrieving XML from an URL, reading from a ZIP file, and ...). So using a ClassLoader is not a must, it totally depends on your project+XML file layout.
accepted answer of: http://stackoverflow.com/q/20963531
answers question: http://stackoverflow.com/q/20963531
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/20854890
type: Question
tagged with: java
tagged with: spring-aop
has comment: http://stackoverflow.com/comment/31284857
has comment: http://stackoverflow.com/comment/31284936
downvote count: 0
tagged with: spring-security
favorite count: 0
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
has body: I'm trying to do something like this (which works) @Service("myService") @Scope("session") public class MyService { public boolean hasAccessOnResource(String str) { return true; } @PreAuthorize("@myService.hasAccessOnResource(#str)") public void execute(String str) { System.out.println("hello"); } } However, when the MyService implements an Interface and i call the execute over an interface, I get an exception. At the controller (for ref) @Controller @Scope("session") public class HomeController { @Autowired @Qualifier("myService") MyServiceInterface service; // &lt;- doesn't work case //MyService service; &lt;- working case @RequestMapping(value = "/", method = RequestMethod.GET) public String home(HttpSession session) { service.execute("hello"); return "home"; } } The service implementing an interface.. @Service("myService") @Scope("session") public class MyService implements MyServiceInterface{ public boolean hasAccessOnResource(String str) { return true; } @PreAuthorize("@myService.hasAccessOnResource(#str)") @Override public void execute(String str) { System.out.println("hello"); } } The exception: org.springframework.expression.spel.SpelEvaluationException: EL1004E:(pos 11): Method call: Method hasAccessOnResource(java.lang.String) cannot be found on com.sun.proxy.$Proxy52 type What am I doing wrong? Is this the correct way? What is the approach i need to take if i want to PreAuthorize over this interface method?
answer count: 0
score: 1
upvote count: 1
has title: Spring Security: Custom PreAuthorize method of same bean over an Interface unable to access bean

http://stackoverflow.com/a/20990280
has comment: http://stackoverflow.com/comment/31545820
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31542296
type: Answer
has body: It's a very well known issue of AA with Eclipse. As said in the project's FAQ page, you can fix it by either : Importing the whole package: import com.example.packageB.*; Using a fully qualified name : com.example.packageB.B_.intent(this).start(); Having A and B_ in the same package.
accepted answer of: http://stackoverflow.com/q/20990158
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/20990158

http://stackoverflow.com/comment/31580200
type: AnswerComment
type: Comment
has text: @Rycerub: See also the examples cited in the [info](http://stackoverflow.com/tags/embedded-resource/info) for [tag:embedded-resource].
comment on: http://stackoverflow.com/a/21010860
score: 1

http://stackoverflow.com/q/20858992
score: 4
has comment: http://stackoverflow.com/comment/31295852
has comment: http://stackoverflow.com/comment/31293075
has answer: http://stackoverflow.com/a/20860188
has body: I'm a relative newbie to custom error handling in Java, and I'm trying to figure out how to use catch statements to deliver specific messages inside of an if statement. I wanted to get some extra sets of eyes to look at what I'm trying to do and offer feedback before I completely overthink this and overdo it too badly. Consider: We have a directory of hourly log files and I have an on-demand reporting job creates a concatenation of all today's log files created so far. I want to add a step that checks for the existence of a concatenated log file, deletes it then creates it if present, or just creates it if it's not present. With the code below, I'm returning an exception if, for some reason, the new file cannot be created. try { File file = new File (destinationPath + "todayToNowLogFile.csv"); if(file.exists()) { if(file.delete()) { System.out.println(file.getName() + " is deleted!"); } else { System.out.println("Existing file cannot be deleted.") } } else { System.out.println("File will be created."); } } // catch(Exception e) { System.err.println("Exception: "); System.out.println("Exception: "+ e.getMessage().getClass().getName()); e.printStackTrace(); } Now, in the case where the file cannot be deleted, I would like to display the exception preventing file deletion. First, I would need to catch that error, but then where do I put the try? Doing something like this... try { if(file.delete()) { System.out.println(file.getName() + " is deleted!"); } } else { catch(Exception eDel) { System.err.println("Exception: "); System.out.println("Exception: "+ eDel.getMessage().getClass().getName()); eDel.printStackTrace(); } } ....interrupts the if...then block. I'm not sure how to insert a try...catch within an if...then. Is there a way to do this? Or does my original code catch EVERY error associated with ANY operation on the file defined in the try block, and I would need to put if...then logic in the catch block, something along the lines of this pseudocode.... catch(Exc…
has answer: http://stackoverflow.com/a/20859218
has comment: http://stackoverflow.com/comment/31293089
favorite count: 0
upvote count: 5
has answer: http://stackoverflow.com/a/20860485
answer count: 4
type: UnansweredQuestion
tagged with: error-handling
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/20859060
has title: Exception handling within if statements in Java
tagged with: java

http://stackoverflow.com/a/20944111
answers question: http://stackoverflow.com/q/20944024
upvote count: 7
has body: toArray failing is only one symptom of you doing something fundamentally dangerous. From the documentation of LinkedList: If multiple threads access a linked list concurrently, and at least one of the threads modifies the list structurally, it must be synchronized externally. You'll either need to add synchronization (not just for toArray, but basically all uses of the list) or use one of the concurrent collections which is designed to be thread-safe.
type: AcceptedAnswer
downvote count: 0
score: 7
type: Answer
accepted answer of: http://stackoverflow.com/q/20944024

http://stackoverflow.com/comment/31348112
type: QuestionComment
comment on: http://stackoverflow.com/q/20888142
type: Comment
has text: http://stackoverflow.com/questions/8752037/how-to-change-background-color-of-jtabbedpane/8752166#8752166
score: 0

http://stackoverflow.com/comment/31465004
score: 0
type: AnswerComment
has text: If that answered your question could you +1 the answer?
type: Comment
comment on: http://stackoverflow.com/a/20943069

executable-jar
tags question: http://stackoverflow.com/q/20897544
tags question: http://stackoverflow.com/q/20965106
tag name: executable-jar
type: Tag

http://stackoverflow.com/a/35980827
type: Answer
has body: Before installing the New Relic the code will fetch the requisite environment parameters like JAVA_HOME, TOMCAT_HOME, etc ( depends on your configuration) and then install the agent on your server. Make sure all the required env variables are defined. After you have done the above, also check the following: a) The New Relic should be extraced/installed in your home directory ( in my case /APP) cd /APP Unzip newrelic-java-3.26.1.zip –d /APP b) The Java agent should be defined in the local properties file ( I have configured it for Hybris server in Dev environment) vim /APP/hybris/config/local.properties Add : -javaagent:/APP/newrelic/newrelic.jar –D newrelic.environment=Development c) In some cases, it requirs the application specific yml file along with the newrelic.yml file ( in my case hybris.yml) Cd /APP/newrelic mkdir extensions chmod 755 extensions cd /APP/newrelic/extensions vim hybris.yml Hybris specific configuration for the hybris.yml file ( use jmx.yml) Add the jmx.yml data in the hybris.yml after creating the file. d) Restart your application: I did it using the following commands: cd /APP/hybris/bin/platform ant clean all e) You should see the data in sometime. Keep monitoring the new relic logs in: tail -f /APP/newrelic/logs/newrelic_agent.log
score: 0
answers question: http://stackoverflow.com/q/20852811

http://stackoverflow.com/q/20873435
has title: Randomize Array of numbers 1 through 100
has answer: http://stackoverflow.com/a/20873459
tagged with: math
possible better answer: http://stackoverflow.com/a/20873449
has answer: http://stackoverflow.com/a/20873449
tagged with: random
tagged with: arrays
downvote count: 0
accepted answer: http://stackoverflow.com/a/20873652
has body: I'm trying to create a program to create an array of the numbers 1 through 100 and then randomize them. So far I have this, but don't know what to do next: public class Random100Array { public static void main(String args[]) { { int[] nums = new int[100]; char current; int a; for (int i = 0; i &lt;= nums.length; i++) { nums[i] = i + 1; } for (int i1 = 0; i1 &lt;=nums.length; i1++) { double random = (Math.random() * 100) + 1; } } } } Also, THIS ISN'T HOMEWORK. I am a student and I'm currently on winter break. This program gives me this output for some reason. What am I doing wrong? Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 100 at Random100Array.main(Random100Array.java:11)
favorite count: 0
has comment: http://stackoverflow.com/comment/31321138
has comment: http://stackoverflow.com/comment/31321292
linked to: http://stackoverflow.com/q/1519736
has comment: http://stackoverflow.com/comment/31321307
answer count: 4
tagged with: integer
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20873481
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/20873652
type: Question

http://stackoverflow.com/q/20906302
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31383781
has comment: http://stackoverflow.com/comment/31381867
tagged with: tomcat
has comment: http://stackoverflow.com/comment/31381846
has comment: http://stackoverflow.com/comment/31382104
has comment: http://stackoverflow.com/comment/31383311
has comment: http://stackoverflow.com/comment/31381830
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20907402
has body: I have written a web application which takes input from the user via a web form and based on that inputs changes a particular html file and creates a new one and saves it in webContent folder of dynamic Web Project.I have a sample.txt file also put into that folder but its not created in the code its something placed for testing.It gets downlaoded as needed but the created HTML file gives a 500 error with Null pointer exception in reading the bytes in the code. The snippet is as follows String filepath = "/Users/schhatre13/Documents/workspace/CustomHTMLTool/WebContent/"+"customHTML.html"; File downloadedFile = new File(filepath); BufferedWriter bw = new BufferedWriter(new FileWriter(downloadedFile)); bw.write(html); bw.close(); response.setContentType("text/html"); response.setHeader("Content-Disposition", "attachment;filename=customHTML"+new Date()+".html"); ServletContext ctx = getServletContext(); InputStream is = ctx.getResourceAsStream("/customHTML.html"); int read=0; //i++; byte[] bytes = new byte[BYTES_DOWNLOAD]; OutputStream os = response.getOutputStream(); while((read = is.read(bytes))!= -1){ os.write(bytes, 0, read); } os.flush(); os.close(); The error thrown is a 500 Internal Server error. java.lang.NullPointerException HTMLCustomizer.doGet(HTMLCustomizer.java:160) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:723) This is in the line while((read = is.read(bytes))!= -1){ i.e the Null poinnter exception. I don't understand the problem because my manually placed .txt file gets downloaded as required. Thanks Swaraj
tagged with: java
has comment: http://stackoverflow.com/comment/31381777
has comment: http://stackoverflow.com/comment/31381819
type: Question
has title: 500 error:HTML created in coded not getting downloaded in servlet
has comment: http://stackoverflow.com/comment/31381942
has comment: http://stackoverflow.com/comment/31381957
has comment: http://stackoverflow.com/comment/31381809
tagged with: servlets
accepted answer: http://stackoverflow.com/a/20907402

http://stackoverflow.com/comment/31506165
comment on: http://stackoverflow.com/q/20971249
type: Comment
type: QuestionComment
has text: if remote server is closed, in.available maybe get -1, then the code go into infinite loop. you can try to print in.available value to log.
score: 0

http://stackoverflow.com/q/20890980
accepted answer: http://stackoverflow.com/a/20891153
has comment: http://stackoverflow.com/comment/31353682
score: 0
has answer: http://stackoverflow.com/a/20891085
has body: I use a filewriter to write an arraylist of objects to a file, as strings, in a kind- of CSV like format. Anyway I had problems getting it to work, but now I get a FileNotFound exception and it says the file created is read-only in the exception. The file is created, as I checked, but apparently cannot be written to. However I actually want to overwrite the contents anyway, but get this error. ///Like a CSV file. try{ FileWriter writer_file = new FileWriter("PeopleDetailsFile"); String filestring = ""; ///initializes filestring, which is written to the file. for(PeopleDetails person : peopledetails_file){ String person_detail_string = ""; person_detail_string = person.name + "," + person.number; filestring = filestring + person_detail_string + ";"; } writer_file.write(filestring); writer_file.close(); } catch (IOException e) { Log.e("ERROR", e.toString()); }finally{ ///Hopefully won't get an error here. Intent switch_menu = new Intent(this, MenuList.class); startActivity(switch_menu); }
has answer: http://stackoverflow.com/a/20891114
has title: Filewriter creates a file that is read-only
answer count: 5
has comment: http://stackoverflow.com/comment/31354066
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20891211
tagged with: java
has answer: http://stackoverflow.com/a/20891082
tagged with: filewriter
has comment: http://stackoverflow.com/comment/31353735
tagged with: file
has answer: http://stackoverflow.com/a/20891153
possible better answer: http://stackoverflow.com/a/20891211
type: Question
has comment: http://stackoverflow.com/comment/31354395

http://stackoverflow.com/comment/31356619
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20891281
type: Comment
has text: okay yes thanks.. still not sure how to read from a port without an event change :-\

http://stackoverflow.com/q/21002032
score: -1
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31562535
has comment: http://stackoverflow.com/comment/31562194
has answer: http://stackoverflow.com/a/21002078
favorite count: 0
tagged with: arraylist
has answer: http://stackoverflow.com/a/21002871
accepted answer: http://stackoverflow.com/a/21002871
has title: Use of an ArrayList of HashMaps
downvote count: 2
upvote count: 1
type: AnsweredQuestion
tagged with: hashmap
has body: Could someone tell me what is wrong with the code below? When I run the code below the first line after the try { produces the following error : "java.lang.IndexOutOfBoundsException: Index: 0, Size: 0" public static class ASIFFile { private ArrayList&lt;HashMap&lt;String,String&gt;&gt; data; private static int currRec = 0; //assign each record a numeric id based on this figure. // Method for reading ADIFfile public ArrayList&lt;HashMap&lt;String,String&gt;&gt; ReadASIFfile (File DataFile) { data = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(500); try { HashMap&lt;String, String&gt; temp = new HashMap&lt;String,String&gt;(10); data.set(currRec, temp); (data.get(currRec)).put("recID", Integer.toString(currRec));//give the record a numeric ID ...
tagged with: java
possible better answer: http://stackoverflow.com/a/21002078

http://stackoverflow.com/a/20962898
has body: A better way to make you algorithm more efficient is to reuse to save the calculation. For a string S=S[0]S[1]S[2]...S[n-1], you want to get all the integer values for each k-length substring, a better way is to reuse. That is if we have known the integer value of S[0]S[1]...S[k-1], suppose it is V1, then you want to calculate S[1]S[2]...S[k], an efficient way to get the value by V2=(V1-10^k*(S[0]-'0'))*10 + (S[k]-'0'). Of course, you can also optimize I/O operations.
answers question: http://stackoverflow.com/q/20932247
score: 0
type: Answer

http://stackoverflow.com/comment/31301539
score: 0
type: QuestionComment
has text: thank you for your help. I tried a lot of things but I just can't figure out the reason... As I said I am following this tutorial: https://github.com/mattdesl/lwjgl-basics/wiki/LibGDX-Finger-Swipe and everything works great so far except the thing that the front of the arrow (swipe track) is connected with the end of it... it looks like this: http://dec.imghost.us/y6O5.png My points are calculated the exactly same way as in the tutorial and the order is correct. I am working with andengine by the way but I doubt that the problem is related to the engine. I appreciate your help, any ideas more?
type: Comment
comment on: http://stackoverflow.com/q/20861508

http://stackoverflow.com/q/21017420
score: 0
accepted answer: http://stackoverflow.com/a/30267142
has comment: http://stackoverflow.com/comment/31985418
has answer: http://stackoverflow.com/a/30267142
tagged with: jsf
has title: How to @Autowire a BeanFactory in a Managed Bean(JSF)
tagged with: spring
type: Question
has body: When I need a BeanFactory in a bean managed by Spring, I use: private @Autowired BeanFactory factory; How can I achive this in a Managed Bean? I have tried: @ManagedProperty(value = "#{BeanFactory}") private BeanFactory beanFactory;// (the property has getters and setters) But the property is null. I have an EL resolver in faces-config: &lt;el-resolver&gt; org.springframework.web.jsf.el.SpringBeanFacesELResolver &lt;/el-resolver&gt; Thank you and sorry for my poor english :)
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31985289
has comment: http://stackoverflow.com/comment/31592091
tagged with: java
has comment: http://stackoverflow.com/comment/36110026
tagged with: jsf-2
answer count: 1

http://stackoverflow.com/q/20965465
downvote count: 1
tagged with: ip
has body: I used InetAddress for getting IP Address. This is my code String hostname=args[0]; try { InetAddress ipaddress= InetAddress.getByName(hostname); System.out.println("IPADDRESS" +ipaddress.getHostAddress()); } catch (UnknownHostException e) { // TODO Auto-generated catch block System.out.println("Could not find anything" +hostname); } But in the console Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at com.networking.ipaddress.IP.main(IP.java:11) What's the problem actually ? Problem with the code or system?
tagged with: java
has answer: http://stackoverflow.com/a/20965684
has title: ERROR : IP Adrress of the system using JAVA
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31494807
upvote count: 0
has comment: http://stackoverflow.com/comment/31494804
favorite count: 0
tagged with: sockets
has answer: http://stackoverflow.com/a/20965662
score: -1
type: UnansweredQuestion

http://stackoverflow.com/q/20981149
type: Question
has body: I'm working on custom printing module for our application. Printging with code below on windows 7 is working well. When I've got 8pages tiff file, it generates 12MB spool. But when I execute this code on windows XP it generates spool with size something about 300MB and printing takes long time. Please can somebody tell me how can I speed it up, or is there some workaround for this? thanks public class TIFFPrintPage implements Printable { private static final SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss.SSS"); private RenderedImage page; public TIFFPrintPage(RenderedImage page) { this.page = page; } @Override public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException { if (page != null) { // convert to a BufferedImage since I cannot write a RenderedImage for some reason BufferedImage good = new BufferedImage(page.getWidth(), page.getHeight(), BufferedImage.TYPE_INT_ARGB); Graphics2D g2dtemp = (Graphics2D) smaller.getGraphics(); g2dtemp.drawRenderedImage(page, new AffineTransform()); Graphics2D g2d = (Graphics2D) graphics; g2d.translate(pageFormat.getImageableX(), pageFormat.getImageableY()); g2d.drawImage(smaller, 0, 0, smaller.getWidth(), smaller.getHeight(), null); g2d.dispose(); good.flush(); return Printable.PAGE_EXISTS; } else { return Printable.NO_SUCH_PAGE; } } public static void main(String[] args) throws IOException, PrinterException { PrintService service = PrintServiceLookup.lookupDefaultPrintService(); PrinterJob printerJob = PrinterJob.getPrinterJob(); printerJob.setPrintService(service); PageFormat pf = PrinterJob.getPrinterJob().defaultPage(); Paper paper = new Paper(); paper.setSize(595.275591, 841.889764); // width, height A4 format paper.setImageableArea(0, 0, paper.getWidth(), paper.getHeight()); pf.setPaper(paper); SeekableStream s = new FileSeekableStream("c:/test3.tiff"); TIFFDecodeParam param = null; ImageDecoder dec = ImageCodec.createImageDecoder("tiff", s, param); Book book = new Boo…
score: 0
tagged with: printing
has title: Java print on Windows XP generating big spool file
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31524495
has comment: http://stackoverflow.com/comment/31524363
answer count: 0
tagged with: java
tagged with: windows-xp

http://stackoverflow.com/a/20911412
downvote count: 0
has body: int x[] - A 1 dimensional array of integers called x. A 2d array is simply an array of arrays, so the foreach loop here is saying: "for every 1 dimiensional integer array contained in practice, temporarily store refer to that array as x do whatever activity is contained in the braces."
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/20911338

http://stackoverflow.com/q/20913780
score: 0
has comment: http://stackoverflow.com/comment/31397317
tagged with: http://stackoverflow.com/tag/html
answer count: 1
duplicate of: http://stackoverflow.com/q/10247508
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/10247508
has title: Show text instead of "value" value using JSP
duplicate of: http://stackoverflow.com/q/1085801
type: Question
has body: I have created a webapp using servlet and jsp where I have a dropdown tag in html as below text1 text2 how can I access a TEXT not VALUE from select box using javascript? so I can display text1 or text2 instead of 1 & 2, in my webapp. I tried doing this, but it always gives me the "value" text not the option text? <% String checkText= request.getParameter("select1"); %>
linked to: http://stackoverflow.com/q/1085801
tagged with: jsp
has answer: http://stackoverflow.com/a/20913998
accepted answer: http://stackoverflow.com/a/20913998
tagged with: javascript
tagged with: servlets

http://stackoverflow.com/comment/31451885
type: AnswerComment
has text: @HotLicks - true, but if that were the case, the OP probably would have guessed what it was.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20942433

http://stackoverflow.com/q/20861605
upvote count: 0
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/31298293
has comment: http://stackoverflow.com/comment/31322709
favorite count: 0
score: -1
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20862289
tagged with: java
has body: I'm pretty new to Spring MVC and need to display contents of local folder (could be NAS too) in browser. The folder has PDF files, which I want to list as URL's. On clicking any of them I should be able to view the file in question in PDF reader. My application server is Tomcat. On running the app I can see the files as hyperlinks, but on clicking it gives HTTP 404. I think I'm missing out on some configuration somewhere. I've tried all possible settings and even searched for quite some time, but haven't got it to work yet. Can someone kindly let me know where I'm going wrong or what I could be missing? My dispatcher-servlet.xml looks like this: <context:component-scan base-package="com.springapp.mvc"/> <property name="prefix" value="/WEB-INF/pages/"/> <property name="suffix" value=".jsp"/> Web.xml: mvc-dispatcher org.springframework.web.servlet.DispatcherServlet 1 mvc-dispatcher / index.jsp: <c:if test="${not empty dir}"> <c:forEach var="listValue" items="${dir}"> <%-- ${listValue} --%> <%-- ${listValue} --%> <a href="<c:url value="${listValue}"/>">${listValue} </c:forEach> </c:if> and the controller class: @Controller @RequestMapping("/") public class DirListController extends AbstractController { private File[] getPdfFileListing() { File dir = new File("//Users//username//Documents"); // current directory return dir.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.toLowerCase().endsWith(".pdf"); } }); } @Override @RequestMapping(method = RequestMethod.GET) protected ModelAndView handleRequestInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { //return back to index.jsp File[] files = getPdfFileListing(); ModelAndView model = new ModelAndView("index"); model.addObject("dir", files); return model; } }
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/20862289
has title: Accessing local/shared drive with Spring MVC

http://stackoverflow.com/a/20960154
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20956537
type: Answer
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/20956537
has body: You should just be able to add a @Qualifier to the field that is being autowired - setting the value to the id of the Session that was looked up in JNDI. For example: public class BeanThatNeedsContactMailSession { @Autowired @Qualifier("contactMailSession") private Session mailSession; } And public class BeanThatNeedsSignupMailSession { @Autowired @Qualifier("signupMailSession") private Session mailSession; } Etc.

http://stackoverflow.com/a/21002591
has body: On button click: String set = youreditText.getText().toString(); yourtextView.setText(set); EditText, even if the inputType is in number, will only give you the keyboard configuration for number. You will always need to getText().toString() to get the input.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21002479

http://stackoverflow.com/comment/31318476
comment on: http://stackoverflow.com/q/20871605
score: 0
has text: Each instance of the Tank object has a boolean[] keysPressed array. When A, D or W is pressed, the keysPressed of Tank2 is manipulated, and when LEFT, RIGHT or UP is pressed, the keysPressed of Tank1 is manipulated. I don't think that's the problem. Thanks for trying to help, any more ideas? :\
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20977468
has answer: http://stackoverflow.com/a/20977534
type: UnansweredQuestion
tagged with: sockets
score: 3
downvote count: 0
has body: I am sending MultiPart content to my remote server to store it in filesystem. For this I am using Java TCP/IP protocol. For avoiding network bandwidth and TCP Input / Output buffer memory , I am sending the data in GZIP compressed format. But , I cannot decompress the data received from the client. I got Unexpected end of ZLIB input stream Exception. Its due to the server is receiving data in chunks. Java Code Client OutputStream out = new GZIPOutputStream(sock.getOutputStream()); byte[] dataToSend = FileUtil.readFile(new File("/Users/bharathi/Downloads/programming_in_go.pdf")); out.write(dataToSend); Server out = new FileOutputStream("/Users/bharathi/Documents/request_trace.log"); InputStream in = new GZIPInputStream(clntSocket.getInputStream()); int totalBytesRead = 0; int bytesRead; byte[] buffer = new byte[BUFFER_SIZE]; while ((bytesRead = in.read(buffer)) != -1) { out.write(buffer , 0 , bytesRead); totalBytesRead += bytesRead; } Is there any solution to send the data in GZIP compressed format in Socket?
tagged with: tcp
tagged with: java
has answer: http://stackoverflow.com/a/20980069
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31517128
upvote count: 3
linked to: http://stackoverflow.com/q/6173920
has title: TCP Socket send data in GZIP Compression format
favorite count: 0

http://stackoverflow.com/comment/31450522
type: AnswerComment
type: Comment
has text: It just might be too dense for the OP to understand.
comment on: http://stackoverflow.com/a/20938771
score: 0

http://stackoverflow.com/comment/31575820
type: QuestionComment
score: 2
has text: (One odd thing is that you keep focusing on the identical *method* names. It's the identical *class* names that's the problem. Different classes can have identical method names without causing a problem, but you can't (easily) have identical class names.
comment on: http://stackoverflow.com/q/21004983
type: Comment

http://stackoverflow.com/q/20958580
upvote count: 1
type: Question
tagged with: ajp
accepted answer: http://stackoverflow.com/a/20961649
answer count: 3
has answer: http://stackoverflow.com/a/20961229
tagged with: apache
downvote count: 0
score: 1
tagged with: tomcat
favorite count: 0
possible better answer: http://stackoverflow.com/a/20961229
has answer: http://stackoverflow.com/a/20958861
type: AnsweredQuestion
has body: I have a VPS where I want to install a web application for production. Currently, it works on Tomcat 6 connected through Apache Server using AJP module. Every thing works ok, but I want to know if it is a good idea to configure Tomcat as the main web server due we gonna run only JSP applications. FYI: the server must handle https requests. Thanks in advance.
has answer: http://stackoverflow.com/a/20961649
tagged with: java
has title: Which one is the better configuration: Tomcat only OR Apache Server + Tomcat?

http://stackoverflow.com/q/20960947
accepted answer: http://stackoverflow.com/a/20961339
score: 0
tagged with: android
has body: Trying to change the text on a button after it being pressed inside onClick() from XML. But the text wont update after the method is run, only after I click the button ones again it updates to the new text. I have tried running it using runOnUiThread(), but it acts the same. Anyone knows why? Code: public void setLabel(View v) { v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY); final EditText input = new EditText(this); new AlertDialog.Builder(this) .setMessage("Add label:") .setView(input) .setPositiveButton("Set", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { if (input.getText() == null || input.getText().toString().length() == 0) { Toast.makeText(AlarmDialog.this, Html.fromHtml("&lt;i&gt;" + getString(R.string.label_reset) + "&lt;i&gt;"), Toast.LENGTH_SHORT).show(); labelSet = false; } else { alarmLabel = input.getText().toString(); labelSet = true; Toast.makeText(AlarmDialog.this, Html.fromHtml("&lt;b&gt;" + getString(R.string.label_set) + "&lt;b&gt;"), Toast.LENGTH_SHORT).show(); } } }) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { Toast.makeText(AlarmDialog.this, Html.fromHtml("&lt;i&gt;" + getString(R.string.label_not_set) + "&lt;i&gt;"), Toast.LENGTH_SHORT).show(); } }).create().show(); Button button = (Button) v; if (labelSet) button.setText(R.string.label_set); else button.setText(R.string.label); } XML: &lt;Button android:id="@+id/label_button" android:layout_height="fill_parent" android:layout_width="0dp" android:layout_weight="1" android:text="@string/label" android:onClick="setLabel" style="@android:style/Widget.Holo.Button.Borderless" android:padding="8dp"/&gt;
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/20961339
has comment: http://stackoverflow.com/comment/31486930
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20961314
tagged with: java
has title: Android Button text not updating on onClick
type: Question
possible better answer: http://stackoverflow.com/a/20961314
answer count: 2
has comment: http://stackoverflow.com/comment/31487287

http://stackoverflow.com/comment/31556604
type: QuestionComment
comment on: http://stackoverflow.com/q/20998793
has text: You need to synchronize on the object on which you then call `notify()` and `wait()`. In your case, you are calling `this.wait()` so you need to be `synchronized` on `this`.
score: 0
type: Comment

http://stackoverflow.com/q/20899977
score: 14
type: AnsweredQuestion
upvote count: 14
has answer: http://stackoverflow.com/a/20900045
tagged with: java
tagged with: mysql
possible better answer: http://stackoverflow.com/a/58060022
has title: What and when should I specify setFetchSize()?
type: Question
has answer: http://stackoverflow.com/a/58060022
accepted answer: http://stackoverflow.com/a/20900045
has comment: http://stackoverflow.com/comment/31370159
has body: I see a lot of "best practices" guides for JDBC/MySQL that tells me to specify setFetchSize(). However, I have no idea when to specify, and what(statement, result set) to specify. Statement.setFetchSize() or PreparedStatement.setFetchSize() ResultSet.setFetchSize() Of these two, what should I specify? From javadoc and oracle documentation, this is where I get confused about "when" Javadoc The default value is set by the Statement object that created the result set. The fetch size may be changed at any time. Oracle Doc Changes made to the fetch size of a statement object after a result set is produced will have no affect on that result set. Please correct me if I am wrong. Does this mean that setFetchSize is only Affective before a query is executed?(Therefore, setFetchSize on a ResultSet is useless? But happens to "The fetch size may be changed at any time"?)
answer count: 2
tagged with: sql
downvote count: 0
favorite count: 0
tagged with: oracle-database
linked to: http://stackoverflow.com/q/26046234
tagged with: jdbc
has comment: http://stackoverflow.com/comment/55366672
has comment: http://stackoverflow.com/comment/31370734

http://stackoverflow.com/q/20947806
tagged with: nullpointerexception
score: 9
possible better answer: http://stackoverflow.com/a/20948794
has answer: http://stackoverflow.com/a/20948794
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/4496770
has title: How can I call from one servlet file to another servlet file?
has comment: http://stackoverflow.com/comment/31460899
tagged with: java
has answer: http://stackoverflow.com/a/20947869
upvote count: 10
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/3024949
tagged with: servlets
answer count: 2
accepted answer: http://stackoverflow.com/a/20947869
duplicate of: http://stackoverflow.com/q/3024949
tagged with: jsp
has body: I am using net beans 7.1 and I create one JSP file with two servlet files. like: index.jsp --->servlet1.java --->servlet2.java I give some value from index.jsp file and send to servlet1.java. In this servlet1.java file I call servlet2.java file. Then it throws NullPointerException. How can I solve this? My code like this: index.jsp servlet1.java @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { .................. .................. .................. servlet2 ob=new servlet2(); ob.doPost(request, response); .................. .................. .................. } Then it throws NullPointerException.
favorite count: 0

http://stackoverflow.com/q/20920205
has answer: http://stackoverflow.com/a/20920573
tagged with: java
answer count: 3
upvote count: 1
has body: problem I'm writing a data processing app in java for my raspberry-pi. I'm using postgresql, hibernate and tomcat. My app is designed for minimal memory usage (because of the limitations of the raspberry-pi) but java is claiming all memory. How can i instruct the JVM to use ONLY the memory required. algorithm To prcess each data item I take the following steps: - retrieve object from table (reference object) - for each object in the table: -- retrieve the object -- compare to reference if test is valid store new object in a second table -- destroy objects The JVM by default is not releasing memory but claiming more and more memory progressively. question What JVM options can I use? And What programming stratgies can I use?
has comment: http://stackoverflow.com/comment/31408694
tagged with: raspberry-pi
downvote count: 0
type: UnansweredQuestion
tagged with: tomcat
has answer: http://stackoverflow.com/a/20956208
score: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/20921345
has title: How do I keep memory used by JVM under control?

http://stackoverflow.com/a/20953485
accepted answer of: http://stackoverflow.com/q/20953459
downvote count: 0
has body: You have to declare the lijst[] outside of the loop and fill the array within the loop: String lijst[] = new String[templateLijst.length]; for(int i = 0; i &lt; templateLijst.length; i++){ lijst[i] = templateLijst[i][0]; } return lijst;
has comment: http://stackoverflow.com/comment/31471793
type: AcceptedAnswer
score: 4
has comment: http://stackoverflow.com/comment/31471770
answers question: http://stackoverflow.com/q/20953459
type: Answer
upvote count: 4

http://stackoverflow.com/a/20953266
score: 0
answers question: http://stackoverflow.com/q/20891281
type: Answer
has body: Thanks Jim-- you are absolutely right about just sending a query string and receiving a reply. Very simple! The answer for my question depends on the manufacturer and what string I needed to send to my device. Somehow I had overlooked this in the manual. Now I am able to "poll" the device to have its current state returned. Simple answer! Thanks for all the help.

http://stackoverflow.com/comment/31507816
comment on: http://stackoverflow.com/a/20972181
score: 1
type: AnswerComment
has text: His code is writing to the file the system using the default encoding. This one is making sure that it is written in UTF-8. I don't know if the linebreaks on his system are being set to `\n` or `\r\n`, if it is the first option fine, my code will work like a charm, if not he will have to use the strategy to replace line breaks suggested on my first comment. About why the main method is working and the other isn't, maybe on his original application the default encoding is being set somehow. See: http://stackoverflow.com/questions/361975/setting-the-default-java-character-encoding
type: Comment

http://stackoverflow.com/a/20967747
answers question: http://stackoverflow.com/q/20967693
has comment: http://stackoverflow.com/comment/31498868
type: Answer
downvote count: 0
score: 1
has body: You get the UnsupportedClassVersionError when you are trying to run an application having a jar in the classpath that is built using a newer version than the one you are using at runtime.
upvote count: 1
has comment: http://stackoverflow.com/comment/31498837

http://stackoverflow.com/q/20881381
favorite count: 0
upvote count: 0
has comment: http://stackoverflow.com/comment/31335381
has answer: http://stackoverflow.com/a/20881451
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31335359
has answer: http://stackoverflow.com/a/20881420
has body: Is there away to have an ArrayList built on a String that the user entered and check if it contains any letters at all? For example: [1, 2, +, 4, 5, /] would return true [1, 2, b] would return false
has comment: http://stackoverflow.com/comment/31335355
has comment: http://stackoverflow.com/comment/31335335
tagged with: java
score: -1
has title: Check if ArrayList contains any letters
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31345748
tagged with: string
has comment: http://stackoverflow.com/comment/31335610
tagged with: arraylist
downvote count: 1

http://stackoverflow.com/comment/31441046
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20937064
has text: In my .txt file i write and read a List-Object, which is constantly chaning his content.
score: 0

http://stackoverflow.com/comment/31546986
comment on: http://stackoverflow.com/a/20993226
score: 0
type: Comment
has text: I added `System.out.println(EventQueue.isDispatchThread());` to the `paintComponent` method and it always prints `true`, test using Java 7 on Mac OSX
type: AnswerComment

http://stackoverflow.com/q/20973786
tagged with: applet
has body: My requirement is to draw a graph using a co-ordinate system which I am currently doing using java applets and AWT graphics package. I need to export the diagram drawn as a pdf file? Is there anyway to do it using the graphics package itself or is there any other way out. I am using the following code to create the diagram public class Draw extends Applet{ public void paint(Graphics g){ g.drawRect(10,10,50,100); g.drawRect(100,100,50,50); } } Can the output of this code be saved as a pdf? Additionally can the scale for Graphics2D be set to mm instead of pixels? I am not sure if manual conversion is good enough, because extreme precision would be necessary. Thanks in advance.
has comment: http://stackoverflow.com/comment/31510960
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31510685
accepted answer: http://stackoverflow.com/a/20974436
tagged with: java
type: Question
tagged with: graphics
tagged with: 2d
has title: Export a diagram drawn using applet and graphics as pdf
score: 0
has comment: http://stackoverflow.com/comment/31509932
has comment: http://stackoverflow.com/comment/31510180
tagged with: http://stackoverflow.com/tag/pdf
answer count: 1
has answer: http://stackoverflow.com/a/20974436

http://stackoverflow.com/comment/31406428
score: 0
type: QuestionComment
has text: I'm pretty sure it doesn't crash, but throws an exception, which comes with a stack trace. Read it and post it.
type: Comment
comment on: http://stackoverflow.com/q/20918967

http://stackoverflow.com/comment/31433098
score: 0
type: Comment
type: QuestionComment
has text: [What have you tried?](http://www.whathaveyoutried.com/) Showing your effort will encourage others to help.
comment on: http://stackoverflow.com/q/20932930

http://stackoverflow.com/q/20915170
answer count: 1
type: UnansweredQuestion
tagged with: android
tagged with: http://stackoverflow.com/tag/html
has body: The user clicks in one spot and releases in another. I use the where the click started and where it ends to make two coordinates. This is how I get the width and the height of the rectangle i want to make so that all parameters of the drawRect() method are met. I want to make the rectangle they made to appear on the screen. It shows the width and height but doesn't create the rectangle. import java.awt.*; import java.awt.event.*; import java.applet.*; import javax.swing.Timer; @SuppressWarnings("serial") public class PracticeClass extends Applet implements MouseListener, ActionListener, KeyListener { int x, y, velX, velY, Width, Height, x2, y2; String tracer, tracer2, tracer3; Timer tm = new Timer(4, this); public PracticeClass() { tm.start(); setFocusable(true); setSize(900, 900); setFocusTraversalKeysEnabled(false); addKeyListener(this); addMouseListener(this); } public void mousePressed(MouseEvent e){} public void mouseClicked(MouseEvent e) { x = e.getX(); y = e.getY(); tracer = " x = " + x + " y = " + y; // repaint the applet// repaint(); } public void mouseEntered(MouseEvent e){} public void mouseExited(MouseEvent e){} public void mouseReleased(MouseEvent e) { int x2 = e.getX(); int y2 = e.getY(); int Width = x2 - x; int Height = y2 - y; tracer2 = "Width = " + Width + " Height = " + Height; tracer3 = "X2 = " + x2 + " Y2 = " + y2; repaint(); } // paint method public void paint(Graphics g){ g.drawString(tracer, 0, 20); g.drawString(tracer2, 0, 40); g.drawString(tracer3, 0, 60); g.drawRect(x,y, Width, Height); g.setColor(Color.BLUE); } public void actionPerformed(ActionEvent e) { if (x &lt; 0) { velX = 0; x = 0; } if (x &gt; 470) { velX = 0; x = 470; } if (y &lt; 0) { velY = 0; y = 0; } if (y &gt; 470) { velY = 0; y = 470; } x = x + velX; y = y + velY; repaint(); } public void keyPressed(KeyEvent e) { int c = e.getKeyCode(); if (c == KeyEvent.VK_LEFT) { velX = -1; } if (c == KeyEvent.VK_RIGHT) { velX = 1; } if (c == KeyEvent.VK_UP) { velY = -1; } if (c == KeyEvent…
tagged with: css
has answer: http://stackoverflow.com/a/20915238
has title: Making a rectangle the user makes appear on the screen
type: Question
tagged with: java
score: 0

http://stackoverflow.com/q/20996494
upvote count: 1
linked to: http://stackoverflow.com/q/18453516
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/8875818
favorite count: 0
type: UnansweredQuestion
tagged with: spring
has body: First of all, I have to say, that I've read all (at least a lot :)) questions here and on primefaces forums about fileuploader issues. My configuration: Primefaces 4 JSF 2.2 Spring Apache Tomcat 7 Maven I am converting a richfaces project to primefaces, and I'm stuck with a fileUpload component that is not calling the handler method. I have tried (altough I know that from Primefaces 4 it is not necessary) putting filters in the web.xml. I've also tried without filters. I have spring security filters and a language filter among some others, but the PF was first. I've also tried setting the dispatcher to FORWARD. I have all the needed dependecies in Maven (commons - I know that from version 4 it is not required, but nevertheless I tried) The xhtml part: &lt;h:form enctype="multipart/form-data"&gt; ... /* not relevant code here */ ... &lt;p:graphicImage value="#{systemParamsController.image}" id="logo" /&gt; &lt;p:fileUpload fileUploadListener="#{systemParamsController.listener}" fileLimit="1" allowTypes="/(\.|\/)(gif|jpe?g|png)$/" uploadLabel="#{msg['button.upload.jpg']}" cancelLabel="#{msg['button.cancel']}" invalidFileMessage="alert('#{msg['upload.invalidtype']}');" update="logo" mode="advanced"&gt; &lt;/p:fileUpload&gt; &lt;p:growl id="messages" showDetail="true" /&gt; &lt;/h:panelGrid&gt; &lt;/h:panelGroup&gt; &lt;p:commandButton value="#{msg['button.save']}" onclick="this.disabled=true" oncomplete="this.disabled=false" action="#{systemParamsController.save}" styleClass="qs-button" ajax="false" /&gt; &lt;/h:panelGrid&gt; &lt;/p:panel&gt; &lt;/center&gt; &lt;/h:form&gt; The backing bean: public synchronized void listener(FileUploadEvent event) throws Exception { logger.debug("uploadListener!"); UploadedFile item = event.getFile(); getModel().getCustomer().setLogo(imageResizer.doResize(item.getContents(), 30, Side.HEIGHT)); } If I click on choose, I can select a file, but after that nothing happens. The handler is not called, because there is no log message, the upl…
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31553473
tagged with: primefaces
has comment: http://stackoverflow.com/comment/31555309
tagged with: jsf-2.2
has answer: http://stackoverflow.com/a/32656851
duplicate of: http://stackoverflow.com/q/8875818
has title: Primefaces 4 fileUpload handler not called

http://stackoverflow.com/a/43849926
has body: Related to getText() I have also an issue and I resolved so: WebElement errMsg; errMsg = driver.findElement(By.xpath("//div[@id='mbr-login-error']")); WebElement parent = driver.findElement(By.xpath("//form[@id='mbr-login-form']")); List&lt;WebElement&gt; children = parent.findElements(By.tagName("div")); System.out.println("Size is: "+children.size()); //((JavascriptExecutor)driver).executeScript("arguments[0].scrollIntoView(true);", children); for(int i = 0;i&lt;children.size();i++) { System.out.println(i + " " + children.get(i).getText()); } int indexErr = children.indexOf(errMsg); System.out.println("index " + indexErr); Assert.assertEquals(expected, children.get(indexErr).getText()); None of the above solutions worked for me.
answers question: http://stackoverflow.com/q/20888592
score: 0
type: Answer

http://stackoverflow.com/comment/31370217
has text: Thx Blaise, it doesn't seem to work. I get the following output : <params/> . I'm using the last stable version of MOXy (2.5.1)
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/20886297

image
tags question: http://stackoverflow.com/q/20897387
tags question: http://stackoverflow.com/q/20948338
tags question: http://stackoverflow.com/q/20872771
tags question: http://stackoverflow.com/q/21017828
tags question: http://stackoverflow.com/q/20963366
tags question: http://stackoverflow.com/q/20995005
tags question: http://stackoverflow.com/q/20886415
tags question: http://stackoverflow.com/q/20908262
tags question: http://stackoverflow.com/q/21002434
tags question: http://stackoverflow.com/q/21000894
tags question: http://stackoverflow.com/q/21005466
tags question: http://stackoverflow.com/q/20935999
tags question: http://stackoverflow.com/q/20880587
tags question: http://stackoverflow.com/q/20986525
tags question: http://stackoverflow.com/q/20958360
tags question: http://stackoverflow.com/q/20862521
tags question: http://stackoverflow.com/q/20956770
tags question: http://stackoverflow.com/q/20961065
tags question: http://stackoverflow.com/q/20995332
tags question: http://stackoverflow.com/q/20911130
tags question: http://stackoverflow.com/q/21010464
tags question: http://stackoverflow.com/q/20966201
tags question: http://stackoverflow.com/q/20949383
tags question: http://stackoverflow.com/q/20852837
tags question: http://stackoverflow.com/q/20879639
tags question: http://stackoverflow.com/q/20894280
tags question: http://stackoverflow.com/q/20863564
tags question: http://stackoverflow.com/q/20975217
tags question: http://stackoverflow.com/q/20983608
tag name: image
tags question: http://stackoverflow.com/q/20952076
tags question: http://stackoverflow.com/q/20937713
tags question: http://stackoverflow.com/q/20976801
tags question: http://stackoverflow.com/q/20875763
tags question: http://stackoverflow.com/q/20866725
tags question: http://stackoverflow.com/q/20959796
tags question: http://stackoverflow.com/q/20876861
tags question: http://stackoverflow.com/q/20986833
tags question: http://stackoverflow.com/q/20861411
tags question: http://stackoverflow.com/q/20898349
type: Tag
tags question: http://stackoverflow.com/q/20949987
tags question: http://stackoverflow.com/q/20979024

http://stackoverflow.com/comment/31430436
score: 1
type: AnswerComment
has text: @smriti3 your use case has nothing to do with this. secondly where are all you tried those? Its simple add it at the beginning of `onClick`.
type: Comment
comment on: http://stackoverflow.com/a/20930420

http://stackoverflow.com/comment/31484322
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20959368
has text: I don't see a problem here c is initialized correctly in the constructor, just get rid of the super(); because its called implicitly by the constructor.

http://stackoverflow.com/q/20935419
upvote count: 1
tagged with: java
tagged with: adt
has answer: http://stackoverflow.com/a/20937552
tagged with: eclipse
has answer: http://stackoverflow.com/a/20935702
possible better answer: http://stackoverflow.com/a/20937552
downvote count: 0
has body: An eclipse plugin called JDTCommentsV2_1.0.9 does the following in eclipse: I'm trying to add/edit some comments inside. e.g. add Run TestComment or just change one of the comments' name. I have the .jar file and here's how it looks inside: Question is which files should i edit and how. Thank you edit: After following @greg449 and @Robin Green's instructions, I exported the jar file to eclipse, and edited the plugins.xml file. But if i export the files now as a jar, it doesn't work (nothing is changed in the menu). Finally i tried what @Robin Green said (Run -> Run As -> eclipse application) but there is no eclipse application under Run As. I got only Java Applet and Java Application. I'm wondering why. Might it be because i'm using ADT? edit2: I downloaded another version of eclipse (not ADT) and here i do have the Run As eclipse application bar". Can't i add it to ADT ? edit3: The picked answer works for eclipse JDT and not eclipse ADT.
tagged with: eclipse-plugin
type: AnsweredQuestion
tagged with: android
accepted answer: http://stackoverflow.com/a/20935702
score: 1
favorite count: 0
has title: How to edit an eclipse plugin?
type: Question
answer count: 2

http://stackoverflow.com/q/21008459
type: Question
has body: I am working on a Http Proxy in java. Basically I have 3 applications: a client application, where I just submit a request to a server VIA a proxy a proxy that captures the request, modifies it and then forwards it to the web server the web server Here is my code for the Client (taken from the apache httpcore examples, but works well): public class ClientExecuteProxy () { public static void main(String[] args)throws Exception { HttpHost proxy = new HttpHost("127.0.0.1", 8080, "http"); DefaultHttpClient httpclient = new DefaultHttpClient(); try { httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); HttpHost target = new HttpHost("issues.apache.org", 443, "https"); HttpGet req = new HttpGet("/"); System.out.println("executing request to " + target + " via " + proxy); HttpResponse rsp = httpclient.execute(target, req); HttpEntity entity = rsp.getEntity(); System.out.println("----------------------------------------"); System.out.println(rsp.getStatusLine()); Header[] headers = rsp.getAllHeaders(); for (int i = 0; i&lt;headers.length; i++) { System.out.println(headers[i]); } System.out.println("----------------------------------------"); if (entity != null) { System.out.println(EntityUtils.toString(entity)); } } finally { // When HttpClient instance is no longer needed, // shut down the connection manager to ensure // immediate deallocation of all system resources httpclient.getConnectionManager().shutdown(); } } } If I do a direct execution of the request to the server (if I comment the line "httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);"), it works without any problem. But if I leave it like that, it will pass by the proxy. Here is the part that I do not know how to handle for the proxy: The proxy listens for the requests, reads its content and verifies if it respects certain policies. If OK it will forward it to the server, else it will drop the request and it will send a HttpResponse with an error. The problem is wh…
has title: Java Proxy: How to extract Destination Host and Port from the HttpRequest?
score: 0
tagged with: java
tagged with: http
has answer: http://stackoverflow.com/a/21008917
answer count: 1
type: UnansweredQuestion
tagged with: proxy

http://stackoverflow.com/comment/44849548
type: Comment
score: 0
comment on: http://stackoverflow.com/a/20920633
type: AnswerComment
has text: I would go further and say that your service layer should not have to change if you switched ORM providers (i.e. went from Hibernate to something else) -- only the DAO layer should need to change.

http://stackoverflow.com/comment/31651959
type: Comment
comment on: http://stackoverflow.com/a/21023816
score: 0
type: AnswerComment
has text: In Atmosphere's web.xml :-)

http://stackoverflow.com/comment/31361724
comment on: http://stackoverflow.com/q/20868388
score: 0
type: Comment
type: QuestionComment
has text: @alex : i have posted code. Please go through it.

http://stackoverflow.com/a/20916875
type: Answer
score: 5
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/20916867
has body: You haven't implemented the required methods for the ActionListener interface. Somewhere in that class, fill it with: @Override public void actionPerformed(ActionEvent e){ // Fill } You have an action(ActionEvent) method, but that is spelled wrong.

http://stackoverflow.com/comment/31283488
type: QuestionComment
has text: Don't use 'quote formatting' for code!
comment on: http://stackoverflow.com/q/20854122
score: 0
type: Comment

http://stackoverflow.com/q/20857963
tagged with: android-activity
has title: calling function of activity from fragment class gives NPE
has body: I have an activity whose parent class is fragment let we call it fragment A, I have another fragment B from where I want to call the function of the activity related to fragment A, How to call this function? I have tried this: Respond and SResponses are the activities whose function am calling.and these function are only called when these activites are in active state. if (Respond.getActivityStatus() == true) { if (Respond.getrthreadid().compareTo(threadid) == 0) { //Respond res = new Respond(); //res.notiffy(message); ((Respond)getActivity()).notiffy(message); } } if (SResponses.getActivityStatus() == true) { if (SResponses.getsrthreadid().compareTo(threadid) == 0) { //SResponses sres = new SResponses(); // sres.notiffy(message); ((SResponses)getActivity()).notiffy(message); } } } } catch (RuntimeException e) { // TODO: handle exception e.printStackTrace(); } } } } catch (RuntimeException e) { // TODO: handle exception e.printStackTrace(); } But its giving me Null pointer exception. Please help.
linked to: http://stackoverflow.com/q/7850583
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31290921
has answer: http://stackoverflow.com/a/20858086
tagged with: android-fragments
tagged with: java
has comment: http://stackoverflow.com/comment/31291506
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/20858043
score: 0
tagged with: nullpointerexception
tagged with: android
has comment: http://stackoverflow.com/comment/31290841
has comment: http://stackoverflow.com/comment/31291525

http://stackoverflow.com/q/20885134
score: 1
has comment: http://stackoverflow.com/comment/31342194
tagged with: java
has comment: http://stackoverflow.com/comment/31342218
has comment: http://stackoverflow.com/comment/31342399
type: Question
has answer: http://stackoverflow.com/a/20885592
has comment: http://stackoverflow.com/comment/31342790
downvote count: 0
accepted answer: http://stackoverflow.com/a/20885592
has title: Microphone Streaming is Not Clear
has comment: http://stackoverflow.com/comment/31342408
tagged with: udp
has body: I'm trying to stream microphone over UDP but my output is so noisy, it's not able to understand the input audio. Here is my code: Server Side: import java.io.DataOutputStream; import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; import java.net.Socket; import java.net.UnknownHostException; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.DataLine; import javax.sound.sampled.Mixer; import javax.sound.sampled.Port; import javax.sound.sampled.TargetDataLine; public class MicPlayer { private static final String IP_TO_STREAM_TO = "localhost" ; private static final int PORT_TO_STREAM_TO = 8888 ; /** Creates a new instance of MicPlayer */ public MicPlayer() { } /** * @param args the command line arguments */ public static void main(String[] args) { Mixer.Info minfo[] = AudioSystem.getMixerInfo() ; for( int i = 0 ; i &lt; minfo.length ; i++ ) { System.out.println( minfo[i] ) ; } if (AudioSystem.isLineSupported(Port.Info.MICROPHONE)) { try { DataLine.Info dataLineInfo = new DataLine.Info( TargetDataLine.class , getAudioFormat() ) ; final TargetDataLine targetDataLine = (TargetDataLine)AudioSystem.getLine( dataLineInfo ) ; targetDataLine.open( getAudioFormat() ); targetDataLine.start(); byte tempBuffer[] = new byte[targetDataLine.getBufferSize() / 5] ; int cnt = 0 ; while( true ) { targetDataLine.read( tempBuffer , 0 , tempBuffer.length ); sendThruUDP( tempBuffer ) ; } } catch(Exception e ) { System.out.println(" not correct " ) ; System.exit(0) ; } } } public static AudioFormat getAudioFormat(){ float sampleRate = 8000.0F; //8000,11025,16000,22050,44100 int sampleSizeInBits = 16; //8,16 int channels = 1; //1,2 boolean signed = true; //true,false boolean bigEndian = false; //true,false return new AudioFormat( sampleRate, sampleSizeInBits, channels, signed, bigEndian ); } public static void sendThruUDP( byte soundpacket[] ) { try { DatagramSocket sock =…
answer count: 1
linked to: http://stackoverflow.com/q/4615958
has comment: http://stackoverflow.com/comment/31342076
favorite count: 0
has comment: http://stackoverflow.com/comment/31342855
has comment: http://stackoverflow.com/comment/31342764
has comment: http://stackoverflow.com/comment/31342070
has comment: http://stackoverflow.com/comment/31342733
tagged with: streaming
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31342487

http://stackoverflow.com/comment/91707976
score: 0
type: Comment
has text: this helped me ty
comment on: http://stackoverflow.com/a/43676588
type: AnswerComment

http://stackoverflow.com/q/20952708
has comment: http://stackoverflow.com/comment/31471011
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/20968316
upvote count: 1
downvote count: 1
tagged with: java
tagged with: observable
tagged with: observers
has comment: http://stackoverflow.com/comment/31470964
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20952937
has answer: http://stackoverflow.com/a/20968316
has answer: http://stackoverflow.com/a/20952937
favorite count: 0
has body: I have an Observable class and an Observer class. It is a bit silly, but the method notifyObserver(arg) of my Observable class NEVER call the update(Observable obj, Object arg) method of my Observer class... Here is my OBSERVABLE class : which is retrieving GPS Frame from a GPS Receptor public class GPSFrame extends Observable implements Runnable, SerialPortEventListener { static Thread myThread; private CommPortIdentifier portid=null; private SerialPort serialport; private BufferedReader fluxgps; // Reading flow port where the GPS is connected /** CONSTRUCTOR **/ public GPSFrame() { myThread=new Thread(this); } public void start() { // The thread start automatically run() method myThread.start(); } @Override public void run() { try { // Driver initialization Win32Driver driver=new Win32Driver(); driver.initialize(); GPSFrame gpscom=new GPSFrame(); gpscom.listPort(); } catch (Exception e){ System.out.println("start "+e.toString()); } } // Scanning all available ports public void listPort() { Enumeration&lt;?&gt; listport=CommPortIdentifier.getPortIdentifiers(); while(listport.hasMoreElements()) { portid=(CommPortIdentifier)(CommPortIdentifier)listport.nextElement(); if(portid.getPortType()==CommPortIdentifier.PORT_SERIAL) { // On lance la gestion des evenements sur le portid this.portInitialization(portid.getName()); } } } public void portInitialization(String portcom) { // ... } public void retrieveGpsFrame() { String rawframe=new String(); try { rawframe=(String)fluxgps.readLine(); String[]gpsframe=rawframe.split(","); // We are doing a pre-selection of the frame if(gpsframe[0].equals("$GPGGA") || gpsframe[0].equals("$GPRMC")) { /* IMPORTANT - DON'T FORGET SETCHANGED() or GPSFrame'll never * notify UPDATE() ServerBoard method - We'll never see any changes */ System.out.println(rawframe); setChanged(); notifyObservers(rawframe); } else { gpsframe=null; } } catch (IOException e) { e.printStackTrace(); } } } Here is my OBSERVER class : which is receiving and showing.…
type: Question
has title: JAVA - Observer is never notify while Observable is implemented Runnable

http://stackoverflow.com/q/21002426
has comment: http://stackoverflow.com/comment/31562848
has body: I am working on a Java program, where it will print the stored string in backwards. And I would like to use the ArrayUtils method. So, in order to do that, I have to import org.apache.commons.lang.ArrayUtils; (commons-lang-2.6.jar), which I dont have. And I would like to download it and add it to the library. Once I am in the commons.apache.org page and look for commons-lang-2.6.jar, there are actually 2 sections : Binaries, and Source. Which one should I download and how do I add the library?
tagged with: netbeans
has answer: http://stackoverflow.com/a/21002881
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/21002624
has answer: http://stackoverflow.com/a/21002624
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/21002881
has title: How to import libraries in Netbeans?
score: 0

http://stackoverflow.com/q/20947888
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21464189
tagged with: android
upvote count: 1
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21464189
has title: Android 3g connection delay
score: 1
tagged with: java
has body: I'll appreciate your help with the following: Question: I'm looking to rush the 3g connection and make it connect immediately. Explanation: I built an app (for Android), using HttpClient for connecting to my server, and Amazon's AWS API to connect to various Amazon services. I noticed that occasionally, the connection establishment in 3g takes a lot of time, and it actually seems that Android just waits a while before sending the GET/POST/whatever request, and not even trying until then. Few Clarifications: the 3g connection IS working (good signal) and the problem is with 3g ONLY. when trying to connect to the internet using a browser (e.g Boat Browser), the connection seems to "wake up" and those green&amp;orange arrows at the status bar start lighting again. And..the browser works. Sometimes my request get "awakened" then as well. My requests DO work, but usually it takes a while (at least 1 minute) until they actually initiate. I can put some code if needed, but it looks like it isn't related to what I do, it's just how Android works (maybe it's waiting for many requests before initiating 3g connection?), and that some apps (like Boat Browser) force the connection to send their request, or just refresh the 3g connection maybe. Thank you so much
has comment: http://stackoverflow.com/comment/32126634

http://stackoverflow.com/comment/31590764
type: Comment
comment on: http://stackoverflow.com/a/21016823
score: 0
has text: you also beed http://commons.apache.org/proper/commons-fileupload/ . For your latest error.
type: AnswerComment

http://stackoverflow.com/comment/31435795
type: QuestionComment
score: 1
has text: Why would you think that there was a `split` method on `Scanner` instances? There's none metioned in [the documentation](http://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html#method_summary).
comment on: http://stackoverflow.com/q/20934388
type: Comment

http://stackoverflow.com/a/21007686
score: 5
has body: The while loop exits when count is 10 (9 is still less than 10). Then you println count, whose value is 10. Finally you increment its value which, after printing, it's 11.
type: AcceptedAnswer
upvote count: 5
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31573287
answers question: http://stackoverflow.com/q/21007630
accepted answer of: http://stackoverflow.com/q/21007630

http://stackoverflow.com/a/21070066
downvote count: 0
answers question: http://stackoverflow.com/q/20862869
type: Answer
score: 1
upvote count: 1
has body: if (zuÄnderndeDatei11.delete()) { buffer.renameTo(zuÄnderndeDatei11); } is returning false because you didn't close the reader before trying to delete. if the reader is not closed before you try to delete the file, the system will not delete it because it thinks that the user still has the file open(which you do, but through java). you need to close the reader and then try to delete it. EDIT: and also why are you creating a countdown through a file? this is so inefficient it is going to make me cry. use this: final int time = 90; Timer timer = new Timer(); timer.scheduleAtFixedRate(new TimerTask() { @Override public void run() { if(time &gt; 0) time--; else { timer.cancel(); //do something } } },1000,1000);

http://stackoverflow.com/comment/31479188
score: 0
has text: Here's some basic documentation on casting and inheritence in java http://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html
comment on: http://stackoverflow.com/q/20957255
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31473235
score: 0
type: Comment
has text: @Kayaman why ? I verified this myself :)
type: QuestionComment
comment on: http://stackoverflow.com/q/20953444

http://stackoverflow.com/comment/31281011
comment on: http://stackoverflow.com/a/20852510
score: 1
has text: @nhahtdh - it is safe to assume that the JVM (not the JRE!) represents `int` and `long` using native signed 32-bit and 64-bit integer representation, and uses native instructions to do 32 to 64 bit conversion, and `long` arithmetic and comparisons.
type: Comment
type: AnswerComment

http://stackoverflow.com/q/20871864
has body: Currently, my entire gui has to freeze while the database connection is established. So instead, I wanted to run the connection in a background thread/task, and then tell the user when the connection has been established. Should I use a SwingWorker or a normal Thread or something else of the kind?
tagged with: jdbc
favorite count: 0
type: Question
tagged with: multithreading
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/31318398
has title: How to use jdbc in a background thread with a Swing gui
answer count: 1
score: 0
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/31318022
tagged with: swingworker
has answer: http://stackoverflow.com/a/20871909
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20871909

http://stackoverflow.com/q/20864626
has comment: http://stackoverflow.com/comment/31304408
tagged with: java
has comment: http://stackoverflow.com/comment/31304364
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/20864725
has body: I'm not quite sure what I'm having trouble with here and I'm hoping someone can help me. This is my first post on Stack Overflow, and I'm relatively new to programming, so I hope I don't offend anyone's sensibilities around here. Here's the prompt (yes, it's a Project Euler question and please don't give the answer away): What is the lowest number which is divisible by every number between 1 and 20? Here's what I coded: int target = 21; int divisor; boolean success = false; while (!success) { for (divisor = 1; divisor &lt; 21; divisor++) { if (target % divisor != 0) { break; } else { if (divisor == 20) { success = true; } } target++; } } System.out.println(target); The answer I'm getting (232792581) is being flagged as incorrect by P.E. Can anyone tell me what I'm getting wrong here? Thanks everyone!!
score: 0
has comment: http://stackoverflow.com/comment/31304402
has comment: http://stackoverflow.com/comment/31304452
answer count: 1
has comment: http://stackoverflow.com/comment/31304375
has title: Range of divisors (Java)

http://stackoverflow.com/comment/31279331
has text: guys here is the error log:- exception java.lang.reflect.InvocationTargetException sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) java.lang.reflect.Method.invoke(Unknown Source) com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:440) com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:279)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20851534
score: 0

http://stackoverflow.com/q/20991594
has comment: http://stackoverflow.com/comment/31587497
score: 0
tagged with: playframework
answer count: 1
has comment: http://stackoverflow.com/comment/31543113
has title: Play! Exception in thread "main" java.lang.NoClassDefFoundError:
has comment: http://stackoverflow.com/comment/31542976
type: UnansweredQuestion
has body: I've installed play 1.2.5 framework. My application worked fine. But after reboot I can't run it. Also I can't run brand new application created with play. I have on start up: Exception in thread "main" java.lang.NoClassDefFoundError: Caused by: java.lang.ClassNotFoundException: at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) Could not find the main class: . Program will exit. I have reinstalled play. But without success. Where could be problem?
has comment: http://stackoverflow.com/comment/31542901
has comment: http://stackoverflow.com/comment/31542925
has answer: http://stackoverflow.com/a/43840171
tagged with: java
type: Question

http://stackoverflow.com/comment/31451967
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20942500
has text: The snippets in your comment here suggest that you didn't take my advice at all. If you had changed the `Character` constructor, those two wouldn't compile.
score: 0

http://stackoverflow.com/comment/31490767
comment on: http://stackoverflow.com/q/20962864
has text: I say just post an [SSCCE](http://sscce.org) for faster help
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/31578712
has text: I am using Selenium version(2.39.0)
comment on: http://stackoverflow.com/a/20999860
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/31415816
has text: Why wouldn't it be random? The r is a random number between 0 and 51. You have 52 indices in your `deckCard` array. So it will generate a random index `r` . So I don't get why you don't think it won't be random.
type: Comment
comment on: http://stackoverflow.com/a/20923224
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31564212
has text: Ah, yes - I had intended to include a bit of the stack trace and forgot. I'll update the question with that. As for avoiding Evaluate I like that idea. Rather than treating a list of strings representing the scopes we want dumped maybe I can use an array of the actual scopes instead. I'll give that a shot and see how it fares. thanks!
comment on: http://stackoverflow.com/q/21002025
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21007839
score: 1
upvote count: 1
has body: There is a difference here! If you want to access your scanner without invoking any method, then place it in field or static block. Your example private static Scanner input = new Scanner(System.in); is only equal to this private static Scanner input; static { input = new Scanner(System.in); } Initialization time is different. Method main is special method in which this is not visible, because this method start your program ;)
downvote count: 0
answers question: http://stackoverflow.com/q/21007594
has comment: http://stackoverflow.com/comment/31573799
type: Answer

http://stackoverflow.com/a/20919868
type: Answer
answers question: http://stackoverflow.com/q/20919838
has comment: http://stackoverflow.com/comment/31408373
has body: Use a HashMap&lt;String,Integer&gt; storing the String as the key and the number of occurrences as an Integer.
score: 0

http://stackoverflow.com/q/20892159
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26817834
upvote count: 3
tagged with: java
type: Question
score: 3
has body: I'm having difficulties setting up Pax Runner Eclipse plugin so I can run Felix inside Eclipse. I followed the instructions on https://ops4j1.jira.com/wiki/display/paxrunner/Plugin+Installation but looks like the updatesite (http://www.ops4j.org/pax/eclipse/update/) is unavailable. I downloaded pax-runner-assembly-1.8.5-jdk15.zip from the public maven repo in an attempt of manually installing the plugin but I think I have a wrong file. Which files do I need to download and where I should copy those files to (Eclipse plugins folder?)?
has title: Pax runner eclipse plugin updatesite
has answer: http://stackoverflow.com/a/27830686
tagged with: eclipse
answer count: 2
tagged with: pax-runner
downvote count: 0
favorite count: 0

quartz-scheduler
tags question: http://stackoverflow.com/q/20931913
type: Tag
tags question: http://stackoverflow.com/q/20990490
tags question: http://stackoverflow.com/q/21002236
tags question: http://stackoverflow.com/q/21006073
tags question: http://stackoverflow.com/q/20876951
tag name: quartz-scheduler
tags question: http://stackoverflow.com/q/20908408
tags question: http://stackoverflow.com/q/21005416

http://stackoverflow.com/q/20876861
tagged with: image
has comment: http://stackoverflow.com/comment/31327796
answer count: 1
has answer: http://stackoverflow.com/a/20877022
has title: I want to show the image on button click in Swing
favorite count: 0
tagged with: imageicon
has comment: http://stackoverflow.com/comment/31329041
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20877022
downvote count: 2
has body: here is my code which i have written i want to display the image which is in my class path so what i have to do for the same as biometric1 is the workspace of eclipse then project name "D:\biometric1\TestJniPrj\single.jpg"; package org.test.ivb; import java.awt.Color; import java.awt.EventQueue; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.BevelBorder; public class ImageWindow extends JFrame { private static final long serialVersionUID = 1L; private JFrame frame; /* * private void btnCaptureActionPerformed(java.awt.event.ActionEvent evt) * {//GEN-FIRST:event_jButton8ActionPerformed try { CaptureFrame capone = * new GetCapture(); this.initFingerprint(this.openFile()); } catch * (IOException e1) { e1.printStackTrace(); } catch (InterruptedException * e1) { e1.printStackTrace(); } * * } */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { ImageWindow window = new ImageWindow(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } public ImageWindow() { initialize(); } private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 450, 378); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); JPanel panel = new JPanel(); panel.setForeground(Color.PINK); panel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null)); panel.setBounds(27, 11, 268, 303); frame.getContentPane().add(panel); JButton btnNewButton = new JButton("capture"); btnNewButton.setToolTipText(""); btnNewButton.setSelectedIcon(new ImageIcon( "D:\\biometric1\\TestJniPrj\\single.jpg")); btnNewButton.setBounds(318, 146, 89, 23); frame.getContentPane().add(btnNewButton); } }
tagged with: embedded-resource
upvote count: 1
tagged with: swing
type: Question
tagged with: java
score: -1

http://stackoverflow.com/q/20877406
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has title: PostGIS Functions not working using hibernate in java?
tagged with: postgis
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/20884473
has body: I need to execute select ST_AsText(column_name) from table using hibernate createSQlQuery(). When i executed that query, it fires an exception. But when i execute the same query using simple JDBC or in my PGAdmin browser, the query works. Below is my query: select st_astext(linkPoints) from linkRoute Exception: SEVERE: ERROR: relation "linkroute" does not exist Mapping File &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"&gt; &lt;hibernate-mapping&gt; &lt;class name="com.lnt.utility.pojo.linkRoute" table="link_route"&gt; &lt;id name="Id" column="id"&gt; &lt;generator class="assigned" /&gt; &lt;/id&gt; &lt;property name="linkName" column="link_name"/&gt; &lt;property name="distance" column="distance"/&gt; &lt;property name="idNo" column="idno"/&gt; &lt;property name="speed" column="speed"/&gt; &lt;property name="linkPoints" column="link_points"/&gt; &lt;/class&gt; &lt;/hibernate-mapping&gt; Pls help
tagged with: postgresql
answer count: 1
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/20884473
score: 2

http://stackoverflow.com/a/20926519
upvote count: 2
has body: What you describe is rather close to how federated login works on the .NET platform. The SAML2 ticket is read when first received from the Idp, but on subsequent requests the Idp is not involved but rather a cookie. However, on .NET the SAML2 token is not stored in the cookie, instead the cookie contains the identity information in a form that's suitable for .NET applications to avoid having to re-parse and re-validate the SAML2 token each time. The entire cookie is encrypted with a key that only the server knows, so there is no way for the user to tamper with it.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20886735
score: 2

http://stackoverflow.com/q/20862515
has comment: http://stackoverflow.com/comment/31300373
tagged with: multidimensional-array
has title: how to work with Multidimensional arraylist?
has answer: http://stackoverflow.com/a/20862608
type: UnansweredQuestion
has body: Hey guys sorry i'm a noob at java but im trying to make something and i need a multidimensional array list. It must be implemented into the following code: public static void OpenFile() { ArrayList&lt;ArrayList&lt;String&gt;&gt; array = new ArrayList&lt;ArrayList&lt;String&gt;&gt;(); int retrival = chooser.showOpenDialog(null); if (retrival == JFileChooser.APPROVE_OPTION) { try (BufferedReader br = new BufferedReader(new FileReader( chooser.getSelectedFile()))) { String sCurrentLine; while ((sCurrentLine = br.readLine()) != null) { if (sCurrentLine.equals("")) { continue; } else if (sCurrentLine.startsWith("Question")) { System.out.println(sCurrentLine.split(":")[1]); //add to [0] in array ArrayList } else if (sCurrentLine.startsWith("Answer")) { System.out.println(sCurrentLine.split(":")[1]); //add to [1] in array ArrayList } else if (sCurrentLine.startsWith("Category")) { System.out.println(sCurrentLine.split(":")[1]); //add to [2] in array ArrayList } else if (sCurrentLine.startsWith("Essay")) { System.out.println(sCurrentLine.split(":")[1]); //add to [3] in array ArrayList } } } catch (Exception ex) { ex.printStackTrace(); } } } All the [1] index's of the strings i split need to go into a multidimesional array in this order: question, answer, category, essay. So i am currently using a normal multidimensional array but you cant change the values of it easily. What i want my multidimensional arraylist to look like is this: MultiDimensional ArrayList [0]: questions(it may be over 100 of them.) [1] answers(it may be over 100 of them.) [2] category(it may be over 100 of them.) [3] essay(it may be over 100 of them.)
has answer: http://stackoverflow.com/a/20862576
score: 2
has comment: http://stackoverflow.com/comment/31300953
upvote count: 3
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/20862600
has comment: http://stackoverflow.com/comment/31300403
tagged with: bufferedreader
answer count: 6
tagged with: arraylist
has answer: http://stackoverflow.com/a/20862560
has comment: http://stackoverflow.com/comment/31300431
has answer: http://stackoverflow.com/a/20862606
has answer: http://stackoverflow.com/a/20862609
favorite count: 0

http://stackoverflow.com/a/20922735
score: 1
answers question: http://stackoverflow.com/q/20922553
upvote count: 1
has body: By passing the value in method you can check the value line by line if that line founds break the loop. public void CatalogueReader(String filename,String id) throws IOException{ BufferedReader br = null; String line = ""; String cvsSplitBy = ","; br = new BufferedReader(new FileReader(filename)); while ((line = br.readLine()) != null) { // use comma as separator String[] lineArray = line.split(cvsSplitBy); //Check the value from array //if(lineArray[xxx]==id){ //Print the line break; } if (br != null) { try { br.close(); } catch (IOException e) { e.printStackTrace(); } } }
type: Answer
downvote count: 0

http://stackoverflow.com/a/20906034
has comment: http://stackoverflow.com/comment/31381497
has comment: http://stackoverflow.com/comment/31381864
has body: This is the official reference: Swing's Threading Policy In general Swing is not thread safe. All Swing components and related classes, unless otherwise documented, must be accessed on the event dispatching thread. And the repaint method does not "document otherwise". To doubly reassure you that you do not need to look any further than an individual method's Javadoc for the definitive answer, see for example how a method's thread safety was documented in Java 6 Javadoc. Update Apparently, more clarification is needed as to the distinction between normative specification, descriptive technical articles, and details of any specific implementation. What the Javadoc states is this: there is no guarantee that repaint is a thread-safe method. Incidentally, the often-discussed decision in Java 7 to remove the "thread-safe" designation from most of the Swing API was just that: a change in contract, not implementation. The specific implementation of repaint in OpenJDK 7 appears to be thread-safe, a fact which has nothing to do with guarantees given by the specification. Code which relies on the thread safety of repaint or other methods is broken and is not guaranteed to behave properly on all Java implementations.
type: AcceptedAnswer
score: 10
accepted answer of: http://stackoverflow.com/q/20905985
has comment: http://stackoverflow.com/comment/31382539
answers question: http://stackoverflow.com/q/20905985
has comment: http://stackoverflow.com/comment/31382328
has comment: http://stackoverflow.com/comment/31382178
upvote count: 10
type: Answer
has comment: http://stackoverflow.com/comment/31381632
has comment: http://stackoverflow.com/comment/31415318
has comment: http://stackoverflow.com/comment/31417799
has comment: http://stackoverflow.com/comment/31388275
has comment: http://stackoverflow.com/comment/127547060
has comment: http://stackoverflow.com/comment/31384295
has comment: http://stackoverflow.com/comment/31381392
has comment: http://stackoverflow.com/comment/31381610
has comment: http://stackoverflow.com/comment/31394630
downvote count: 0
has comment: http://stackoverflow.com/comment/31381713

http://stackoverflow.com/a/20972523
has body: If jframe 1 call jframe 2, then u can create a constructor in jframe 2, and pass this values. Or you can do that by haveing a object contains jframe 1, then get in the second frame, get them by getter methods. But for a good practice you should use single jframe and dialogs.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20972412

http://stackoverflow.com/q/20890827
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/20891143
has body: I have a textView and an editText which should be displayed below my imageView (sqwhite) however for some reason - I cannot see either the textView (tx) or the editText (et) (after clicking the button which successfully displays the imageView). The strange part is I can debug and step through these methods... yet no textView or editText ever seems to appear on the screen (the imageView sqwhite appears without issue though). Java Snippet: private boolean isErase = false; private EditText et; private TextView tx; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.demo); et = (EditText) findViewById(R.id.editText1); et.setVisibility(View.INVISIBLE); tx = (TextView) findViewById(R.id.textView1); ... public void addNewImageToScreen() { int resourceId = R.drawable.sqwhite; addNewTextToScreen(); int m = mImageCount % 3; if (m == 1) resourceId = R.drawable.sqdrk; else if (m == 2) resourceId = R.drawable.sqwhite; addNewImageToScreen(resourceId); } private void addNewTextToScreen() { // TODO Auto-generated method stub et.setVisibility(View.VISIBLE); if (isErase) { tx.setText(et.getText().toString()); } else { tx.setText(""); et.setVisibility(View.GONE); } isErase = !isErase; } XML Snippet: &lt;RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" &gt; &lt;ImageView android:id="@+id/sqwhite" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="center" /&gt; &lt;EditText android:id="@+id/editText1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/sqwhite" &gt; &lt;requestFocus /&gt; &lt;/EditText&gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/editText1" android:text="" android:textColor="@android:color/white" /&gt; &lt;/RelativeLayout&gt;
tagged with: android-xml
tagged with: android
accepted answer: http://stackoverflow.com/a/20891078
linked to: http://stackoverflow.com/q/20913058
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20891078
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/20891143
has comment: http://stackoverflow.com/comment/31355377
has comment: http://stackoverflow.com/comment/31353783
score: 0
has title: Unable to Create textView and editText onClick (although method is reached in debugger)
tagged with: textview

http://stackoverflow.com/a/21008153
type: Answer
has body: You can't store the InputStream in SharedPreferences because only primitive data (int,boolean,String, etc.) can be saved that way. What you should do is read the data, save it to a String and then you can store the string (see here): BufferedReader reader = new BufferedReader(new InputStreamReader(attachment)); StringBuilder out = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { out.append(line); } then you can do editor.putString("fileName", out.toString()); If you really want to send the actual InputStream to another activity (which is odd, but who am I to judge), however, you can do it using intent.putSerializableExtra(attachment).
answers question: http://stackoverflow.com/q/21007525
accepted answer of: http://stackoverflow.com/q/21007525
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31618176

http://stackoverflow.com/comment/31507657
type: Comment
type: QuestionComment
has text: @Ayushya Devmurari i did it. I edited my post, now u can read what i've done. Can you check if it's correct?
comment on: http://stackoverflow.com/q/20969993
score: 0

http://stackoverflow.com/comment/44332865
comment on: http://stackoverflow.com/a/27734698
has text: Thank you very much. I tried your proposed solution "1", and it did the trick.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/20883962
has comment: http://stackoverflow.com/comment/31340109
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/20883737
type: Answer
has body: public TestKeyBindings02() { JPanel panel = new JPanel(); InputMap im = panel.getInputMap(JPanel.WHEN_IN_FOCUSED_WINDOW); ActionMap am = panel.getActionMap(); im.put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0), "RightArrow"); im.put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), "LeftArrow"); im.put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), "UpArrow"); im.put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "DownArrow"); am.put("RightArrow", new ArrowAction("RightArrow")); am.put("LeftArrow", new ArrowAction("LeftArrow")); am.put("UpArrow", new ArrowAction("UpArrow")); am.put("DownArrow", new ArrowAction("DownArrow")); } public class ArrowAction extends AbstractAction { private String cmd; public ArrowAction(String cmd) { this.cmd = cmd; } @Override public void actionPerformed(ActionEvent e) { if (cmd.equalsIgnoreCase("LeftArrow")) { System.out.println("The left arrow was pressed!"); } else if (cmd.equalsIgnoreCase("RightArrow")) { System.out.println("The right arrow was pressed!"); } else if (cmd.equalsIgnoreCase("UpArrow")) { System.out.println("The up arrow was pressed!"); } else if (cmd.equalsIgnoreCase("DownArrow")) { System.out.println("The down arrow was pressed!"); } } } Taken from here

http://stackoverflow.com/comment/31440712
score: 0
type: AnswerComment
has text: And if i compare files listed in the tutorial with the place my files installed some of them are same but the thing is that the main file is mbroli.exe (i can send a list of all if req.) but if it is so it is just a click and run application :P
type: Comment
comment on: http://stackoverflow.com/a/20935638

http://stackoverflow.com/comment/31488848
type: Comment
score: 0
comment on: http://stackoverflow.com/a/20961296
type: AnswerComment
has text: Can you guys pls send me a screenshot of the edited java file! I don't understand and I am very new to java! Thanks everyone though for your help!

http://stackoverflow.com/comment/31570191
comment on: http://stackoverflow.com/a/21005488
type: AnswerComment
score: 0
type: Comment
has text: if I know my values are either going to be zero or a positive number, which is more computationally efficient: `if (x > 0.0)` or `if (x != 0.0)`? Thanks!

http://stackoverflow.com/comment/31330814
score: 0
type: Comment
has text: Thanks a lot for this simple solution.but if in case of like consecutive 3 or 4 or more capital token are come then it should also get hyphenated e.g. Mr. Harry Jerry Merry Potter is going to school then output should be Mr. Harry-Jerry-Merry-Potter is going to school
comment on: http://stackoverflow.com/a/20874242
type: AnswerComment

http://stackoverflow.com/comment/31607123
score: 1
has text: This issue has been filed under the following address: https://github.com/michel-kraemer/bson4jackson/issues/35
comment on: http://stackoverflow.com/q/20981195
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20972176
tagged with: ipc
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/6315247
downvote count: 0
has comment: http://stackoverflow.com/comment/31506943
accepted answer: http://stackoverflow.com/a/20972694
favorite count: 0
has comment: http://stackoverflow.com/comment/31507248
type: Question
has title: NullPointerException when receiving an array list over a socket
has comment: http://stackoverflow.com/comment/31506874
has comment: http://stackoverflow.com/comment/31507481
has comment: http://stackoverflow.com/comment/31507328
upvote count: 2
tagged with: sockets
answer count: 2
has comment: http://stackoverflow.com/comment/31507305
has comment: http://stackoverflow.com/comment/31506871
has body: Trying to send an arrayList over a socket, get a null pointer exception at object input stream initialization (client). Client: try { ObjectInputStream objIn = new ObjectInputStream( Client.socket.getInputStream()); // HERE library = (ArrayList&lt;Book&gt;) objIn.readObject(); } catch (IOException e) { Server: try { ObjectOutputStream objOut = new ObjectOutputStream( this.client.getOutputStream()); objOut.writeObject(library); objOut.flush(); // added later, not helping } I've been trying to comunicate over sockets for two days now with almost no success. I have no idea what's going on. Ofc I plan to document myself better when I'll have more time but for now I'd really like to understand what is happening. EDIT public class Client { private static int port = 6666; private static Socket socket = null; public Client (int port) { Client.port = port; } public Client () { } public void establishConnection() { try { Client.socket = new Socket(InetAddress.getByName(null), Client.port); } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } Server: public void start () { (new Thread() { public void run() { try { Server.socket = new ServerSocket(Server.portNumber); while (!Server.stop) { Socket client = Server.socket.accept(); (new HandleRequest (client)).start(); } ............... public class HandleRequest extends Thread { private Socket client = null; private SQL sql_db = new SQL (); public HandleRequest (Socket client) { this.client = client; } @Override public void run () { try { if (!this.sql_db.isConnected()) this.sql_db.connect(); if (this.client == null) { System.out.println("Error: client does not exist, NO idea what's going on"); return; } ArrayList&lt;Book&gt; library = this.sql_db.getAllBooks(); try { ObjectOutputStream objOut = new ObjectOutputStream( this.client.getOutputStream()); objOut.writeObject(library); objOut.flush(); } catch (Exception e) { System.out.println("Server error in handling request for whol…
tagged with: java
possible better answer: http://stackoverflow.com/a/20972451
has comment: http://stackoverflow.com/comment/31507204
has answer: http://stackoverflow.com/a/20972451
has comment: http://stackoverflow.com/comment/31507046
has answer: http://stackoverflow.com/a/20972694

http://stackoverflow.com/q/20894605
has answer: http://stackoverflow.com/a/20894638
favorite count: 0
answer count: 5
accepted answer: http://stackoverflow.com/a/20894690
has comment: http://stackoverflow.com/comment/31360852
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31360874
has answer: http://stackoverflow.com/a/20894709
has body: Why does this code compile? Object[] object = new String[5][5]; I mean, why can I do that if I'm creating an array object with different dimensions than specified in the reference variable? This doesn't compile: String[] strings = new String[5][5]; So what is happening here?
score: 9
type: Question
has title: Why "Object[] object = new String[][]" compiles? - Java
upvote count: 9
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/20894690
has answer: http://stackoverflow.com/a/20894760
possible better answer: http://stackoverflow.com/a/20894654
has answer: http://stackoverflow.com/a/20894654

http://stackoverflow.com/a/20879920
type: Answer
has body: I think java web start could help you http://www.java.com/it/download/faq/java_webstart.xml
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/20879860

http://stackoverflow.com/a/20902980
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/20902775
downvote count: 0
has body: Use the following code: if (android.provider.Settings.System.getInt(getContentResolver(), android.provider.Settings.System.ACCELEROMETER_ROTATION, 0) == 1) { Toast.makeText(Rotation.this, "Rotation ON", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(Rotation.this, "Rotation OFF", Toast.LENGTH_SHORT).show(); }
score: 3

http://stackoverflow.com/a/21014068
upvote count: 1
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21014051
has body: String should be compared with equals() method, not ==. You are trying the check the equality of the memory address of both instances (actually they are not) instead of the value in the String instances. So, use if(value.equals(name)) { System.out.println("equal == 1"); }

http://stackoverflow.com/a/20904469
type: Answer
score: 0
answers question: http://stackoverflow.com/q/20899306
has body: Android (before kitkat) requires java 6 or below. Make sure that your main project has code compliance of java 6 and not java 7. This should not be a problem if you have used setup-ui. (But still better to check it). Hope this helps.

http://stackoverflow.com/comment/31464811
score: 0
has text: @TimB Because with more elements the number of permutations is rising very high, it would be better to check right away before or after adding a number if it is valid. BTW, your `recursiveBuild` method is not recursive, wonder if that works.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/20949753

http://stackoverflow.com/q/20922371
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/20922409
type: Question
has body: When I'm compiling this code public static void main(String [] args) { int x = 0; while(false) { System.out.println(hello); } } it is showing compile time error unreachable code. But when I modified this code to public static void main(String [] args) { int x = 0; boolean result = false; while(result) { x=4; } } it's working fine. Can somebody tell me the reason behind this behavior.
has answer: http://stackoverflow.com/a/20922423
linked to: http://stackoverflow.com/q/13235559
tagged with: while-loop
downvote count: 2
has answer: http://stackoverflow.com/a/20922421
favorite count: 0
upvote count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31412980
has comment: http://stackoverflow.com/comment/31413568
has answer: http://stackoverflow.com/a/20922387
answer count: 4
has title: Unreachable code while loop

http://stackoverflow.com/comment/31367316
type: AnswerComment
has text: The page should not contain too much logic Emiliano. I would move the decision to the bean. Instead of `rendered="#{loginController.companyName('123456')}"` use `rendered="#{loginController.showCompany123456()}"`. Therefore the logic is still in the bean and the page is just for the view.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20890684

http://stackoverflow.com/q/20976377
upvote count: 3
has title: Deployment-Error: Java-Webproject from netbeans to glassfish 4.0
tagged with: java
has answer: http://stackoverflow.com/a/21141662
has body: Setup I'm using Netbeans 7.4 on Mac OSX Mavericks and Glassfish 4.0 (build 89) on my dedicated server and JDK 1.7. To use the server locally I setup and ssh-tunnel. The following way: ssh -L 4848:127.0.0.1:4848 -p 6122 glassfish@XXXXXXXXXX This is working perfectly fine, I can access the server via localhost without any problems. To use this server I added a server in Netbeans, see prinscreen: Problem Now I'd like to deploy the project to the server (Right-Click Project -> Deploy) but I get following Error: Building jar: /Users/tzhware7/NetBeansProjects/SkyLogicAddon/dist/SkyLogicAddon.war Distributing /Users/tzhware7/NetBeansProjects/SkyLogicAddon/dist/SkyLogicAddon.war to [glassfish.ivo] glassfish.ivo, deploy, null, false /Users/tzhware7/NetBeansProjects/SkyLogicAddon/nbproject/build-impl.xml:1050: The module has not been deployed. See the server log for details. BUILD FAILED (total time: 1 second) Now I'd checked the line where the Error-Show's up, which is following (1049-1051). For me everything looks normal: &lt;target if="netbeans.home" name="-run-deploy-nb"&gt; &lt;nbdeploy clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/&gt; &lt;/target&gt; In advance I checked the serverlogs, which are empty - no error is shown. What am I doing wrong? Can someone advice me what to change? Thank you in advance! Edit 1 - 08.01.2014 Allright, I didn't found a solution for solving the problem above, but following way worked at least to deploy the app manually. Netbeans -> Right-Click on Project -> Clean/Build (now check your outputlog where it save's the project. Now go to that path, you'll shoud find a .war file Log into your glassfish-server -> Click Application's -> Click deploy -> upload the .war file -> Click again deploy Now glassfish deploys the project for you. :) Edit 2 - 17.01.2014 I could fix the problem, following was wrong. In netbeans I configured that the Target should be domain1, if you do this, it won't work. Let the target…
downvote count: 0
tagged with: glassfish
tagged with: web-deployment
type: AnsweredQuestion
score: 3
favorite count: 0
accepted answer: http://stackoverflow.com/a/21141662
tagged with: netbeans
type: Question
tagged with: glassfish-4
answer count: 1

http://stackoverflow.com/q/20968840
score: 6
has answer: http://stackoverflow.com/a/20969153
upvote count: 6
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20969153
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/31501020
has comment: http://stackoverflow.com/comment/31501284
has comment: http://stackoverflow.com/comment/111925422
has comment: http://stackoverflow.com/comment/37712987
answer count: 1
downvote count: 0
favorite count: 0
has body: I am working on a simple hibernate dependent objects program using Oracle as my database. Here are my POJO classes: Person public class Person { private java.util.Date birthday; private Name name; private String key; ... getters &amp; setters ... } Name public class Name { char initial; String first; String last; ... getters &amp; setters ... } Hibernate mapping file: person.hbm.xml &lt;hibernate-mapping&gt; &lt;class name="Person" table="person1"&gt; &lt;id name="Key" column="pid" type="string"&gt; &lt;generator class="uuid" /&gt; &lt;/id&gt; &lt;property name="birthday" type="date" /&gt; &lt;component name="Name" class="Name"&gt; &lt;!-- class attribute optional --&gt; &lt;property name="initial" /&gt; &lt;property name="first" /&gt; &lt;property name="last" /&gt; &lt;/component&gt; &lt;/class&gt; &lt;/hibernate-mapping&gt; I have set the hbm2ddl.auto property as update in my hibernate.cfg.xml file so tables are created when I execute my program. Here is my simple program that tries to save an instance of Person object: public class Program { public static void main(String[] args) { Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); Name name = new Name(); name.setFirst("First"); name.setLast("First"); name.setInitial('I'); Person person = new Person(); person.setBirthday(new Date()); person.setName(name); session.save(person); session.getTransaction().commit(); HibernateUtil.getSessionFactory().close(); } } Now when I am executing this program, I am getting error while creation of table itself: 15:20:45,376 ERROR SchemaUpdate:235 - HHH000388: Unsuccessful: create table person1 (pid varchar2(255) not null, birthday date, initial char(1), first varchar2(255), last varchar2(255), primary key (pid)) 15:20:45,376 ERROR SchemaUpdate:236 - ORA-00904: : invalid identifier I tried changing names of my properties in Person class as well as Name class but still I am facing this issue. Please let me know where I am doing mist…
has title: ORA-00904: : invalid identifier Issue with Hibernate Dependent objects program
tagged with: oracle-database

http://stackoverflow.com/comment/31552210
type: AnswerComment
comment on: http://stackoverflow.com/a/20988594
type: Comment
score: 0
has text: Remove the `expected`.

http://stackoverflow.com/comment/31425536
comment on: http://stackoverflow.com/a/20914447
score: 0
type: AnswerComment
has text: wouldn't my output just be `System.out.println(toMorse(translates, dottie))` ? also my code here has been updated to it's current version..
type: Comment

http://stackoverflow.com/comment/31588870
comment on: http://stackoverflow.com/q/21016350
has text: Your command is not correct. You will have to tell the compiler where to find the .java, .class files Confirmation.java depends on. Read here. http://docs.oracle.com/javase/7/docs/technotes/tools/solaris/javac.html Does the lincence under which the jar is provided even permit changes to the source code?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20938421
accepted answer: http://stackoverflow.com/a/20938497
type: AnsweredQuestion
type: Question
tagged with: java
answer count: 1
has title: what is the average time complexity of using Set/TreeSet in java?
score: 0
has body: Does the below implementation using Set interface/TreeSet class in java satisfy the O(N*log(N)) average time complexity in Big-O notation. I am trying to find the k-th largest element in a supplied integer list with the above mentioned average time complexity. public class JavaBuiltInSort { public static void removeDupInIntArray(int[] ints, int k) { Set&lt;Integer&gt; setString = new TreeSet&lt;Integer&gt;(Collections.reverseOrder()); for (int i = 0; i &lt; ints.length; i++) { setString.add(ints[i]); } System.out.println(setString); Integer[] array = setString.toArray(new Integer[0]); System.out.println("The kth largest element in the list is "+ array[k-1]); } public static void main(String[] args) { int[] arr = { 8, 9, 4, 5, 2, 1, 6, 5, 7, 9, 5, 4, 8, 6, 3, 1, 2, 5, 4, 7, 8 }; int k = 5; JavaBuiltInSort.removeDupInIntArray(arr,k); } }
has answer: http://stackoverflow.com/a/20938497

http://stackoverflow.com/a/20997591
downvote count: 0
has comment: http://stackoverflow.com/comment/31635742
has comment: http://stackoverflow.com/comment/31554986
type: Answer
upvote count: 3
score: 3
has body: I run Glassfish 3.1.2 in production for months at a time without issue. I would suspect the freezing your are seeing is a problem with the application you have deployed to it. I think you would be best served spending time investigating and remediating your hanging issue. Have you tried taking a thread dump of the Glassfish java process when this happens?
answers question: http://stackoverflow.com/q/20994143
has comment: http://stackoverflow.com/comment/31610879

http://stackoverflow.com/comment/31559727
type: QuestionComment
has text: It looks like you're either (a) using more plugins than you actually need, e.g., the GXP plugin, or (b) you're missing the plugin's dependencies.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21000777

http://stackoverflow.com/q/21002219
favorite count: 0
has comment: http://stackoverflow.com/comment/31562439
has comment: http://stackoverflow.com/comment/31564099
has comment: http://stackoverflow.com/comment/31565694
tagged with: android
has comment: http://stackoverflow.com/comment/31563716
linked to: http://stackoverflow.com/q/6582479
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
linked to: http://stackoverflow.com/q/9605913
type: Question
has comment: http://stackoverflow.com/comment/31563069
tagged with: reverse-geocoding
has comment: http://stackoverflow.com/comment/31564640
upvote count: 2
has body: This is sort of an extension to another question I found on here: Finding nearest street given a lat-long location The OP asked for the nearest street name and the answer giving is not working for me. I need the street name for my app I live in Ireland and all our roads are named with a letter followed by the roads number. The letter is either L, R, N or M based on the road class. This is the information I require for my app. Using the geocoder class to reverse geocode these co-ords: 53.286288,-6.801891 (which is right on a "R" road) gives me the area name but not the road name. On google maps if you enter the co-ords it says it is "R403". My question is how do I get the nearest road name using co-ords with google api's? If the online google maps can report the road name is there a way I can? I have looked into the Directions API and I am also wondering if I provide that with the above co-ords as a starting point and a destination point (because my app will only have the current location and there will be no destination) will the API return the road name?
has comment: http://stackoverflow.com/comment/31564034
has comment: http://stackoverflow.com/comment/31564638
has title: Reverse Geocoding to get street name Android
answer count: 1
has answer: http://stackoverflow.com/a/21003021
accepted answer: http://stackoverflow.com/a/21003021

http://stackoverflow.com/comment/31292107
type: Comment
comment on: http://stackoverflow.com/a/20858484
has text: I don't know what are you expecting as an output. Here is the code http://ideone.com/KnJ6h5 and it is getting string encrypted.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31409297
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20919295
has text: Never call `System.exit()` if there is even the slightest chance your code will be invoked in an application server, and it's bad idea in most other contexts as well. It will shut down the entire JVM, including your server.

http://stackoverflow.com/a/20989807
has comment: http://stackoverflow.com/comment/72361142
type: Answer
has comment: http://stackoverflow.com/comment/31548770
has comment: http://stackoverflow.com/comment/31543659
has body: Proxies are classes generated dynamically by Hibernate to help with lazy loading. For instance, if you have a Cat class, Hibernate will generate a proxy class that extends Cat. If you get an uninitialized instance of this proxy, essentially all its fields will be null except the ID because Hibernate has not yet hit the database. Now the first time you will call a method on this proxy, it will realize that it is not initialized and it will query the database to load it's attributes. This is possible because the dynamically generated class overrides the base class's methods and adds this initialized/uninitialized check. Now assume that your Cat class is not a proxy and that it has a father association, when you load a Cat object, Hibernate will need to load all it's attributes. So if you load a Cat object, Hibernate will also need to load its father and the father's father and so on. Using proxies enable Hibernate to only load the required instances. Cat cat1 = (Cat) session.load(1); Cat cat2 = (Cat) session.load(2); Cat cat3 = (Cat) session.load(3); cat1.meow(); // this will cause Hibernate to run a query to load cat1's data cat2.meow(); // this will cause Hibernate to run a query to load cat2's data // After this cat3 is still an uninitiated proxy because it has not been used batch-size is another feature of Hibernate that, in most instances, help dealing with lazy loading. Basically the idea is that Hibernate keeps track of the uninitialized proxies and when one of the needs to be initialized, a single query will be executed to load up to batch-size proxies (instead of just one proxy/query) Cat cat1 = (Cat) session.load(1); Cat cat2 = (Cat) session.load(2); cat1.meow(); // if batch-size &gt;= 2, cat1 and cat2 will be loaded in a single query cat2.meow(); // no query will be executed here
score: 74
upvote count: 74
accepted answer of: http://stackoverflow.com/q/20988626
answers question: http://stackoverflow.com/q/20988626
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/88271879

http://stackoverflow.com/comment/31320294
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20872685
score: 0
has text: Can you try path to Scala home without spaces? E.g. C:\scala. Or you can try it without "\bin" directory.

http://stackoverflow.com/a/20904418
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31384768
upvote count: 1
type: Answer
has body: Just to add to @laune, depending on your scenario, you can e.g. retract each pair of facts after a match: then System.out.println("@@Multiple "+$c.getName()+":"+$t.getPrice()); retract($c); retract($t); Edit Yes, in order to correlate the pairs, you can use a binding variable and then filter on this in the pattern match: when $c: Categories($catid : categoryid ) from entry-point "Multiple Stream" $t: Test(categoryid == $catid) from entry-point "Multiple Stream" then System.out.println("@@Multiple "+$c.getName()+":"+$t.getPrice()); (Assuming that there is a getCategoryId() getter on class Test. Also, correlating in this way will reduce the number of rule match permutations). You might not need to retract the facts if they are matched in correlated pairs this way.
answers question: http://stackoverflow.com/q/20901297

http://stackoverflow.com/comment/31535021
type: Comment
has text: A broad suggestion is to use regular expressions if the logs have a meaningful format.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20986514

http://stackoverflow.com/comment/31491447
comment on: http://stackoverflow.com/a/20963246
score: 1
has text: `LayoutManager`s are designed to overcome the issues presented when developing GUI applications. You have no control over the font or how those fonts are rendered on different systems, amongst the most obvious. While absolute layout managers "look" good to start with, be prepared to spend the rest of your life tweaking it...
type: AnswerComment
type: Comment

timer
tag name: timer
tags question: http://stackoverflow.com/q/20977812
type: Tag
tags question: http://stackoverflow.com/q/20863010
tags question: http://stackoverflow.com/q/21011914
tags question: http://stackoverflow.com/q/20864431
tags question: http://stackoverflow.com/q/20986983
tags question: http://stackoverflow.com/q/20931994
tags question: http://stackoverflow.com/q/20888205
tags question: http://stackoverflow.com/q/21009973

http://stackoverflow.com/q/20981634
linked to: http://stackoverflow.com/q/20476903
upvote count: 2
type: UnansweredQuestion
tagged with: android
has title: Should I use viewHolders if I use different ViewItemTypes?
score: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21062893
tagged with: android-arrayadapter
downvote count: 0
tagged with: listview
tagged with: android-listview
answer count: 1
has body: My initial question was posted here: ListView for messaging app shows wrong listItem layout after scrolling But I am a bit confused since there are two answers that were upvoted and I'd like to use both of them. First, I think it is a safe assumption that I should use the getItemViewType method to help me with performance. After that though, should I still use the viewHolder pattern as described in Googles documentation on Making ListView Scrolling Smooth? If I do use the ViewHolder code, do I incorporate it into getView? static class ViewHolder { TextView text; TextView timestamp; ImageView icon; ProgressBar progress; int position; } static public enum LAYOUT_TYPE { INBOUND, OUTBOUND } @Override public int getViewTypeCount () { return LAYOUT_TYPE.values().length; } @Override public int getItemViewType (int position) { if ( messages.get(position).isOutbound()) return LAYOUT_TYPE.OUTBOUND.ordinal(); else return LAYOUT_TYPE.INBOUND.ordinal(); } @Override public View getView (int position, View convertView, ViewGroup parent) { LAYOUT_TYPE itemType = LAYOUT_TYPE.values()[getItemViewType(position)]; ... (code until inflater ) switch (itemType){ case INBOUND: convertview = /inflate &amp; configure inbound layout ViewHolder holder = new ViewHolder(); holder.icon = (ImageView) convertView.findViewById(R.id.listitem_image); holder.text = (TextView) convertView.findViewById(R.id.listitem_text); holder.timestamp = (TextView) convertView.findViewById(R.id.listitem_timestamp); holder.progress = (ProgressBar) convertView.findViewById(R.id.progress_spinner); convertView.setTag(holder); break; case OUTBOUND: convertview = /inflate &amp; configure outbound layout ViewHolder holder = new ViewHolder(); holder.icon = (ImageView) convertView.findViewById(R.id.listitem_image); holder.text = (TextView) convertView.findViewById(R.id.listitem_text); holder.timestamp = (TextView) convertView.findViewById(R.id.listitem_timestamp); holder.progress = (ProgressBar) convertView.findViewById(R.id.…
favorite count: 0

http://stackoverflow.com/comment/31540179
type: Comment
score: 1
has text: Thanks. Is it safe to cache the results even for months? The timezone object does not change on DST switch?
type: AnswerComment
comment on: http://stackoverflow.com/a/20989784

http://stackoverflow.com/a/26817834
score: 1
upvote count: 1
has body: As far as I can tell from the documentation, the Pax (Curser) Eclipse plugin and the Pax Runner are different tools with different purposes. The pax-runner-assembly download seems to be a maven plugin/dependency. Pax Runner is used for provisioning (downloading and managing bundles) while the eclipse plugin adds the option to use different OSGI frameworks in the Eclipse OSGI run configuration. According to the eclipse marketplace, the plugin hasn't been updated since 2009. There is kind of poor communication about what projects ares still maintained and which of the downloads you actually need to run use the tools. I'd say the eclipse plugin is dead and you'll probably be better of searching for plugins that add support for the specific OSGI framework you want to run.
type: Answer
answers question: http://stackoverflow.com/q/20892159
downvote count: 0

http://stackoverflow.com/a/20968307
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31501104
type: Answer
accepted answer of: http://stackoverflow.com/q/20968107
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20968107
has body: It doesn't work. I think because the tag is inside a component that is not rendered when the page loads. That's exactly the problem. JSF ajax update work by replacing the elements in the DOM-Tree of the browser with the new version. But if there is no such element with the ID you just re-rendered, because it wasn't rendered before, then the browser doesn't know where to put that updated element and ignores it. Try something like this instead: <h:panelGroup id="panel2" > <h:panelGroup rendered="#{!bean.booleanProperty}"> Some stuff here </h:panelGroup> </h:panelGroup> You also need to set your bean to at least @ViewScoped. This is because it works like this: Initially your first panel is not visible because of "rendered="falseByDefault"". Then you click something else and that condition becomes true making your panel visible, but only for that one request+response. Now you click on the checkbox in that visible panel and want to set #{bean.booleanProperty} to another value in order to show panel2. The request will be sent, but JSF performs some validity checks on that request. It also checks that the checkbox you just clicked, could be clicked (that means it was visible). But because the panel around that checkbox is not visible anymore (it was visible only for one request), JSF decides that this request is not valid and does not process it the way you want it. That's why the boolean value of your checkbox is never changed and your panel2 will not be visible. As a rule of thumb: never use @RequestScoped together with Ajax requests.
has comment: http://stackoverflow.com/comment/31500766
has comment: http://stackoverflow.com/comment/31501844
upvote count: 1

http://stackoverflow.com/q/20986617
tagged with: android
has comment: http://stackoverflow.com/comment/31538310
has comment: http://stackoverflow.com/comment/31537942
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31534948
tagged with: arrays
score: 0
has title: How to draw tiles on a Java Android game and store each tile into an array?
answer count: 0
has body: I'm trying to design an Android game based on tiles. How would I go about making the background tile-like using Bitmaps? As in, making it have 5 columns by 3 rows, and then store each tile into an array? I want it be the full screen, except for the little space near the bottom wall of the screen (I'll have that be the options). I know that I have to make a draw method, like so: public void draw(Canvas canvas) { } and have it be rendered into my MainGamePanel, but how would I go about completing this? Thanks!
has comment: http://stackoverflow.com/comment/31538674
has comment: http://stackoverflow.com/comment/31535725
type: UnansweredQuestion

http://stackoverflow.com/comment/31572658
comment on: http://stackoverflow.com/a/21005436
score: 0
type: AnswerComment
type: Comment
has text: Yeah that's the thing. It's exactly that, only that it's not a constant value. Like, for each value of the switch in that moment, that's what's going to be added. If it's case 6, I want 6 to be added, I'm not sure but I think your first example doesn't do that. What I got so far: Ok I can't add enough code here, not enough characters. This is the array: final boolean[] posiciones=new boolean [4+Gruas.MAX_P_GRUA+Gruas.MIN_P_GRUA];

http://stackoverflow.com/comment/31569675
comment on: http://stackoverflow.com/q/21005544
has text: I don't understand the question. It looks like you probably want server application with web interface, but you are talking about mobile app. If you really just want some page with the function you mentioned and you want to go with Java, it can be done with tomcat and JSP.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31452165
has text: YOU ARE AWESOME <3 Literally! It worked. I just have one little question. I had the exact same thing but the only thing was that instead of the "guest", I had put: MODE_PRIVATE. Would you mind explaining the difference please? so I can learn the reason behind it and thank you so much, it worked like a charm!
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20942629

http://stackoverflow.com/comment/31283769
type: Comment
type: QuestionComment
has text: I've removed the `postgresql` tag, as Pg isn't really relevant here, it's just a technology that happens to be used. Should really close-vote as too broad, but meh.
comment on: http://stackoverflow.com/q/20854041
score: 0

http://stackoverflow.com/a/20951676
has comment: http://stackoverflow.com/comment/31493891
accepted answer of: http://stackoverflow.com/q/20951044
has comment: http://stackoverflow.com/comment/31468661
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31490568
has comment: http://stackoverflow.com/comment/31489898
type: Answer
answers question: http://stackoverflow.com/q/20951044
upvote count: 2
score: 1
downvote count: 1
has body: The line numbers in the stacktrace and the screen-shot don't line up properly. But in fact, the exception can only be thrown by the first five lines of the jk method anyway. (The rest is defining a callback method / object, and if an NPE was thrown by that code, the classname in the stack trace would be different.) I suggest that you add some more trace-prints, or use the debugger to figure out which statement is actually throwing the exception ... and work backwards to the source of the null. The javadoc for that method says: Returns the view in this page with the specified id. There is at most one view in the page with the specified id. Returns: the view, or null if none is found If you are getting a null from the cause, it follows that the id parameter is not correct. This may or may not be relevant, but you are passing "org.eclipse.jdt.ui.PackageExplorer" to find, but the ID for your SampleView class is "typesview.views.SampleView".

http://stackoverflow.com/comment/31322870
has text: Is this box overloaded, ie. does it have more ready threads than cores? Is the new thread in a different process? How much cache has to be reloaded? If the box is quiet, same process and no cache-load, making another thread running by signaling it takes about 5-7 microseconds on my Vista box. Other common scenarios will take longer.
score: 0
comment on: http://stackoverflow.com/q/20874209
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20940814
has body: I have a JPA Entity that has an attribute declared in the following way @OneToOne(cascade = CascadeType.MERGE, fetch = FetchType.EAGER) @JoinColumn(name = "userId", referencedColumnName = "id", insertable = false, updatable = false) private UserBare user; (UserBare is a dummy entity I've created which is a dumbed down version of a User obj as I needed some date, not all of User obj be made available to this entity. Is there a better way to approach this? This is a convenience attr that I use just make the userBare object available to this entity when reading this entity. But when I actually write this entity, it seems to create new entries of 'user' in the database (instead of updating). I already have insertable=false,updatable=false but it still writes to the database. I tried removing the CascadeType declaration but that is throwing an error. Here is the database snapshot after the unwanted rows are added (last 3). Also I've noticed that deleting the original entity did not delete these three unwanted rows. So I guess JPA is storing them but the references are intact to the original entity.
type: UnansweredQuestion
downvote count: 0
type: Question
score: 1
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/20969556
has title: JPA Read but not write/update an attribute
upvote count: 1
tagged with: jpa
answer count: 1
tagged with: jpa-2.0
favorite count: 0
has comment: http://stackoverflow.com/comment/31453018

http://stackoverflow.com/comment/31399670
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/20915027
type: Comment
has text: Where do you add the button by the way?

http://stackoverflow.com/q/20861426
has answer: http://stackoverflow.com/a/20861684
has comment: http://stackoverflow.com/comment/31297826
score: 0
linked to: http://stackoverflow.com/q/1757065
upvote count: 1
has comment: http://stackoverflow.com/comment/31306938
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/31297966
has comment: http://stackoverflow.com/comment/31297892
linked to: http://stackoverflow.com/q/3481828
duplicate of: http://stackoverflow.com/q/1757065
has comment: http://stackoverflow.com/comment/31297860
has comment: http://stackoverflow.com/comment/31298078
tagged with: java
has comment: http://stackoverflow.com/comment/31297840
accepted answer: http://stackoverflow.com/a/20861684
has body: I have a problem with splitting a sentence in Java input string : "retinol,\"3,7,11,15-tetramethyl-2,4,6,10,14-hexadecapentaenoic acid\",C034534,81485-25-8,\"Carcinoma, Hepatocellular\",MESH:D006528,Cancer|Digestive system disease,,17270033,therapeutic"; and i want to split it and get splitted terms like as follows ; retinol 3,7,11,15-tetramethyl-2,4,6,10,14-hexadecapentaenoic acid C034534 81485-25-8 Carcinoma, Hepatocellular MESH:D006528 Cancer|Digestive system disease (nothing) 17270033 therapeutic I tried few way to solve this problem such as Pattern/Matcher and split(",")[] etc.. But, i couldn't find the answer..
has title: How can i split this string in Java?
has comment: http://stackoverflow.com/comment/31297802
type: AnsweredQuestion
favorite count: 0
has comment: http://stackoverflow.com/comment/31297746
type: Question
has comment: http://stackoverflow.com/comment/31307075
has comment: http://stackoverflow.com/comment/31297959
tagged with: regex
has comment: http://stackoverflow.com/comment/31297809
linked to: http://stackoverflow.com/q/4751539

http://stackoverflow.com/comment/31404352
type: Comment
type: QuestionComment
has text: As for the application @PakkuDon, she's been using it everywhere... Not just in System.out.println(a.trim());
comment on: http://stackoverflow.com/q/20917616
score: 0

http://stackoverflow.com/a/20931470
has body: I believe that your problem is that you've neglected to model camera pose. Picture a cube floating in a room somewhere. Got it? Now in your mind, draw a Cartesian coordinate system, rigidly attached to the cube, with the x- and z-axes in the horizontal plane, and the y-axis pointing toward the ceiling. Since the camera is the thing which is moving around in your example code, you may equally well choose to visualize the cube's coordinate system as being rigidly attached to the room if you would prefer. Now, picture the camera moving around, looking at the cube from different angles. Imagine a separate Cartesian coordinate system rigidly attached to that as well. It has an x-axis that points out the right side of the camera, a y-axis that points out the top, and a z-axis that points out the back (i.e., toward your face as you are looking through the viewfinder). As you walk around the cube holding the camera, it has to rotate about the y-axis in order to keep facing the cube. Assuming you hold the camera upright, the camera's y-axis will always remain parallel with the cube's y-axis, but the relationship between the two x- and z-axes will change over time. This relationship, between the three axes of two Cartesian coordinate frames, may be thought of as the camera's "orientation" or "pose", and you are not currently modeling it. In order to model the pose, you need a 3X3 matrix. If you don't know much about the mathematics of coordinate frame rotations, I'd recommend that you study up here and here and here. I've added the pose model as a 3X3 rotation matrix in your Camera class, and updated the Universe class to be able to take advantage of it. The Main class remains unchanged. The new Camera class is here: public class Camera { // both measures in meters public final double focalLength = 50e-3; public final double[] frame = {36e-3, 24e-3}; public double[] position; // The rotation vector gives the unit vector directions, in the coordinate // frame of the object, of…
score: 0
answers question: http://stackoverflow.com/q/20926643
type: Answer
accepted answer of: http://stackoverflow.com/q/20926643
type: AcceptedAnswer

http://stackoverflow.com/q/20877086
has title: Why do == comparisons with Integer.valueOf(String) give different results for 127 and 128?
has comment: http://stackoverflow.com/comment/124649207
type: Question
has answer: http://stackoverflow.com/a/20877115
possible better answer: http://stackoverflow.com/a/20877283
has answer: http://stackoverflow.com/a/20877283
tagged with: comparison
has answer: http://stackoverflow.com/a/20877161
accepted answer: http://stackoverflow.com/a/20877115
has comment: http://stackoverflow.com/comment/31385790
has body: I have no idea why these lines of code return different values: System.out.println(Integer.valueOf("127")==Integer.valueOf("127")); System.out.println(Integer.valueOf("128")==Integer.valueOf("128")); System.out.println(Integer.parseInt("128")==Integer.valueOf("128")); The output is: true false true Why does the first one return true and the second one return false? Is there something different that I don't know between 127 and 128? (Of course I know that 127 &lt; 128.) Also, why does the third one return true? I have read the answer of this question, but I still didn't get how it can return true, and why the code in second line returns false.
has comment: http://stackoverflow.com/comment/31360937
score: 187
linked to: http://stackoverflow.com/q/508665
has comment: http://stackoverflow.com/comment/31343248
linked to: http://stackoverflow.com/q/9824053
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/20879606
has comment: http://stackoverflow.com/comment/31532828
tagged with: integer
has answer: http://stackoverflow.com/a/20889556
type: AnsweredQuestion
upvote count: 194
tagged with: java
has comment: http://stackoverflow.com/comment/31533635
has comment: http://stackoverflow.com/comment/31532900
downvote count: 7

http://stackoverflow.com/a/20853070
downvote count: 1
answers question: http://stackoverflow.com/q/20852946
upvote count: 0
has comment: http://stackoverflow.com/comment/31281919
type: Answer
score: -1
has body: maybe the jar shouldn't be placed in .m2 folder, it should be placed in where it should be. Please use mvn -X to print debug information, maybe some clues would be found.

http://stackoverflow.com/q/20895554
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31362514
has answer: http://stackoverflow.com/a/20895863
score: 0
tagged with: flowlayout
has title: Change button size FlowLayout
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/31362568
tagged with: jbutton
tagged with: java
has answer: http://stackoverflow.com/a/20895838
has body: I'm trying to change button size but when I set width, height automatically changes too even though height has own value. How can I change only width (or height)? I need this to my "reset" and "calc" buttons. Code (without unnecessary other code) class Wind extends JButton { //declaration of variables @Override public Dimension getPreferredSize() { Dimension d = super.getPreferredSize(); int s = (int) (d.getWidth() &lt; d.getHeight() ? d.getHeight() : d.getWidth()); return new Dimension(s, s); } public static void main(final String[] args) { Runnable r = new Runnable() { @Override public void run() { JComponent gui = new JPanel(new FlowLayout()); for (int ii = 1; ii &lt; 20; ii++) { final JButton button = new Wind(""); gui.add(button); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); } gui.setBorder(new EmptyBorder(4, 3, 4, 8)); final JButton reset = new Wind("Reset"); Dimension dim = new Dimension(40,80); reset.setPreferredSize(dim); gui.add(reset); reset.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); JFrame f = new JFrame("Name of my frame"); f.add(gui); final JButton cal = new Wind("Calc"); gui.add(cal); cal.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); f.setLocationByPlatform(true); f.pack(); f.setVisible(true); f.setSize(350, 450); f.setResizable(false); } }; SwingUtilities.invokeLater(r); } }

http://stackoverflow.com/a/20940915
has comment: http://stackoverflow.com/comment/31449121
has comment: http://stackoverflow.com/comment/31449108
score: 5
has comment: http://stackoverflow.com/comment/31449086
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20940898
has comment: http://stackoverflow.com/comment/31448983
accepted answer of: http://stackoverflow.com/q/20940898
type: Answer
has body: You should specify your listening ip to 127.0.0.1 thus it wont be possible to connect from the outside. Edit Looking at the example ChatServer.java the binding happens with ChatServer s = new ChatServer( port ); The class implements two constructors: public ChatServer( int port ) throws UnknownHostException { super( new InetSocketAddress( port ) ); } public ChatServer( InetSocketAddress address ) { super( address ); } So you could also call the server with an inetSocketAddress. Create one thats binds to localhost: new ServerSocket(9090, 0, InetAddress.getByName(null)); and then call the server with that instead of just the port. So replace ChatServer s = new ChatServer( port ); with InetSocketAddress myLocalSocket = new ServerSocket(9090, 0, InetAddress.getByName(null)); ChatServer s = new ChatServer( myLocalSocket ); in your example and it should work.
upvote count: 5
downvote count: 0

http://stackoverflow.com/a/20987385
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/31538536
has comment: http://stackoverflow.com/comment/31536813
answers question: http://stackoverflow.com/q/20987346
has comment: http://stackoverflow.com/comment/31536726
has comment: http://stackoverflow.com/comment/31538422
has comment: http://stackoverflow.com/comment/31536447
has comment: http://stackoverflow.com/comment/31536013
has comment: http://stackoverflow.com/comment/31536383
has comment: http://stackoverflow.com/comment/31536049
downvote count: 0
has comment: http://stackoverflow.com/comment/31540738
has comment: http://stackoverflow.com/comment/31536515
has body: Please check if you configured your maven in eclipse properly 1. Go to preference-->Maven-->Installation In this add the path of working maven directory 2. Go to preference-->Maven-->User Setting In this add the path of your maven_directory/conf/setting.xml Try with these setting let us know if it works...cheers
type: Answer

http://stackoverflow.com/a/20970215
score: 2
has comment: http://stackoverflow.com/comment/31504514
has comment: http://stackoverflow.com/comment/31506415
has body: IMHO Unit tests are not production code and don't have to be held up the same standard. You can easy refactor and delete test code without direct impact on production. For me, DRY make sense for production code, but WET (Write Everything Twice) also works in unit test code. To directly answer your question, you could use a loop, and you could combine the tests, but I suspect they don't help much. e.g. @Test public void firstNameMaxPermittedLength() { Userdata userdata = minimumRequirements(); userdata.setFirstName(utf8Chars(64)); assertNoViolations(cut.validate(userdata)); userdata.setFirstName(utf8Chars(65)); assertSingleViolation(cut.validate(userdata)); }
answers question: http://stackoverflow.com/q/20969830
has comment: http://stackoverflow.com/comment/31505850
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/20969830
has comment: http://stackoverflow.com/comment/31507012

http://stackoverflow.com/comment/31542584
score: 0
type: Comment
type: QuestionComment
has text: The resource you're invoking, are you sure it returns an array of objects or just a single one?
comment on: http://stackoverflow.com/q/20991386

http://stackoverflow.com/comment/74475474
comment on: http://stackoverflow.com/a/21016624
has text: Shouldn't /*Run at 3:30PM of every Friday of month*/ be: "0 30 15 ? * 6"?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31433101
type: Comment
comment on: http://stackoverflow.com/a/20933001
score: 1
type: AnswerComment
has text: You must be psychic, because I have no idea what the question actuallyis

http://stackoverflow.com/q/20980149
score: 0
has comment: http://stackoverflow.com/comment/31522318
has comment: http://stackoverflow.com/comment/31522343
has comment: http://stackoverflow.com/comment/31523159
answer count: 1
has comment: http://stackoverflow.com/comment/31522446
tagged with: generics
has body: Hi in a practice paper for revision I've been given this question. The class BinaryTree in Question 3 stores integers in a binary tree structure, and method isInOrder() tests whether the top label of the tree is greater than the top label of the left subtree and smaller than the top label of the left subtree. A generic form of that class could store instances of any class that implements the Comparable interface: public interface Comparable&lt;T&gt; { public int compareTo(T o); } Where instance.compareTo(arg) returns a negative value if instance is less than arg, 0 if instance and arg are equal, and a positive value if instance is greater than arg. For example, class Integer implements Comparable with instance.compareTo(arg) returning instance - arg. (a) Give a generic version of class BinaryTree that stores instances of a type parameter E, with the requirement that E extends Comparable. Note that you will need to change the code in the isInOrder() method so that it uses compareTo(). Do not include a main method in your answer. The code from the earlier question is here http://pastebin.com/x2p7q3wy I'm really having trouble wrapping my head around what I have to do for the question and most of the information I have been able to find on generics has just confused me. If anyone could help me with this question or give me a good introduction to generic classes I would be very thankful.
tagged with: binary-search-tree
accepted answer: http://stackoverflow.com/a/20980683
type: AnsweredQuestion
has title: Give a generic version of class BinaryTree that stores instances of a type parameter E
has comment: http://stackoverflow.com/comment/33608484
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31522386
has answer: http://stackoverflow.com/a/20980683

http://stackoverflow.com/comment/31295673
comment on: http://stackoverflow.com/q/20860380
score: 0
has text: what error are you getting?
type: QuestionComment
type: Comment

http://stackoverflow.com/q/20965772
has comment: http://stackoverflow.com/comment/31495365
score: -1
has body: Ca someone explain to me why I get a null pointer exception ? private Observer obs1; private Observer obs2; public void notifyObservers(Observable observable) { String str1 = "Observer 1 :\n"; String str2 = "Observer 2 :\n"; try { Student[] studList = returnStudents(); for (int i=0;i&lt;returnStudents().length;i++) { if(studList[i].computeAverage() &gt;= 5) str1 = str1 + studList[i].toString() + "\n"; else str2 = str2 + studList[i].toString() + "\n"; } } catch (MyException ex) { System.out.println(ex.getMessage()); } obs1.update(observable, str1); obs2.update(observable, str2); } And my Observer class: public class Watcher implements Observer { public void update(Observable arg0, Object arg1) { System.out.println("The list of students has changed"); System.out.println(arg1); } } I will explain a little wwhat is happening here. I have made a program that manages a list of students.I can add/delete a students. After each add I call setChanged(); notifyObservers(this); Here I want that observer1 to show the studens with a average of grades > 5 and observer2 to show the ones with average &lt; 5. I'm getting a null pointer exception in here: obs1.update(observable, str1); I must say that I tried to print str1 and str2 and they contain the list of students. So my guess is that the problem is at observable
tagged with: nullpointerexception
answer count: 1
has answer: http://stackoverflow.com/a/20965802
favorite count: 0
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/20965802
downvote count: 2
upvote count: 1
has title: Observable in java is null
has comment: http://stackoverflow.com/comment/31495354
type: Question

http://stackoverflow.com/comment/31361016
has text: @OliCharlesworth - Thanks for that. I added something about it to my answer.
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/20894654

http://stackoverflow.com/comment/31278403
score: 0
type: Comment
type: QuestionComment
has text: That sounds pretty broken. It works fine for me. Take a look at Editor -> Code Completion in your Intellij preferences. Are the relevant things enabled?
comment on: http://stackoverflow.com/q/20851133

system-calls
type: Tag
tags question: http://stackoverflow.com/q/20982664
tag name: system-calls

http://stackoverflow.com/comment/31401528
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20915365
type: Comment
has text: How is `Date` at all unsuitable for the OP's use case? Either way, Joda Time is a replacement for what `java.util.Calendar` does, rather than what `Date` is supposed to be. (Mostly a strongly typed wrapper around a `long`.)

http://stackoverflow.com/comment/31316516
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20871014
has text: It doesn't matter. You can just put it in your home directory, or anywhere you like. Then refer to its path in the argument after "hadoop jar"
type: Comment

http://stackoverflow.com/comment/31291993
has text: I inputted 1,a and got h
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20858484

http://stackoverflow.com/comment/31371455
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20900604
has text: Your answer sounds good. but In my project i have two basicdatasource server and client. So Give some example link how can i connect through programmetically setting up users details about database.
type: AnswerComment

http://stackoverflow.com/comment/31340739
has text: IMO there is no actual limit other than memory size. You might want to check this - http://stackoverflow.com/questions/12639118/jdbc-batch-performance .
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20883964
score: 1

http://stackoverflow.com/comment/31645766
type: Comment
has text: @Kaushalpanchal42 you will probably need to add a `<classpath>` to the `taskdef` pointing to the xmltask JAR file.
type: AnswerComment
comment on: http://stackoverflow.com/a/21025974
score: 0

http://stackoverflow.com/comment/31529238
has text: If you think I should start a new question - just let me know - I just need to figure out how to get this if / switch statement working in my current implementation : ) (I really appreciate your help BTW!)
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20982407

http://stackoverflow.com/comment/31530845
type: Comment
has text: Thanks. I just updated the question with a note. I additionally want to be able to detect the `ID` of the color name that user would click. So, if i just overwrite the `toString` I wouldn't be able to do detect which `ID` user clicked on right..?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20984484

http://stackoverflow.com/q/20926599
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/31422452
has comment: http://stackoverflow.com/comment/31421921
has title: Why are my numbers not adding up when I win in my game?
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/31421312
has comment: http://stackoverflow.com/comment/31439950
downvote count: 2
has comment: http://stackoverflow.com/comment/31421364
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31421582
has answer: http://stackoverflow.com/a/20927213
has body: In my game the computer has to generate 4 random colors.The user is then supposed to guess any of 4 colors in the options. If the user guesses one of the 3 computer generated colors right they get a point.I dont know why my points are not adding up. MY CODE: static String word,word2,word3; static int correct; public static void main(String[] args)throws IOException { // TODO code application logic here //Intialize BufferReader BufferedReader br= new BufferedReader(new InputStreamReader(System.in)); // TODO code application logic here System.out.println("Guess the blocks\n================="); System.out.println("Enter your first guess(R,G,B,Y):"); String guess1=br.readLine(); System.out.println("Enter your second guess(R,G,B,Y):"); String guess2=br.readLine(); System.out.println("Enter your third guess(R,G,B,Y):"); String guess3=br.readLine(); System.out.println("Your guess= "+guess1+guess2+guess3); int compcolor1=color1(); int compcolor2=color2(); int compcolor3=color3(); computerColours( compcolor1,compcolor2,compcolor3); int letter=guess1.charAt(0); int letter2=guess2.charAt(0); int letter3=guess3.charAt(0); checkColoursCorrect(letter ,letter2,letter3, compcolor1,compcolor2,compcolor3); } public static int color1() { int randnum=(int) ((Math.random()*4)+1); return randnum; } public static int color2() { int randnum=(int) ((Math.random()*4)+1); return randnum; } public static int color3() { int randnum=(int) ((Math.random()*4)+1); return randnum; } static void computerColours(int compcolor1,int compcolor2,int compcolor3){ if(compcolor1==1){ word="R"; } else if(compcolor1==2){ word="G"; } else if(compcolor1==3){ word="B"; } else if(compcolor1==4){ word="Y"; } if(compcolor2==1){ word2="R"; } else if(compcolor2==2){ word2="G"; } else if(compcolor2==3){ word2="B"; } else if(compcolor2==4){ word2="Y"; } if(compcolor3==1){ word3="R"; } else if(compcolor3==2){ word3="G"; } else if(compcolor3==3){ word3="B"; } else if(compcolor3==4){ word3="Y"; } System.out.println("Comp g…
has comment: http://stackoverflow.com/comment/31439342
has comment: http://stackoverflow.com/comment/31421571
upvote count: 0

http://stackoverflow.com/comment/31488615
type: QuestionComment
has text: @JavaDevil somebody gave the answer already, however, the reason I made the comment in the first place is related with the fact of the return statements and not with the answer. That's why I comment and didnt answer the question.
score: 0
comment on: http://stackoverflow.com/q/20961762
type: Comment

apache
tags question: http://stackoverflow.com/q/20922285
tag name: apache
tags question: http://stackoverflow.com/q/20964150
tags question: http://stackoverflow.com/q/20904931
tags question: http://stackoverflow.com/q/20896124
tags question: http://stackoverflow.com/q/20992659
tags question: http://stackoverflow.com/q/20969120
tags question: http://stackoverflow.com/q/20852119
tags question: http://stackoverflow.com/q/20914239
tags question: http://stackoverflow.com/q/20870872
tags question: http://stackoverflow.com/q/20897704
tags question: http://stackoverflow.com/q/20993503
tags question: http://stackoverflow.com/q/20914311
tags question: http://stackoverflow.com/q/20872691
tags question: http://stackoverflow.com/q/20899993
tags question: http://stackoverflow.com/q/21010951
tags question: http://stackoverflow.com/q/20885370
tags question: http://stackoverflow.com/q/20954322
tags question: http://stackoverflow.com/q/20912282
type: Tag
tags question: http://stackoverflow.com/q/20927290
tags question: http://stackoverflow.com/q/20898349
tags question: http://stackoverflow.com/q/20877706
tags question: http://stackoverflow.com/q/20958580
tags question: http://stackoverflow.com/q/20984786
tags question: http://stackoverflow.com/q/20910632
tags question: http://stackoverflow.com/q/20951546
tags question: http://stackoverflow.com/q/21017727
tags question: http://stackoverflow.com/q/20899050
tags question: http://stackoverflow.com/q/21013486

http://stackoverflow.com/comment/31298057
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20861564
has text: Andrew, but applet which I want to access is inside of first jar, can I write archive like this : `archive = "main.jar, applets.jar"`
score: 0

http://stackoverflow.com/q/20870353
has comment: http://stackoverflow.com/comment/31315106
has answer: http://stackoverflow.com/a/20870394
tagged with: arrays
downvote count: 0
linked to: http://stackoverflow.com/q/7118178
tagged with: variables
favorite count: 0
has comment: http://stackoverflow.com/comment/31314924
possible better answer: http://stackoverflow.com/a/20870401
has body: Is there a method in Java for setting all values in a boolean array to true? Obviously I could do this with a for loop, but if I have (for example) a large 3D array, I imagine using a loop would be quite inefficient. Is there any method in Java to set all values in a certain array to true, or alternatively to set all values to true when the array is initialised? (e.g boolean[][][] newBool = new boolean[100][100][100]; newBool.setAllTrue(); //Rather than for(int a = 0; a &lt; 100; a++) { for(int b = 0; b &lt; 100; b++) { for(int c = 0; c &lt; 100; c++) { newBool[a][b][c] = true; } } }
has answer: http://stackoverflow.com/a/20870442
answer count: 4
upvote count: 13
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20870401
linked to: http://stackoverflow.com/q/9128737
tagged with: java
score: 13
has title: Setting all values in a boolean array to true
type: Question
has comment: http://stackoverflow.com/comment/31314889
accepted answer: http://stackoverflow.com/a/20870394
has comment: http://stackoverflow.com/comment/31314899
tagged with: boolean
has comment: http://stackoverflow.com/comment/31315160
has answer: http://stackoverflow.com/a/68700720

http://stackoverflow.com/a/20946666
has body: to Find the difference between 2 dates , you can compare the values. covert dates into Value(long) and than compare rather than using Arithmetic operation like subtraction etc. public class CompareObjects implements Comparator { @Override public int compare(classA c1, classA c2) { long value1 = c1.getDate().getTime(); long value2 = c2.getDate().getTime(); if (value2 &gt; value1) { return 1; } else if (value1 &gt; value2) { return -1; } else { return 0; } } public static void main(String[] args) { classA o1 = new classA(); o1.setDate(new Date()); classA o2 = new classA(); o2.setDate(new Date()); CompareObjects compare = new CompareObjects(); int i = compare.compare(o1, o2); System.out.println(" Result : " + i); } } or without converting you can directly return the result. return c2.getDate().compareTo(c1.getDate()); after comparison you can use Collection.sort method to set the order.
upvote count: 1
answers question: http://stackoverflow.com/q/20946128
has comment: http://stackoverflow.com/comment/31460457
accepted answer of: http://stackoverflow.com/q/20946128
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31460529

http://stackoverflow.com/comment/31432663
score: 0
has text: What have you done so far? Where is the problem? How do you parse pdf and word files? How do you display them in swing?
comment on: http://stackoverflow.com/q/20932764
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31923221
type: QuestionComment
has text: Can you say more about your database?
comment on: http://stackoverflow.com/q/21003209
score: 0
type: Comment

http://stackoverflow.com/q/20978998
has title: How to find total number of siblings using Jsoup
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20979184
tagged with: java
type: Question
tagged with: jakarta-ee
tagged with: jsoup
score: 0
answer count: 1
has body: I need to find the total number of siblings in label class and if sibling exists have to append as string..please guide me.. About Us: Hayley’s is one of Sri Lanka ’s largest multinational business conglomerates with a history spanning 135 years. Commencing commercial operations in 1878 as Chas. P. Hayley and Company incorporated as Hayley’s Limited 61 years ago. We drive a globally competitive business portfolio encompassing 12 defined sectors of enterprise cutting across manufacturing, Industrial solutions, agriculture and services etc. www.Hayleys.com Haycolour (Pvt) Ltd is one of the largest manufactures for Pigment Emulsion in Textile printing Industry in Sri Lanka, Garment panel printing, Latex, Inks and water base paints. We supply to local Textile Printing industry and also export to Asian region, such as Bangladesh, Thailand, Malaysia, Philippines and Pakistan and are open to the rest of the world’s market. Haycolour (Pvt) Limited is a fully owned subsidiary of Hayley’s PLC, Sri Lankas premier blue chip conglomerate. www.haycolour.com , (Site under construction) Haycolour Products are certified by prestigious Hohenstein Institute of Germany for Eco Passport, and Haycolour is proud to be the first Sri Lanka n company to be certified and this proves the stint quality assurance procedures that we have instituted to make our offerings internationally competitive. As an advantage derived through this certification, any Sri-Lankan Supplier/our customer who applies for Okeo Tex 100 certification can use our products and there is no need to test our pigments for Okeo Tex compliances. Eco Passport is worldwide certification on the chemical compliance of production of human ecological optimized textiles. Our product are compliances with free of APEO, AZO, Formaldehyde, Phthalates, heavy metals etc. And our pigment emulsions are certified to use on baby Garments which is another significant factor. As a South Asian country manufacturing Pigment Emulsions to be used in…

http://stackoverflow.com/q/20974567
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/20974668
has body: I'm developing an app, a Task Viewer with a checkbox. I can add Tasks but no delete. How I can delete them? I would if they are checked when I press delete they be erased. TaskerDbHelper public class TaskerDbHelper extends SQLiteOpenHelper { private static final int DATABASE_VERSION = 1; // Database Name private static final String DATABASE_NAME = "taskerManager"; // tasks table name private static final String TABLE_TASKS = "tasks"; // tasks Table Columns names private static final String KEY_ID = "id"; private static final String KEY_TASKNAME = "taskName"; private static final String KEY_STATUS = "status"; public TaskerDbHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { String sql = "CREATE TABLE IF NOT EXISTS " + TABLE_TASKS + " ( " + KEY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + KEY_TASKNAME + " TEXT, " + KEY_STATUS + " INTEGER)"; db.execSQL(sql); } @Override public void onUpgrade(SQLiteDatabase db, int oldV, int newV) { // Drop older table if existed db.execSQL("DROP TABLE IF EXISTS " + TABLE_TASKS); // Create tables again onCreate(db); } // Adding new task public void addTask(Task task) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(KEY_TASKNAME, task.getTaskName()); // task name // status of task- can be 0 for not done and 1 for done values.put(KEY_STATUS, task.getStatus()); // Inserting Row db.insert(TABLE_TASKS, null, values); db.close(); // Closing database connection } public List&lt;Task&gt; getAllTasks() { List&lt;Task&gt; taskList = new ArrayList&lt;Task&gt;(); // Select All Query String selectQuery = "SELECT * FROM " + TABLE_TASKS; SQLiteDatabase db = this.getWritableDatabase(); Cursor cursor = db.rawQuery(selectQuery, null); // looping through all rows and adding to list if (cursor.moveToFirst()) { do { Task task = new Task(); task.setId(cursor.getInt(0)); task.setTaskName(cursor.getString(1)); task.setSta…
answer count: 1
favorite count: 0
tagged with: android
tagged with: checkbox
has title: Delete the ticked tasks in Checkbox
upvote count: 0
type: UnansweredQuestion
downvote count: 2
type: Question

http://stackoverflow.com/comment/31471514
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20930827
type: AnswerComment
has text: sorry it was supposed to be /user, I fixed it in my original post now. When I did all the commands though, I was correctly using /user, I just wrote it wrong in my description above.

http://stackoverflow.com/comment/31567526
has text: Can you show `Alert` class? The message is clear, some class is missing from classpath
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21004786
score: 0

http://stackoverflow.com/comment/31363926
has text: Continuing this would be a bit futile. Amy has a book. She should just follow the advice in her book.
comment on: http://stackoverflow.com/a/20896204
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31536795
score: 0
has text: Are `a` and `b` fields, method parameters, local variables, ...?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20987910

http://stackoverflow.com/comment/31687333
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21033702
has text: Thanks, this answer help me a lot. i didn't know what were the release groups about and now i will test them

http://stackoverflow.com/q/20859278
score: 3
has answer: http://stackoverflow.com/a/20859443
accepted answer: http://stackoverflow.com/a/20859443
possible better answer: http://stackoverflow.com/a/20859442
tagged with: java
upvote count: 3
has answer: http://stackoverflow.com/a/20859442
has answer: http://stackoverflow.com/a/20859479
favorite count: 0
answer count: 5
tagged with: regex
has answer: http://stackoverflow.com/a/20862313
has body: How can I split the following in Java: (1,2),(3,4),(5,6) into: 1,2 3,4 5,6 I have tried: test.split("(?&lt;=\\()(.*)(?=\\))"); with no luck.
type: AnsweredQuestion
has title: Regex split up parentheses group
downvote count: 0
has answer: http://stackoverflow.com/a/20859678
type: Question

http://stackoverflow.com/comment/31355960
score: 0
type: Comment
type: QuestionComment
has text: This may depend on the on the type of project you created. For example, a Java Library will not include the project dependencies as part of its build process but a Java Application will. These are placed in the dist directory of your project. Under the project properties, you can specify the working directory that netbeans will use when it runs your project, but this has no bearing on the built project
comment on: http://stackoverflow.com/q/20892040

http://stackoverflow.com/q/20986124
tagged with: java
downvote count: 3
possible better answer: http://stackoverflow.com/a/20986150
has title: Java cannot get one class inherit from another
has comment: http://stackoverflow.com/comment/31533839
favorite count: 0
has body: Ok, I have 2 classes that need to inherit from another class.. When I move id fields over it says that it cannot access that fields as it is private. so I call the public get method... but it still doesnt work. What I need to do is move all field into vehicle and make taxi + shuttle to inherit from it public class Vehicle { // A unique ID private String id; // The destination private String destination; // The location of this taxi. private String location; /** *Constructor for vehicle */ public Vehicle(String id) { this.id=id; }
answer count: 5
accepted answer: http://stackoverflow.com/a/20986197
has answer: http://stackoverflow.com/a/20986155
has answer: http://stackoverflow.com/a/20986326
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/20986197
has answer: http://stackoverflow.com/a/20986150
score: -3
type: Question
has answer: http://stackoverflow.com/a/20986306

http://stackoverflow.com/comment/31426122
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/20929077
has text: @noobcoder if that's the case, do some reading and make sure you know how to implement BFS/DFS - those are two basic algorithms which you should be able implement easily when you're interviewing. Once you've mastered BFS and DFS it'll be very easy for you to solve this question . Trust me on this one!

http://stackoverflow.com/a/21018907
has comment: http://stackoverflow.com/comment/31593754
has comment: http://stackoverflow.com/comment/31593216
score: 1
has comment: http://stackoverflow.com/comment/31593548
has body: New answer to edited question: You can't in Java. If need to pretend that the request is coming from 127.0.0.1 (the server itself), so you'll need to hack into the network stack of your operating system. Old answer: The IP Address your client uses to connect to the server depends on the network interface it uses and the kind of network attached to this network interface. Example: If your client is a laptop it most likely has only one network interface. This network interface uses 192.168.1.10 as its IP address (e.g., assigned from the DHCP on your router) as its internal IP address. Your router might also be connected to the internet, with an IP, say 20.20.20.20, which it shares with connected devices via NAT. If you use this to connect to your server which is on your local network, the client's IP address that the server sees will be 192.168.1.10; if you connect to your server which is not on your local network but somewhere on the internet, your client's IP (that the server sees) will be 20.20.20.20 So you cannot make your client pretend to use 127.0.0.1 (if server and client are running on the same machine, your client will most likely have 127.0.0.1). Of course there are techniques like IP spoofing where you pretend to have a different IP than you actually have, but that's totally different issue.
has comment: http://stackoverflow.com/comment/31593413
type: Answer
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21018682
has comment: http://stackoverflow.com/comment/31598754

http://stackoverflow.com/comment/31540631
has text: hmm do I have to include something else? the jar is in the lib folder and it is already checked in the exported tab?
comment on: http://stackoverflow.com/q/20973238
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31355932
type: Comment
has text: You'll have to research more and split your problem into smaller chunks if you want to find answers on SO. Your question / problem includes UI representation, some sort of network protocol (probably even a way to discover your module within the WiFi network), a server daemon running on your module, etc..
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/20891562

proguard
tags question: http://stackoverflow.com/q/20915646
tags question: http://stackoverflow.com/q/20896538
tag name: proguard
type: Tag
tags question: http://stackoverflow.com/q/20915866
tags question: http://stackoverflow.com/q/20910593
tags question: http://stackoverflow.com/q/20999081

http://stackoverflow.com/a/21001632
has body: The problem is that when I add the code to modify the JButton, none of the changes happen until after the validation has completed. Your code is executing on the EDT, so you long running code prevents the GUI from repainting itself until the task is finished executing. You need to use a separate Thread for the long running task, maybe a SwingWorker. Read the section from the Swing tutorial on Concurrency for more information.
type: Answer
has comment: http://stackoverflow.com/comment/31562092
upvote count: 4
has comment: http://stackoverflow.com/comment/31561881
accepted answer of: http://stackoverflow.com/q/21001466
has comment: http://stackoverflow.com/comment/31561510
answers question: http://stackoverflow.com/q/21001466
downvote count: 0
has comment: http://stackoverflow.com/comment/31561458
has comment: http://stackoverflow.com/comment/31561690
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31561943
score: 4
has comment: http://stackoverflow.com/comment/31561447

http://stackoverflow.com/q/20971932
type: Question
has title: Locale is not changing for Spring 2.5 i18n project
tagged with: java
has comment: http://stackoverflow.com/comment/31507460
has comment: http://stackoverflow.com/comment/31510513
has comment: http://stackoverflow.com/comment/31518699
upvote count: 1
has body: I am trying to apply I18n for the existing Spring 2.5 application. The below is the application-context.xml SYSTEM_PROPERTIES_MODE_OVERRIDE classpath:Classification-System.properties classpath:classification/Strings If i login the application, if i apply lang=es_ES for the url, it's showing english locale strings only eventhough locale is spanish I configured Strings.properties,Strings_es_ES.properties, Strings_en_GB.properties in classification folder of src/resouce/ with common key and diferent values. Any one could you help me? my web.xml is openSessionInView org.springframework.orm.hibernate3.support.OpenSessionInViewFilter sessionFactoryBeanName classificationSessionFactory flushMode AUTO org.springframework.web.context.ContextLoaderListener contextConfigLocation classpath:application-context.xml CXFServlet org.apache.cxf.transport.servlet.CXFServlet 1 classifierweb org.springframework.web.servlet.DispatcherServlet 2 sitemesh com.opensymphony.module.sitemesh.filter.PageFilter openSessionInView /* sitemesh *.html CXFServlet /ws/* classifierweb *.html index.html could you pls any one help me? here is classifierweb-servlet.xml zips CATEGORY AGE_RANGE PRICE_RANGE NATIONALITY LOCATION_TYPE CHANNEL CATEGORY AGE_RANGE PRICE_RANGE NATIONALITY LOCATION_TYPE CHANNEL classpath:classification/Strings
favorite count: 0
type: UnansweredQuestion
tagged with: spring
tagged with: internationalization
has comment: http://stackoverflow.com/comment/31512279
answer count: 0
downvote count: 0
score: 1

http://stackoverflow.com/comment/31490691
type: QuestionComment
comment on: http://stackoverflow.com/q/20962762
score: 0
has text: @Liondancer, it should be root.addNode(root,b) not root.addNode(root.b), that's how you typed it in your comments. is that the case or it's just a typo?
type: Comment

http://stackoverflow.com/comment/31302823
score: 0
type: QuestionComment
has text: Uh, you sure you want to call `dispose()` after creating your applet? Also, you are not adding the applet to anything...
type: Comment
comment on: http://stackoverflow.com/q/20863709

http://stackoverflow.com/q/20988137
has body: I was going through article on Externalization on this site and I found the following para in the limitations of Externalization section. As you know a default public no-arg constructor will be called when serializing the objects that implements Externalizable interface. Hence, Externalizable interface can't be implemented by Inner Classes in Java as all the constructors of an inner class in Java will always accept the instance of the enclosing class as a prepended parameter and therefore you can't have a no-arg constructor for an inner class. Inner classes can achieve object serialization by only implementing Serializable interface. I tested this and turns out this is not valid. Inner classes can have no argument constructor and also they can implement Externalizable interface. Even tried it with local classes. Works fine. public class ExternalizeDemo { class InnerClass implements Externalizable{ public InnerClass() { //default no-arg inner class constructor } @Override public void writeExternal(ObjectOutput out) throws IOException { //logic to save object state } @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { //logic to retrieve object state } } public void localClassTest(){ class LocalClass implements Externalizable{ public LocalClass(){ //default no-arg local class constructor } @Override public void writeExternal(ObjectOutput out) throws IOException { //logic to save object state } @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { //logic to retrieve object state } } } } So either I am missing some point or the article paragraph is no longer valid (I am using Java 7). So which one is it. Any suggestion is appreciated.
has comment: http://stackoverflow.com/comment/31537280
has answer: http://stackoverflow.com/a/40704997
has answer: http://stackoverflow.com/a/20989046
type: AnsweredQuestion
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31537448
has comment: http://stackoverflow.com/comment/31537470
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31539059
possible better answer: http://stackoverflow.com/a/40704997
score: -1
has comment: http://stackoverflow.com/comment/31537278
tagged with: externalizable
has title: Externalization with inner classes
answer count: 2
accepted answer: http://stackoverflow.com/a/20989046
favorite count: 0

app-store
tag name: app-store
type: Tag
tags question: http://stackoverflow.com/q/21008617

http://stackoverflow.com/q/20946817
tagged with: primefaces
tagged with: java
type: Question
answer count: 1
has body: I am using Primefaces 4.0 with JSF 2.0 i have a tree and i want to perform specific action on the child node not on the parent node, my code is like: &lt;h:form id="form"&gt; &lt;p:tree id="tree" value="#{treeBean.embargoRoot}" var="node" animate="true" &gt; &lt;p:treeNode id="treeNode"&gt; &lt;p:commandButton value="#{node}" action="#{xmlReader.getRead()}" id="treeNode"/&gt; &lt;/p:treeNode&gt; &lt;/p:tree&gt; &lt;/h:form&gt;' Tree Class public TreeClass(){ root = new DefaultTreeNode("", null); TreeNode p1 = new DefaultTreeNode("Parent 1", root); TreeNode p2 = new DefaultTreeNode("Parent 2", root); TreeNode c1= new DefaultTreeNode("Child 1", p1); TreeNode c2= new DefaultTreeNode("Child 2", p1); TreeNode c3= new DefaultTreeNode("Child 1", p2); TreeNode c4= new DefaultTreeNode("child 2", p2); } my aim is to perform specific task on child click only Thanks in Advance
score: 0
has answer: http://stackoverflow.com/a/24628193
has title: PrimeFaces 4.0 Tree ActionListener
type: UnansweredQuestion
tagged with: jsf

http://stackoverflow.com/comment/32708803
score: 0
type: Comment
type: QuestionComment
has text: Hi @BalusC, thanks for your reply. I have tried you approach just now, replaced `id="{cc.attrs.id}"` with a fixed and unique ID, but I am sorry that the problem was not resolved. Do I misunderstand your answer please? Anyhow, it happens all the time to me - if I wrap a `rich:tab` in a composition, and insert the composition in a `rich:tabPanel`, the tab will not be rendered as a tab of the tab panel. I think the answer from @L-Ray below is right.
comment on: http://stackoverflow.com/q/20967953

http://stackoverflow.com/comment/31380551
score: 1
type: QuestionComment
has text: I suggest you have a method which prints N * some character. Then call this with spaces, hashes, spaces (could be zero), hashes and a new line.
type: Comment
comment on: http://stackoverflow.com/q/20905634

acrobat
type: Tag
tags question: http://stackoverflow.com/q/21009608
tags question: http://stackoverflow.com/q/20986163
tag name: acrobat

http://stackoverflow.com/comment/31280039
comment on: http://stackoverflow.com/a/20851963
type: Comment
has text: @SrinathGanesh want do you mean? I still cant get it.
score: 0
type: AnswerComment

http://stackoverflow.com/q/20949445
type: Question
has body: In this program I got all ordinary years day approximately.. example by giving input 1 1 2014 I get output as wednesday.. but not on leap year example by giving input 1 1 2000 i'm get exact answer saturday.. but I get answer for 1 1 2000 is monday.. can anyone solve this... Reference for Day of the date //reference i made this program: http://easycalculation.com/funny/shortcuts/day.php //gd = given date //gm = given month //gy = given year //ym = year modulus (year % 100 to get last two digits) //yp = year process (ym%4 to get remainder) //wd = week days (0 for sunday, 1 for monday and so on...) //d = day calculation (to get remainder from 0 to 6 .. which represents wd[0] //for sunday so on) import java.util.Scanner; class dayof { public static void main(String arg[]) { int gd,gm,gy,ym,yp,d; int[] m=new int[]{0,3,3,6,1,4,6,2,5,0,3,5}; String[] wd=new String[]{"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"}; Scanner ip=new Scanner(System.in); System.out.println("Enter Date Month Year \"DD MM YYYY\""); gd=ip.nextInt(); gm=ip.nextInt(); gy=ip.nextInt(); ym=gy%100; yp=ym%4; d=(gd+m[gm-1]+ym+yp+1)%7; System.out.print(wd[d]); } }
tagged with: java
has title: How to print day of the date in java without using inbuilt calendar date day packages
score: 0
has comment: http://stackoverflow.com/comment/31464499
has comment: http://stackoverflow.com/comment/31464061
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31470037
answer count: 0
has comment: http://stackoverflow.com/comment/31464230

http://stackoverflow.com/q/20926274
upvote count: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20926370
tagged with: nullpointerexception
downvote count: 3
has body: The program extracts data from salesforce and writes it to a text file. Please help me in understanding the reason for error. Exception in thread "main" java.lang.ExceptionInInitializerError at org.apache.axis.client.Service.getAxisClient(Service.java:104) at org.apache.axis.client.Service.&lt;init&gt;(Service.java:113) at com.sforce.soap.partner.SforceServiceLocator.&lt;init&gt;(SforceServiceLocator.java:16) at com.ncr.common.dataaccess.UserAuthentication.nscLogin(UserAuthentication.java:171) at com.ncr.common.dataaccess.UserAuthentication.getNscLogin(UserAuthentication.java:122) at com.ncr.extract.lms.NSCPartnerContactExtractLMS.startExtract(NSCPartnerContactExtractLMS.java:403) at com.ncr.extract.lms.NSCPartnerContactExtractLMS.main(NSCPartnerContactExtractLMS.java:85) Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException) (Caused by org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException)) at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543) at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235) at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:370) at org.apache.axis.components.logger.LogFactory.getLog(LogFactory.java:37) at org.apache.axis.handlers.BasicHandler.&lt;clinit&gt;(BasicHandler.java:43) ... 7 more Caused by: org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException) at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:397) at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529) ... 11 more Caused by: java.lang.NullPointerException at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:374) ... 12 more
answer count: 1
favorite count: 0
type: UnansweredQuestion
has title: when i am running my application i get the Exception in thread "main" java.lang.ExceptionInInitializerError
score: -3
linked to: http://stackoverflow.com/q/7245401
tagged with: apache-commons-logging
has comment: http://stackoverflow.com/comment/31420376

http://stackoverflow.com/a/20970921
has body: You only move to the next node when the current node is equal to the number you send to countInt.
type: Answer
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/20970885
upvote count: 3

http://stackoverflow.com/q/20849929
tagged with: java
tagged with: hibernate
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31276833
tagged with: jpa
has answer: http://stackoverflow.com/a/20851580
has comment: http://stackoverflow.com/comment/31276548
accepted answer: http://stackoverflow.com/a/20851580
score: 0
has comment: http://stackoverflow.com/comment/31277383
has body: In a spring mvc application that uses hibernate an jpa, I have a module for editing phone numbers which is not committing changes to the database when the user enters altered information for phone number and phone number type. I keep going over the code, but I cannot see where the problem is. Can someone show me what to change in the below? Here are the relevant methods of PhoneNumberController.java: @RequestMapping(value = "/patients/{patientId}/phonenumbers/{phonenumberId}/edit", method = RequestMethod.GET) public String initUpdateForm(@PathVariable("phonenumberId") int phonenumberId, Map<String, Object> model) { System.out.println("--------------------------------- made it into initUpdateForm() method"); PhoneNumber phonenumber = this.clinicService.findPhoneNumberById(phonenumberId); model.put("phonenumber", phonenumber); return "phonenumbers/createOrUpdatePhoneNumberForm"; } @RequestMapping(value = "/patients/{patientId}/phonenumbers/{phonenumberId}/edit", method = {RequestMethod.PUT, RequestMethod.POST}) public String processUpdateForm(@ModelAttribute("phonenumber") PhoneNumber phonenumber, BindingResult result, SessionStatus status) { // we're not using @Valid annotation here because it is easier to define such validation rule in Java new PhoneNumberValidator().validate(phonenumber, result); if (result.hasErrors()) {return "phonenumbers/createOrUpdatePhoneNumberForm";} else { this.clinicService.savePhoneNumber(phonenumber); status.setComplete(); return "redirect:/patients?patientID={patientId}&type=phone"; } } Here is the PhoneNumber.java model: @Entity @Table(name = "patient_phone_numbers") public class PhoneNumber { @Id @GeneratedValue @Column(name="id") private Integer id; @ManyToOne @JoinColumn(name = "client_id") private Patient patient; @Column(name="phonenumber") private String number; @ManyToOne @JoinColumn(name = "type_id") private PhoneNumberType type; @Column(name = "preferred") private boolean preferred; @Column(name = "okmessages") private boolean…
has comment: http://stackoverflow.com/comment/31277359
has answer: http://stackoverflow.com/a/20853584
has title: spring mvc module not updating record
has comment: http://stackoverflow.com/comment/31276278
has comment: http://stackoverflow.com/comment/31277047
has comment: http://stackoverflow.com/comment/31276608
tagged with: spring
has comment: http://stackoverflow.com/comment/31276464
possible better answer: http://stackoverflow.com/a/20853584
tagged with: spring-mvc
type: AnsweredQuestion

http://stackoverflow.com/comment/31547719
score: 0
comment on: http://stackoverflow.com/q/20992659
type: Comment
type: QuestionComment
has text: I reposted another log which shows all applications deployed

http://stackoverflow.com/q/20905980
score: 3
has comment: http://stackoverflow.com/comment/31382184
favorite count: 0
has title: How can I evaluate my own Groovy script from Java?
tagged with: scriptengine
has answer: http://stackoverflow.com/a/20908013
type: AnsweredQuestion
upvote count: 3
has body: I try to call my own groovy script function from Java class and also user can use standart expressions. For Example: GroovyShell shell = new GroovyShell(); Script scrpt = shell.parse("C:/Users/Cagri/Desktop/MyCustomScript.groovy"); Binding binding = new Binding(); binding.setVariable("str1", "foo"); binding.setVariable("str2", "boo"); scrpt.setBinding(binding); System.out.println(scrpt.evaluate("customConcat(str1, str2)")); //my custom method System.out.println(scrpt.evaluate("str1.concat(str2)")); Here is MyCustomScript.groovy def area(def sf) { Feature f = new Feature(sf); f.getGeom().area; } def customConcat(def string1, def string2) { string1.concat(string2) } When run this line scrpt.evaluate("str1.concat(str2)") works as expected, but scrpt.evaluate("customConcat(str1, str2)") throws an exception: groovy.lang.MissingMethodException: No signature of method: Script1.customConcat() is applicable for argument types: (java.lang.String, java.lang.String) values: [foo, boo] at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55) at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:78) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:145) at Script1.run(Script1.groovy:1) at groovy.lang.GroovyShell.evaluate(GroovyShell.java:518) I can invoke my custom methods like below and it works GroovyClassLoader loader = new GroovyClassLoader(); Class groovyClass = loader.parseClass(new File("C:/Users/Cagri/Desktop/IntergisGroovyScript.groovy")); GroovyObject groovyObject = (GroovyObject) groovyClass.newInstance(); Object res = groovyObject.invokeMethod("customConcat", new Object[]{"foo", "boo"}); However, this time I can't find how to evaluate standart expressions like substri…
tagged with: java
tagged with: groovyshell
type: Question
answer count: 1
downvote count: 0
tagged with: groovyclassloader
accepted answer: http://stackoverflow.com/a/20908013
has comment: http://stackoverflow.com/comment/31381869
tagged with: groovy

http://stackoverflow.com/q/20984561
has comment: http://stackoverflow.com/comment/31531179
tagged with: java
tagged with: methods
type: Question
has title: Is it possible to speed up the execution of a method in Android (Java)?
tagged with: adt
tagged with: eclipse
has answer: http://stackoverflow.com/a/20984644
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: android
has body: Good Night, I currently have an option in my application where, upon clicking a button, a calculator should open. The code for the method of opening the calculator I currently have is as follows: public void selectcalculator() { ArrayList&lt;HashMap&lt;String,Object&gt;&gt; items =new ArrayList&lt;HashMap&lt;String,Object&gt;&gt;(); final PackageManager pm = getPackageManager(); List&lt;PackageInfo&gt; packs = pm.getInstalledPackages(0); for (PackageInfo pi : packs) { if( pi.packageName.toString().toLowerCase().contains("calcul")){ HashMap&lt;String, Object&gt; map = new HashMap&lt;String, Object&gt;(); map.put("appName", pi.applicationInfo.loadLabel(pm)); map.put("packageName", pi.packageName); items.add(map); //If calculator found, launch it if(items.size()&gt;=1){ String packageName = (String) items.get(0).get("packageName"); Intent i = pm.getLaunchIntentForPackage(packageName); startActivity(i); } else{ //Calculator Not Found } } } } The problem is that I need the calculator to be launch instantly, while with the following code it takes 1-2 seconds to load. My question is, is there any way to speed a method in Java, or, speed this method in particular? Thank you very much, James.

http://stackoverflow.com/q/20989511
favorite count: 0
tagged with: android
has body: for short: Input =&gt; 1001,1002,1003...n Desired output =&gt; "recipients":[{"@id":"1001"},{"@id":"1002"},{"@id":"1003"},...n] How can i convert the input into the desired JSONArray output. i started with try { JSONArray mainArray = new JSONArray(); JSONObject vm = new JSONObject(); JSONObject content = new JSONObject(); JSONObject content1 = new JSONObject(); vm.put("@id", "10000"); content.put("@id","10001"); content1.put("@id","10002"); mainArray.put(","); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } but i am not on the light way. Any idea ?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20989983
type: Question
has answer: http://stackoverflow.com/a/20989983
score: 1
tagged with: java
upvote count: 2
answer count: 1
downvote count: 1
has title: Construct JSONArray with JSONObjects Dynamically Android

http://stackoverflow.com/comment/31331531
comment on: http://stackoverflow.com/a/20874284
type: AnswerComment
score: 0
type: Comment
has text: Yes you could simply call display.UI() instead of define a new constructor but you should do this only if, for some reasons, you cannot initialize img inside the constructor.

http://stackoverflow.com/q/20880237
score: 0
has comment: http://stackoverflow.com/comment/31335073
has body: I am designing a code in which I will post RSS feeds of posts on internet (Like news.) I am able to get the list of news from reuters RSS feed but the problem is I want the user to get full news when he clicks the news. But that is not happening. What do I need to enter in listview's on click listener for the news to expand.? I have taken reference of this project to bring the items in list view. Since its non clickable right now, I want to know how to make it click-able so that the user gets to read full post when he clicks any listview item. I am confused since it will be automatically updating, how to keep the listview items opening the proper news when clicked.? In this image, I want Bawa kes ke SPRM to expand when the user clicks on it..
tagged with: android
answer count: 0
tagged with: rss
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31365852
tagged with: java
tagged with: feed
has comment: http://stackoverflow.com/comment/31334323
tagged with: listview
type: Question
has comment: http://stackoverflow.com/comment/31343273
has title: How to expand RSS feed links on click

http://stackoverflow.com/comment/31411034
type: QuestionComment
comment on: http://stackoverflow.com/q/20921542
score: 0
has text: What's wrong with [API](http://docs.oracle.com/javase/6/docs/api/java/util/List.html#toArray(T[]))?
type: Comment

http://stackoverflow.com/comment/31571546
comment on: http://stackoverflow.com/a/21006555
has text: This still doesn't fix my problem. My first image is not displayed at all, and the others all fit to the size of the previous image.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/66011655
type: AnswerComment
has text: I have made no such admission. You should cite literature if you wish to claim an exact semantics for "type erasure." I should just let this go, because your argument has dwindled back into very crooked rhetoric. I suppose this is the norm for Stackoverflow comments. Just make one citation from an established PL researcher -- and we can continue this with civility. If you say "no, I'm from industry, so I get to say what I want without consequence," then I suppose you won't be the first.
type: Comment
comment on: http://stackoverflow.com/a/21843984
score: 1

http://stackoverflow.com/a/20929346
answers question: http://stackoverflow.com/q/20929259
type: Answer
has body: My first thought: Although you've not mentioned but since its complaining about static reference, I assume that you are trying YourActivity.setContentView(R.layout.menuList); ? Instead try using YourActivity.this.setContentView(R.layout.menuList);. You need correct context.
upvote count: 1
score: 1
downvote count: 0

jackson
tags question: http://stackoverflow.com/q/20881154
tags question: http://stackoverflow.com/q/21002930
tags question: http://stackoverflow.com/q/20940631
tags question: http://stackoverflow.com/q/20941658
type: Tag
tags question: http://stackoverflow.com/q/20995625
tags question: http://stackoverflow.com/q/20907488
tag name: jackson
tags question: http://stackoverflow.com/q/20864595
tags question: http://stackoverflow.com/q/20955527
tags question: http://stackoverflow.com/q/21007485
tags question: http://stackoverflow.com/q/20892163
tags question: http://stackoverflow.com/q/20858982
tags question: http://stackoverflow.com/q/20949872
tags question: http://stackoverflow.com/q/20892002

http://stackoverflow.com/comment/31508225
has text: no we have list of users
score: 0
comment on: http://stackoverflow.com/q/20970414
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31380757
score: 0
type: Comment
type: QuestionComment
has text: @MarkoTopolnik Or that!
comment on: http://stackoverflow.com/q/20905634

http://stackoverflow.com/comment/31485910
comment on: http://stackoverflow.com/a/20960160
score: 0
type: AnswerComment
has text: You'll have to do some debugging and see what's going on. Without knowing your input data I can't guess at what's going wrong.
type: Comment

http://stackoverflow.com/comment/31579651
comment on: http://stackoverflow.com/q/21011048
score: 0
type: Comment
has text: @RugalI think my problem should then be "what is the syntax for an appropriate import statement to use API in that jar?"
type: QuestionComment

http://stackoverflow.com/q/20870082
has title: GWT CellList Render Done Handler?
possible better answer: http://stackoverflow.com/a/20876893
tagged with: gwt
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23270714
has answer: http://stackoverflow.com/a/20876893
tagged with: java
type: Question
answer count: 2
has body: I use the GWT CellList widget to render Cell elements. Is there a way to register a render complete or render done event to execute stuff after rendering was done?
tagged with: javascript
tagged with: celllist
score: 0
has answer: http://stackoverflow.com/a/23270714
tagged with: http://stackoverflow.com/tag/html

http://stackoverflow.com/comment/31540276
score: 0
type: Comment
type: QuestionComment
has text: What part of the answers to the Q you link to are not answering your question? No, there's no magical way to not copy a field and have it be copied. Also be aware you need to do a *deep copy*; you'll need to copy the *contents* of your lists and not just the reference to the list. (As noted in the comment above, you could use a serialization technique, but you're adding a lot of overhead and possibly a giant third party dependency)
comment on: http://stackoverflow.com/q/20989940

http://stackoverflow.com/a/20908918
type: Answer
upvote count: 4
has body: There's no way (that I know of) to get the screen coordinates of a div. However, you can call back to your Java code from Javascript. So you could write a small amount of Javascript that detects when the mouse enters and exits the div, and call some Java code that updates a BooleanProperty, for example. See "Calling back to Java from Javascript" in the WebEngine API docs. UPDATE: example UPDATE: simplified code import org.w3c.dom.Document; import org.w3c.dom.Element; import netscape.javascript.JSObject; import javafx.application.Application; import javafx.beans.binding.Bindings; import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.concurrent.Worker.State; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.layout.BorderPane; import javafx.scene.web.WebEngine; import javafx.scene.web.WebView; import javafx.stage.Stage; public class HTMLMouseOverTest extends Application { @Override public void start(Stage primaryStage) { final BorderPane root = new BorderPane(); final WebView webView = new WebView(); final WebEngine engine = webView.getEngine(); final BooleanProperty mouseOver = new SimpleBooleanProperty(); engine.getLoadWorker().stateProperty().addListener(new ChangeListener<State>() { @Override public void changed(ObservableValue<? extends State> observable, State oldValue, State newValue) { if (newValue == State.SUCCEEDED) { // Here's how to add the Javascript if you don't have // direct access to the HTML: // final Document doc = engine.getDocument(); // Element div = doc.getElementById("important-div"); // div.setAttribute("onmouseover", "mouseOverProperty.set(true)"); // div.setAttribute("onmouseout", "mouseOverProperty.set(false)"); final JSObject window = (JSObject) engine.executeScript("window"); window.setMember("mouseOverProperty", mouseOver); } } }); engine.loadContent(" Hello World "+…
score: 4
answers question: http://stackoverflow.com/q/20908771
has comment: http://stackoverflow.com/comment/31387485
downvote count: 0

http://stackoverflow.com/q/20896705
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/31364404
has body: I want to pro-grammatically create a EditText field and then make sure that the input is not null, I've been using setId to create an id for the fields and then use findViewById(int) but for some reason, I feel its not finding the Id. Whenever I load the app on my phone, and I get to the "add" part, if i click it, it crashes. Also, the eweight.setText("TEST") is to see if its setting the EditText to TEST which its not so I think I may be doing something wrong with the find ID/set ID? LinearLayout layout = new LinearLayout(this); EditText weight = new EditText(this); EditText mark = new EditText(this); mark.setInputType(InputType.TYPE_CLASS_NUMBER); weight.setInputType(InputType.TYPE_CLASS_NUMBER); weight.setId(99); mark.setId(100); layout.addView(mark); layout.addView(weight); AlertDialog.Builder addwork = new AlertDialog.Builder(this); addwork.setView(layout); addwork.setPositiveButton("Add", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { EditText eweight = (EditText) findViewById(99); EditText emark = (EditText) findViewById(100); String coursename = ecoursename.getText().toString(); eweight.setText("TEST"); try { if ((eweight.getText().toString().trim().equals("")) || (emark.getText().toString().trim().equals(""))) { throw new InvalidInputException(); } else { // (irrelevant code removed) } } catch (InvalidInputException e) { e.printStackTrace(); Toast invalidinputtoast = Toast.makeText(getApplicationContext(), "Please input a value", Toast.LENGTH_LONG); invalidinputtoast.show(); } } });
type: Question
has comment: http://stackoverflow.com/comment/31364752
has answer: http://stackoverflow.com/a/20896843
tagged with: java
has comment: http://stackoverflow.com/comment/31364431
tagged with: findviewbyid
score: 0
has comment: http://stackoverflow.com/comment/31364412
has title: FindViewByID not working when using setID
has answer: http://stackoverflow.com/a/20896731
has answer: http://stackoverflow.com/a/20896894
has answer: http://stackoverflow.com/a/20896804
type: UnansweredQuestion
tagged with: android
answer count: 4

http://stackoverflow.com/q/20988946
upvote count: 2
answer count: 5
has title: Abnormal feature of Java where Multiple Inheritance is visible
has comment: http://stackoverflow.com/comment/31538465
accepted answer: http://stackoverflow.com/a/20988990
has body: The Oracle docs states very clearly that Java Language has no Multiple Inheritance feature i.e. Any class declared in Java cannot inherit features from two separate classes. But there lies a statement that Class Object is the super class of every other class created by user. Consider a sample Class as follows: Class Base { ..... } Class Derived extends Base { ..... } Now if we look onto Class Derived then it is clearly visible that it inherits from Class Base and also from Class Object, then that proves that Java does has Multiple Inheritance. Solution as provided from one of the pages of Oracle Sites Excepting Object, which has no superclass, every class has one and only one direct superclass (single inheritance). In the absence of any other explicit superclass, every class is implicitly a subclass of Object. This means that any class which doesn't have a single-inheritance available will only have an implicit single-inheritance with Class Object. Refer http://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html
has answer: http://stackoverflow.com/a/20989116
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20989090
has comment: http://stackoverflow.com/comment/31539789
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/20988999
has comment: http://stackoverflow.com/comment/31538491
type: Question
has comment: http://stackoverflow.com/comment/31538662
has answer: http://stackoverflow.com/a/20989103
possible better answer: http://stackoverflow.com/a/20988999
linked to: http://stackoverflow.com/q/3466783
score: -1
tagged with: inheritance
has comment: http://stackoverflow.com/comment/31538571
has answer: http://stackoverflow.com/a/20988990
has comment: http://stackoverflow.com/comment/31538693
has comment: http://stackoverflow.com/comment/31538458
has comment: http://stackoverflow.com/comment/31538503
has comment: http://stackoverflow.com/comment/31539154
favorite count: 0
has comment: http://stackoverflow.com/comment/31538480

http://stackoverflow.com/comment/31434667
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20933761
has text: @MarkoTopolnik can you give me some implementations of matcher.find()? I find the tutorials very confusing for a beginner
type: AnswerComment

http://stackoverflow.com/comment/31580499
type: QuestionComment
comment on: http://stackoverflow.com/q/20979673
score: 0
has text: No, your tiles should be static. Generally speaking, barely anything ever happens to the tiles in the Minecraft world, so a static rendering system is suitable.
type: Comment

http://stackoverflow.com/comment/31576227
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21006718
has text: @Zaphod42 I have already told you of cases where string manipulation will fail. In general, you don't even know the JSON string before hand, so even attempting to do the manipulation is pointless. I will happily keep "parroting the same answer", because it is technically correct and the only one that has general applicability. Take the same friendly advise from all the others that have said the same, instead of insisting on a special case scenario. :-)

http://stackoverflow.com/comment/31421323
has text: Thank you :) Going to the basics this happens because java object references are allocated from the heap (common to the threads) so using primitive member variables will help?
type: Comment
comment on: http://stackoverflow.com/a/20924625
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31520858
score: 0
type: AnswerComment
has text: Hi, Thanks for your answer , I will increase the count and test and update here.
comment on: http://stackoverflow.com/a/20959685
type: Comment

http://stackoverflow.com/q/20969398
tagged with: screenshot
tagged with: java
linked to: http://stackoverflow.com/q/11790104
type: Question
answer count: 2
tagged with: google-maps
has body: I am trying to make an app which will on a single button click will take a screenshot of the map and then save it to the SQLLite database altogether. Can anyone help with how to do so...thankyou.
downvote count: 0
tagged with: android
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has title: How to save Map screenshot into database in android
has answer: http://stackoverflow.com/a/50416069
linked to: http://stackoverflow.com/q/2661536
has answer: http://stackoverflow.com/a/20969516
score: 2

http://stackoverflow.com/q/20981879
has body: How can I create a button that updates text in a JFrame? I am just looking to create a big label that shows a lot of information in text form when I push an update button. This is not working: public void JFrameTest2() { JFrame frame = new JFrame(); frame.setSize(300, 125); frame.setUndecorated(true); frame.setLayout(new GridBagLayout()); frame.getContentPane().setBackground(new Color(255, 115, 100)); frame.setAlwaysOnTop(true); Dimension scrSize = Toolkit.getDefaultToolkit().getScreenSize(); Insets toolHeight = Toolkit.getDefaultToolkit().getScreenInsets( frame.getGraphicsConfiguration()); frame.setLocation(scrSize.width - frame.getWidth(), scrSize.height - toolHeight.bottom - frame.getHeight()); frame.setVisible(true); final JTextArea Text = new JTextArea(""+System.currentTimeMillis()); JButton NewButton2 = new JButton(new AbstractAction() { @Override public void actionPerformed(final ActionEvent e) { Text.revalidate(); Text.repaint(); } }); frame.add(Text); frame.add(NewButton2); }
has comment: http://stackoverflow.com/comment/31525890
has answer: http://stackoverflow.com/a/20982051
has comment: http://stackoverflow.com/comment/31525923
has comment: http://stackoverflow.com/comment/31525811
score: 0
answer count: 3
tagged with: jframe
has comment: http://stackoverflow.com/comment/31525748
has answer: http://stackoverflow.com/a/20982034
has title: Button that updates text in a JFrame
tagged with: swing
linked to: http://stackoverflow.com/q/7403584
has comment: http://stackoverflow.com/comment/31525924
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20982034
tagged with: java
possible better answer: http://stackoverflow.com/a/20982035
type: Question
has answer: http://stackoverflow.com/a/20982035
has comment: http://stackoverflow.com/comment/31526352

http://stackoverflow.com/q/20988598
downvote count: 0
answer count: 1
favorite count: 0
tagged with: android
has title: Incremental or background compilation for Maven/Gradle projects
accepted answer: http://stackoverflow.com/a/21010388
tagged with: maven
upvote count: 1
has body: I wonder if there are plugins/approaches for background/incremental compilation on the fly for Java/Android projects based on Maven or Gradle. For example, analogous of triggered execution from SBT ~compile. Or if there any way to tell build system to recompile only changed files. Thanks.
type: AnsweredQuestion
tagged with: sbt
score: 1
tagged with: java
tagged with: gradle
has answer: http://stackoverflow.com/a/21010388
type: Question

http://stackoverflow.com/q/20987980
score: 0
answer count: 1
type: UnansweredQuestion
has title: Sonar - OutOfMemory Error on Analysis of project with new Rules
tagged with: code-analysis
has answer: http://stackoverflow.com/a/20988047
type: Question
has body: I'm trying to analyze my Java project with Sonar. I've specified the sources and the class directories in the sonar-properties file. The classes folder has several sub directories. Whenever I try running the entire project, I end up getting a OutOfMemoryError. However, if I narrow down the classes directory to one of the sub folders, the project gets analyzed successfully. I tried changing the JVM Xmx options to no avail. Please suggest.
tagged with: java

http://stackoverflow.com/comment/31620755
type: Comment
has text: @PeterNiederwieser Interesting, this may solve a custom listener issue I've been experiencing if the tests do get run in one JVM. I took this project on when `maxParallelForks` was already in-place so I assumed there was a reason it was being done this way; perhaps not. I'll give it a go. Thanks for the tip! Still no love with the includeGroups unfortunately; it seems there have been some defect reports filed about this issue but nothing really conclusive as to whether they're verified bugs or just config issues.
comment on: http://stackoverflow.com/a/21009341
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31343216
has text: thank you for the help, it would be great if you can elaborate a little more and perhaps give me an example of what you mean, that would be very helpful
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/20885735
type: Comment

http://stackoverflow.com/a/20863872
upvote count: 2
has comment: http://stackoverflow.com/comment/31358555
has comment: http://stackoverflow.com/comment/31359145
answers question: http://stackoverflow.com/q/20863810
has comment: http://stackoverflow.com/comment/31303115
has comment: http://stackoverflow.com/comment/31303103
has body: Your problem is that, if the user clicks cancel, operationType is null and thus throws a NullPointerException. I would suggest that you move if (operationType.equalsIgnoreCase("Q")) to the beginning of the group of if statements, and then change it to if(operationType==null||operationType.equalsIgnoreCase("Q")). This will make the program exit just as if the user had selected the quit option when the cancel button is pushed. Then, change all the rest of the ifs to else ifs. This way, once the program sees whether or not the input is null, it doesn't try to call anything else on operationType. This has the added benefit of making it more efficient - once the program sees that the input is one of the options, it won't bother checking it against the rest of them.
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/comment/31464142
type: Comment
score: 0
type: AnswerComment
has text: can anyone tell me how to call these two set of codings in Swingworker alternatively. any sample format for my problem means also really appreciated. please.,....
comment on: http://stackoverflow.com/a/20945255

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/20864380
tags question: http://stackoverflow.com/q/20960236
tags question: http://stackoverflow.com/q/20973238
tags question: http://stackoverflow.com/q/20860382
tags question: http://stackoverflow.com/q/20941503
tags question: http://stackoverflow.com/q/20957813
tags question: http://stackoverflow.com/q/20920702
tags question: http://stackoverflow.com/q/20905543
tags question: http://stackoverflow.com/q/20907438
tag name: android-actionbar
tags question: http://stackoverflow.com/q/20981626

http://stackoverflow.com/comment/31398503
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/20914327
type: Comment
has text: How do you expect to be able to change the `paintComponent` method if you don't extend the class?

http://stackoverflow.com/comment/31428644
has text: What is your min sdk in manifest? What i suggested line 355 id different in 2.3 and 4.4 source code
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20930400
score: 0

http://stackoverflow.com/q/20986116
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31534105
has comment: http://stackoverflow.com/comment/31534734
has comment: http://stackoverflow.com/comment/31534477
tagged with: javascript
tagged with: struts2
type: Question
has comment: http://stackoverflow.com/comment/31534612
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/21058864
possible better answer: http://stackoverflow.com/a/20988837
has answer: http://stackoverflow.com/a/20988837
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31534012
has body: i have an image of my home page and i am wondering if it is posssible in struts2 to load all other pages such as products services facilities etc. in the red div in the middle of the home page. im new in struts 2 so im not sure if it is even possible please point me out on how to do this it will be appreciated UPDATE: with some explanation i got from sir Rugal i came up with this code but its not working im running out of ideas. i put and ID to the red div as workplace Home Products Services Facilities Contact Us
has comment: http://stackoverflow.com/comment/31534359
has comment: http://stackoverflow.com/comment/31533988
accepted answer: http://stackoverflow.com/a/21058864
has title: struts 2 load a page in div
tagged with: java
has comment: http://stackoverflow.com/comment/31535182
has comment: http://stackoverflow.com/comment/31534285

http://stackoverflow.com/a/20959970
score: 3
has comment: http://stackoverflow.com/comment/31485121
has body: You're calling scan.nextInt up to 3 times in this line: if(scan.nextInt() == 1 || scan.nextInt() == 2 || scan.nextInt() == 3){ which will read up to three numbers depending on what numbers you type in. First number is 1: only one number read. First number isn't 1 and second number is 2: two numbers read. Else, 3 numbers read. Grab the number once, then compare it: int someNumber = scan.nextInt(); if(someNumber == 1 || someNumber == 2 || someNumber == 3){
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20959938
upvote count: 3
accepted answer of: http://stackoverflow.com/q/20959938

http://stackoverflow.com/a/20881756
downvote count: 0
has body: No. sqlite locks the entire database when an exclusive transaction is ongoing. If you need concurrency, move the other table to another database. Or switch to another database engine that has been designed to support concurrent access better.
answers question: http://stackoverflow.com/q/20881646
upvote count: 2
has comment: http://stackoverflow.com/comment/31336030
type: Answer
score: 2

http://stackoverflow.com/a/20974883
score: 0
answers question: http://stackoverflow.com/q/20954007
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20954007
type: Answer
has body: Try PMD as a plugin - it might give you too much information but you could configure it to only show the information you want

http://stackoverflow.com/comment/31578940
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21010609
score: 1
has text: Rather than having a separate thread per frame, maintain a single thread that is responsible for the movement of all the frames...(and yes, a Swing `Timer` is prefered)

http://stackoverflow.com/comment/31529181
comment on: http://stackoverflow.com/a/20983346
type: Comment
has text: I have added code now.
score: 0
type: AnswerComment

http://stackoverflow.com/q/20984269
has answer: http://stackoverflow.com/a/21021000
has title: ICU Regex pattern for empty Java pattern
downvote count: 0
answer count: 1
has body: java.util.regex.Pattern p = java.util.regex.Pattern.compile(""); for (String s :p.split("abc", -1)) { System.out.printf("%d: %s\n", ++i, s); } returns: 1: 2: a 3: b 4: c 5: The ICU Regex Pattern.compile() fails with an empty pattern string -- does anyone know of a regex pattern and/or flags that functions like Java's regex? What's weird is that Android uses ICU Regex for its java.util.regex implementation, but this test succeeds and I can't find special handling for the empty pattern case.
score: 1
favorite count: 0
tagged with: android
tagged with: regex
accepted answer: http://stackoverflow.com/a/21021000
type: AnsweredQuestion
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/comment/31284394
has text: @karan, how are you deploying the REST war file ? There might be issues with the way you have packaged your libraries. Please checkout this post (http://stackoverflow.com/questions/19960972/jboss-as-7-2-failed-to-determine-implementation-class-name).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20853124

http://stackoverflow.com/comment/31400631
has text: Please post your entire `AnnualUse` class.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20915619
type: QuestionComment

http://stackoverflow.com/comment/31289841
type: Comment
has text: ok..Arraylist is collection of Objects..you can perform remove opearion only if the same object is added to arralist..here you are creating new object using new opeartor but you are added different object..so object wont remove..
comment on: http://stackoverflow.com/a/20857195
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31517162
comment on: http://stackoverflow.com/a/20968359
score: 0
type: AnswerComment
type: Comment
has text: This is only PART of the problem. The other important part of the problem is that OP has swapped the fields around - see my answer for details.

http://stackoverflow.com/comment/31492334
comment on: http://stackoverflow.com/q/20963835
score: 0
type: Comment
type: QuestionComment
has text: I always initialize variables in the constructor as a matter of style. I document the initial values in the constructor's JavaDoc, and therefore actually assign them there. Putting initial values at the top that are documented in the constuctor just doesn't feel right to me.

http://stackoverflow.com/comment/31577246
comment on: http://stackoverflow.com/q/21009751
has text: note that if you use `nextInt()`, there is a _newline character_ left in your input.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20904011
tagged with: android
has answer: http://stackoverflow.com/a/20904955
accepted answer: http://stackoverflow.com/a/20904955
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31377419
tagged with: web-services
downvote count: 1
type: Question
has title: Web Service Connection in Android
score: -1
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31377398
favorite count: 0
linked to: http://stackoverflow.com/q/20757728
has body: I'm trying to understand webservice in android so I wanna connect webservice in order to display data from it. I have a big project and it has a webservice How can I connect it and get data from it? There are lots of class that extends from SoapObject,KvmSerializable and import like these: import org.ksoap2.serialization.KvmSerializable; import org.ksoap2.serialization.PropertyInfo; import org.ksoap2.serialization.SoapObject; How can I get data from webservice?

http://stackoverflow.com/comment/31389075
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20908632
has text: Stop doing your beans both spring and jsf managed. If going to mix both technologies, I encourage you to use JSF for the view layer and Spring for services. Using both of them will end up in duplicate instances, where you control nothing.
score: 5

http://stackoverflow.com/comment/31462968
comment on: http://stackoverflow.com/q/20948899
has text: The second output cannot possibly have been produced by the second snippet (1901 is included). What else is different from the shown snippet and what's actually run?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20871476
duplicate of: http://stackoverflow.com/q/4685563
linked to: http://stackoverflow.com/q/4685563
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31317146
has answer: http://stackoverflow.com/a/20871539
accepted answer: http://stackoverflow.com/a/20871539
favorite count: 0
type: AnsweredQuestion
upvote count: 3
has body: I'm pretty new to Java. What would be the "standard" way in Java to simulate the FORTRAN EXTERNAL concept? For example to compute the integral of a function where the function is not predefined? For the reminder, FORTRAN EXTERNAL is a way to pass a "reference" of a function to another subprogram or function. It looks like: http://docs.oracle.com/cd/E19957-01/805-4939/6j4m0vn9d/index.html
has comment: http://stackoverflow.com/comment/31322569
has comment: http://stackoverflow.com/comment/31317466
type: Question
has title: FORTRAN EXTERNAL concept in Java
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/31317174

http://stackoverflow.com/a/46294022
upvote count: 1
has body: I manage to check the internet in Application class public class App extends Application { private static final String TAG = "MyApp"; private static App mInstance; private RequestQueue mRequestQueue; private ImageLoader mImageLoader; public static synchronized App getInstance() { return mInstance; } @Override public void onCreate() { super.onCreate(); mInstance = this; } public RequestQueue getRequestQueue() { if (mRequestQueue == null) { mRequestQueue = Volley.newRequestQueue(getApplicationContext()); } return mRequestQueue; } public &lt;T&gt; void addToRequestQueue(Request&lt;T&gt; req, String tag) { // set the default tag if tag is empty req.setTag(TextUtils.isEmpty(tag) ? TAG : tag); getRequestQueue().add(req); } public &lt;T&gt; void addToRequestQueue(Request&lt;T&gt; req) { if(CommonUtills.isNetworkAvailable(getApplicationContext())) { req.setRetryPolicy(new DefaultRetryPolicy( 60000, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT)); req.setTag(TAG); getRequestQueue().add(req); } else { Toast.makeText(getApplicationContext(), "Unable to connect to server",Toast.LENGTH_LONG).show(); } } public void cancelPendingRequests(Object tag) { if (mRequestQueue != null) { mRequestQueue.cancelAll(tag); } } } And I am calling each network call using following way every time App.getInstance().addToRequestQueue(jsonObjRequest); So before calling each request,it will be execute if internet is available
answers question: http://stackoverflow.com/q/21011279
type: Answer
downvote count: 0
score: 1

infinite-loop
tags question: http://stackoverflow.com/q/21009751
tags question: http://stackoverflow.com/q/20992111
tags question: http://stackoverflow.com/q/20938730
type: Tag
tag name: infinite-loop
tags question: http://stackoverflow.com/q/20914804

http://stackoverflow.com/a/20915589
downvote count: 0
has body: I very much doubt there is a problem with StringBuilder as it is in constant heavy use everywhere. Use a profiler (you probably have one built into your IDE) to get a better idea of exactly what is happening. If you aren't getting any joy with the profiler then scatter time recording code throughout the method and average the time over large numbers of runs, recording average and maximum at each step for each part of the method. That should quickly identify the part that's actually causing the problem. Having said that it looks like you don't even need a StringBuilder here, as presumably you have an OutputStream of some sort hidden somewhere. Just send your messages to the Stream as you build them and you never need the builder in the first place.
type: Answer
answers question: http://stackoverflow.com/q/20915549
score: 4
upvote count: 4

http://stackoverflow.com/q/20899987
answer count: 1
downvote count: 1
favorite count: 0
has body: Is it possible to add a folder to my Apps directory, in which I store a group of image files which I can then use in the same manner as I would with the following? android:background="@drawable/image" I have over 50 images that I am using for my application, and it would be really great if I could store those in separate folders rather than just the one.
tagged with: android
type: AnsweredQuestion
type: Question
tagged with: java
has title: Storing image resources in custom folders and accessing them through XML?
has comment: http://stackoverflow.com/comment/31370419
score: 0
has answer: http://stackoverflow.com/a/33134178
accepted answer: http://stackoverflow.com/a/33134178
upvote count: 1

http://stackoverflow.com/a/20901511
score: 1
answers question: http://stackoverflow.com/q/20898900
upvote count: 1
downvote count: 0
has body: I think Voro++ is doing exactly what you want. However, it is written in C++ but creating a small wrapper using swig for example will provide you a java binding.
type: Answer

http://stackoverflow.com/comment/31614443
comment on: http://stackoverflow.com/q/20965564
score: 1
type: QuestionComment
has text: @yashhy There are two factors that seal the deal in this situation. 1) Java 8 will be released in a few months, and 2) Microsoft is ending support for XP in 3 months. There is no time, and no point.
type: Comment

http://stackoverflow.com/comment/31541002
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/20989280
has text: *when i try to put the os as null it didn't sign* - well, if you neither supply an output stream nor a temp file position (the other `null` in your call), how do you expect iText to return a signed file to you?

http://stackoverflow.com/comment/31579453
type: Comment
comment on: http://stackoverflow.com/q/21011048
type: QuestionComment
score: 2
has text: you need to add this jar into your build path, then use `import` to use API in this jar. in java, it is not confusing to load a jar into your application

http://stackoverflow.com/comment/31527836
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20982947
has text: Check firewall and port un-blocking.

http://stackoverflow.com/q/21017404
possible better answer: http://stackoverflow.com/a/47198887
has answer: http://stackoverflow.com/a/47198887
has answer: http://stackoverflow.com/a/21017539
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 78
has answer: http://stackoverflow.com/a/60453281
has title: Reading and writing java.util.Date from Parcelable class
has answer: http://stackoverflow.com/a/21017453
downvote count: 0
has body: I'm working with Parcelable class. How can I read and write java.util.Date object to and from this class?
answer count: 6
score: 78
tagged with: android
has answer: http://stackoverflow.com/a/31753655
favorite count: 0
has answer: http://stackoverflow.com/a/21017441
accepted answer: http://stackoverflow.com/a/21017453

http://stackoverflow.com/comment/31293654
type: AnswerComment
comment on: http://stackoverflow.com/a/20858008
type: Comment
has text: The OP seems to have added that as an edit after I posted the answer, @HAL9000. They didn't revise the wording of the question though, so it's hard to know if that solved the problem or if they are still having problems.
score: 0

http://stackoverflow.com/comment/31512126
type: AnswerComment
has text: I know how i can accept an answer and your answer solved the problem, but GrlsHu was faster, so he has answered my question.
type: Comment
comment on: http://stackoverflow.com/a/20947840
score: 0

http://stackoverflow.com/q/20903983
linked to: http://stackoverflow.com/q/130794
linked to: http://stackoverflow.com/q/3058
upvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/20904250
has answer: http://stackoverflow.com/a/20904118
downvote count: 1
has comment: http://stackoverflow.com/comment/31377476
type: Question
has answer: http://stackoverflow.com/a/20904767
has title: Is interface only for abstraction?
score: -1
has answer: http://stackoverflow.com/a/20904122
has body: What's the utility of interfaces other than abstraction and providing a workaround for multiple inheritance ? If there is an Interface I having method m1() which is implemented by class A and another class B wants to access the method m(), what is the need of interface here. Can we simply not implement that method in class A? like - public class A implements I { public void m1() { // business logic goes here } } public class B { A objectOfA = new A(); objectOfA.m1; }
has answer: http://stackoverflow.com/a/20904039
favorite count: 0
answer count: 5
type: UnansweredQuestion
tagged with: interface

list
type: Tag
tags question: http://stackoverflow.com/q/21015318
tags question: http://stackoverflow.com/q/20988010
tags question: http://stackoverflow.com/q/20956301
tags question: http://stackoverflow.com/q/20883770
tags question: http://stackoverflow.com/q/20888333
tags question: http://stackoverflow.com/q/20978261
tags question: http://stackoverflow.com/q/20903309
tags question: http://stackoverflow.com/q/20851784
tags question: http://stackoverflow.com/q/20912313
tags question: http://stackoverflow.com/q/20957316
tags question: http://stackoverflow.com/q/20939198
tags question: http://stackoverflow.com/q/21012798
tags question: http://stackoverflow.com/q/20927971
tag name: list
tags question: http://stackoverflow.com/q/20913903
tags question: http://stackoverflow.com/q/21003822
tags question: http://stackoverflow.com/q/20949556
tags question: http://stackoverflow.com/q/20881714
tags question: http://stackoverflow.com/q/20966804
tags question: http://stackoverflow.com/q/20935315
tags question: http://stackoverflow.com/q/20984515
tags question: http://stackoverflow.com/q/20883328
tags question: http://stackoverflow.com/q/20892118
tags question: http://stackoverflow.com/q/20981077
tags question: http://stackoverflow.com/q/21000555
tags question: http://stackoverflow.com/q/20862722
tags question: http://stackoverflow.com/q/21006013
tags question: http://stackoverflow.com/q/20949451
tags question: http://stackoverflow.com/q/20917088
tags question: http://stackoverflow.com/q/20955912
tags question: http://stackoverflow.com/q/21004775
tags question: http://stackoverflow.com/q/20967653
tags question: http://stackoverflow.com/q/20957487
tags question: http://stackoverflow.com/q/20998784
tags question: http://stackoverflow.com/q/20890361
tags question: http://stackoverflow.com/q/20998787
tags question: http://stackoverflow.com/q/20860380

http://stackoverflow.com/comment/31452426
comment on: http://stackoverflow.com/q/20942757
score: 0
type: QuestionComment
type: Comment
has text: can I just use indexOf() to get certain parts and then add the rest manually i.e. #EXTINF etc?

http://stackoverflow.com/a/21003445
has body: double result = numbers[0]; for (int i = 0; i &lt; numbers.length; i++) { if (numbers[i] &gt; result) //this will check each array members to find the max { result = numbers[i];//assign the array member if it is the largest } System.out.println("The max value is " + result); //print the max value of the array
answers question: http://stackoverflow.com/q/21003206
score: 0
type: Answer

http://stackoverflow.com/q/20868388
upvote count: 1
downvote count: 1
has body: I wanted to generate a report as this design: 2013 2012 2011 NewCol1 NewCol2 Dept Item col1 col2 col3 col4 col1 col2 col3 col1 col2 col3 Area1 1 A 1 2 4 5 1 2 3 1 2 3 1 A 1 2 4 5 1 2 3 1 2 3 1 A 1 2 4 5 1 2 3 1 2 3 Area2 1 A 1 2 4 5 1 2 3 1 2 3 1 A 1 2 4 5 1 2 3 1 2 3 1 A 1 2 4 5 1 2 3 1 2 3 I used DynamicJasper and considered 2013, 2012 and 2011 as 3 different subreports and tried to generate it. But I get 2012 and 2011 data in different rows. Can someone please help me in designing the above layout using DynamicJasper? 2013, 2012 and 2011 are three different Titles in the same row. public class LayoutDesigner { public DynamicReport buildReportLayout(List&lt;Mylist&gt; list) /* List is the Java bean which contains all the data to be exported.*/ throws ColumnBuilderException, ClassNotFoundException { int colIndex = 1; int colSpanSize; FastReportBuilder drb = new FastReportBuilder(); AbstractColumn columnArea = ColumnBuilder.getNew() .setColumnProperty(ReportDetails.COLUMN_PROPERTY[0], String.class.getName()) /* ReportDetails conatins header and properties to be mapped.. */ .setFixedWidth(true) .setTitle(ReportsDetails.COLUMN_PROPERTY[0]).setWidth(new Integer(100)) .build(); AbstractColumn column1 = ColumnBuilder.getNew() .setColumnProperty(ReportDetails.COLUMN_PROPERTY[1], String.class.getName()) .setFixedWidth(true) .setTitle(ReportsDetails.COLUMN_PROPERTY[1]).setWidth(new Integer(100)) .build(); ........../* Defining other Abstrct Columns */ GroupBuilder gb = new GroupBuilder(); DJGroup djb = gb.setCriteriaColumn((PropertyColumn) columnArea) .addFooterVariable(column1,DJCalculation.SUM) ........./* added all essential variables */ .setGroupLayout(GroupLayout.VALUE_IN_HEADER) .build(); drb.addColumn(columnArea); drb.addColumn(column1); ... drb.addGroup(djb); /* I grouped and now doing column span for clubbing col1 col2 under NewCol1. Also col1 col2 under NewCol2. This is also working. Problem here is I want one more layer of span to club NewCol1 and NewCol2 under 2…
type: Question
tagged with: jasper-reports
has title: DynamicJasper: 3 report sections in one page
has answer: http://stackoverflow.com/a/20879014
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/31312821
answer count: 1
favorite count: 0
tagged with: dynamic-jasper
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31361724

http://stackoverflow.com/a/20885702
type: AcceptedAnswer
score: 28
accepted answer of: http://stackoverflow.com/q/20885521
type: Answer
answers question: http://stackoverflow.com/q/20885521
upvote count: 29
has comment: http://stackoverflow.com/comment/31381630
has comment: http://stackoverflow.com/comment/31381523
downvote count: 1
has comment: http://stackoverflow.com/comment/98697803
has comment: http://stackoverflow.com/comment/98727835
has body: There is no easy way to do this. URI template variables are usually meant for path elements or a query string parameters. You're trying to pass a host. Ideally, you'd find a better solution for constructing the URI. I suggest Yuci's solution. If you still want to work with Spring utilities and template expansion, one workaround is to use UriTemplate to produce the URL with the URI variables as you have them, then URL-decode it and pass that to your RestTemplate. String url = "http://{enpointUrl}?method=logout&amp;session={sessionId}"; URI expanded = new UriTemplate(url).expand(endpointUrl, sessionId); // this is what RestTemplate uses url = URLDecoder.decode(expanded.toString(), "UTF-8"); // java.net class template.getForObject(url, Object.class);

http://stackoverflow.com/q/20997276
has answer: http://stackoverflow.com/a/20998449
has answer: http://stackoverflow.com/a/45139688
tagged with: javascript
accepted answer: http://stackoverflow.com/a/21018603
score: 0
answer count: 3
tagged with: bundle
has answer: http://stackoverflow.com/a/21018603
possible better answer: http://stackoverflow.com/a/20998449
type: AnsweredQuestion
tagged with: jbossfuse
tagged with: java
tagged with: apache-camel
has title: JBoss Fuse / Apache camel won't resolve language js (javascript) for bundle
type: Question
has body: I am deploying an osgi application to JBoss Fuse / Apache Camel and the javascript language doesn't want to resolve. This error appears in the log: ERROR | BluePrinntContainerImpl | Bundle my-service is waiting for dependencies [(&(language=js)(objectClass=org.apache.camel.spi.LanguageResolver))] I recently added a .javaScript() expression definition to a .choice() statement: .choice() .when() .javaScript("request.body.updateSeq > exchange.getProperty('PrevUpdateSeq') + 1") .to("dosomething") Maven: org.apache.camel camel-script ${camel.version} Where camel version is 2.10.0.redhat-60024. Is there a way to fix this?

http://stackoverflow.com/q/20995502
has comment: http://stackoverflow.com/comment/31554879
type: Question
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/31585020
has title: Tomcat with multiple instances of the same application
has answer: http://stackoverflow.com/a/20995737
tagged with: tomcat
has answer: http://stackoverflow.com/a/20998059
has comment: http://stackoverflow.com/comment/31554980
tagged with: deployment
has comment: http://stackoverflow.com/comment/31554755
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31555073
tagged with: architecture
has body: We're building a java web application where each customer will have an instance of it with it's own database schema. It will be managed by my company so I would like to know what is the best approach to have several apps instances running on the same Tomcat runtime since we tried to run 3 instances on a single Tomcat and it ended up on an Out of memory exception. We considered to run multiple tomcat instances in the same server but we haven't already tested it. Also we are considering to have a separate server for each customer. From your experience with similar scenarios, what is your opinion? EDITED: This application can't be multi-tenant since there will be code customizations in some parts of it as well as some other business facts that require an application instance per client. So please the application architecture is not the subject here. Thank you, Gyo
score: 2
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/31566148
type: AnswerComment
has text: It's an addon library (Jar), you can find it here, beanshell.org/download.html the second link
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21003985

http://stackoverflow.com/a/21016280
score: 1
has comment: http://stackoverflow.com/comment/31593252
upvote count: 1
has body: In the first case you just get the values. In the second you get a reference to the collection that you could modify. In the documentation they specify: Any changes to the returned Collection must not affect this HttpServletResponse. So it is meant to be modified but the modification should not affect the response.
downvote count: 0
has comment: http://stackoverflow.com/comment/31588417
answers question: http://stackoverflow.com/q/21015889
has comment: http://stackoverflow.com/comment/31593403
type: Answer

http://stackoverflow.com/comment/31359995
type: Comment
comment on: http://stackoverflow.com/a/20894141
type: AnswerComment
has text: This is exactly what theNode!=null means. If node is not null rub the rest of code.
score: 0

http://stackoverflow.com/comment/31537377
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20988047
type: Comment
has text: Can you please specify how to skip the test cases

http://stackoverflow.com/a/42113108
downvote count: 3
type: Answer
upvote count: 0
score: -3
has body: System.exit() terminates the program at the line of invocation. System.exit(1) terminates the program if an error occurs.
answers question: http://stackoverflow.com/q/20887829

http://stackoverflow.com/comment/31383955
has text: subclassing from concrete classes is almost a wrong idea for all OOP
score: 0
comment on: http://stackoverflow.com/a/20907191
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31310417
has text: It's valid at compile-time, but not at execution time - hence the exception. I agree the question is a bit confused, but that doesn't mean the root cause is elsewhere...
type: Comment
comment on: http://stackoverflow.com/a/20868054
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31545895
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20992977
type: Comment
has text: thanks..i didn't understand the saveFriend(friends), you mean i need to create the saveFriend method in the Friends class which takes the friend object and saves data in database? could you help me with some code for Friends class.

http://stackoverflow.com/a/20980811
downvote count: 1
has body: The problem is almost certainly in your server-side code. Ext JS does absolutely nothing in the way of restricting which records are or are not shown for a remotely configured store. All that Ext JS does it submit an AJAX request, with particular parameters, and waits for the response. When it receives the response, it tries to handle it and, if that's successful, renders the data from your model instances into your grid. In this sense, Ext JS's relationship to the paging data is really that of a handshake--a request and expectation to receive data in a certain format. The important part of this, then, is that Ext JS is wholly dependent upon the data from your server being returned correctly in order to handle pagination. If the records in the grid aren't correct, you need to first check the data coming back from the server. More than likely, what you're seeing in your grid is precisely what your server is sending back for Ext JS to show. My guess is the issue is in your readAllPokeData() method. I'd start there and make sure it's actually paging the data on the server side. If that's not working correctly, Ext JS will be unable to do anything but render out the data that the server gives it.
score: -1
upvote count: 0
answers question: http://stackoverflow.com/q/20980265
type: Answer

http://stackoverflow.com/comment/31301712
comment on: http://stackoverflow.com/q/20863160
score: 3
type: Comment
has text: Although kind of silly to people who've practiced in Java...this is kind of an interesting question.
type: QuestionComment

http://stackoverflow.com/comment/31392925
type: AnswerComment
has text: Leave the version or better define it a pom in pluginManagement to make it reproduciable.
comment on: http://stackoverflow.com/a/20911615
type: Comment
score: 0

http://stackoverflow.com/comment/31535091
comment on: http://stackoverflow.com/q/20971850
score: 0
type: Comment
has text: @Callahan I am afraid this is not the case, return type of getter is matching with parameter type of setter.
type: QuestionComment

http://stackoverflow.com/q/20878902
favorite count: 0
tagged with: android
tagged with: android-notifications
has answer: http://stackoverflow.com/a/20878947
accepted answer: http://stackoverflow.com/a/20878947
tagged with: android-asynctask
possible better answer: http://stackoverflow.com/a/20878988
downvote count: 0
has answer: http://stackoverflow.com/a/20878988
tagged with: multithreading
type: Question
type: AnsweredQuestion
has title: Illegal monitor state exception on notification in postexecute of async task
has body: I am making an app which notifies whenever there is a change in data stored online. For this I am using alarmmanager/broadcastreceiver to check periodically for any changes using async task in the broadcast receiver. If there is any change, in the post execute part of the thread, i am starting a notification. ON the line of "nm.notify();" i get an InvocationTargetException using debugger the cause of the exception is "IllegalMonitorStateException: object not locked by thread before notify()" Can someone shed some light on what is happening. Thanks in advance. The code for OnPostExecute is: @Override protected void onPostExecute(String result) { // TODO Auto-generated method stub super.onPostExecute(result); resultstr=result; SharedPreferences sp=context.getSharedPreferences("Prefs", 3); String oldresult=sp.getString("notification", "hello world"); if (resultstr.equals("unable to connect to internet")){}else if(resultstr.equals("")){}else if (!oldresult.equals(resultstr)){ NotificationManager nm = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); Notification notification = new Notification(R.drawable.ic_launcher,"Tax Tracker 2014",System.currentTimeMillis()); final Intent notificationIntent = new Intent(context, FB.class); PendingIntent p = PendingIntent .getActivity(context, 0, notificationIntent, 0); notification.setLatestEventInfo(context, "Tax Tracker 2014", "new info alert", p); nm.notify(); SharedPreferences.Editor edit=sp.edit(); edit.putString("notification", resultstr).commit(); } }
score: 1
tagged with: java
answer count: 2
upvote count: 1

http://stackoverflow.com/comment/31545034
type: Comment
has text: Can you go my new compare to suggestion me how to write the compare, the new compare still have issue.
type: AnswerComment
comment on: http://stackoverflow.com/a/20991423
score: 0

http://stackoverflow.com/q/20940370
tagged with: javadoc
type: Question
has body: I'm using netbeans and I'm unable to find the javadoc jar/zip/folder for hibernate-jpa-2.0-api-1.0.1.Final.jar. Here is the message I get. Javadoc not found. Either Javadoc documentation for this item does not exist or there is no attached Javadoc to the JAR file containing this item:C:\Users\user.m2\repository\org\hibernate\javax\persistence\hibernate-jpa-2.0-api\1.0.1.Final\hibernate-jpa-2.0-api-1.0.1.Final.jar I searched through mvnrepository but I don't see a link to the javadocs.
has answer: http://stackoverflow.com/a/20940436
accepted answer: http://stackoverflow.com/a/20940436
score: 4
answer count: 1
tagged with: jpa
has title: Where can I find the javadoc for Hibernate-JPA jar
favorite count: 0
upvote count: 4
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/31371474
type: AnswerComment
comment on: http://stackoverflow.com/a/20899474
type: Comment
has text: when I set setAccessible() true it returns me all attr of class even which assigned by jvm. I dont need that and this mix everything. I just need to get 'public' 'private' 'protected' defined variables
score: 0

http://stackoverflow.com/a/20867335
answers question: http://stackoverflow.com/q/20867290
has body: The problem is the path to the image... JLabel imgLabel = new JLabel(new ImageIcon("/GuiTest/src/odin/COW.png")); Basically, ImageIcon(String) expects that the String represents a file. This means, that Java is look for the image starting from the root of the current drive...which probably isn't what you really want... You should also not store resources within the src directory in Eclipse, as I understand it, Eclipse requires you to place these resources within the "resources" directory within the project. These will be included within the project when you build it... Once you've move the image to this location, you should be able to access it as an embedded resource using something like... JLabel imgLabel = new JLabel(new ImageIcon(getClass().getResource("/odin/COW.png")));
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/31309233
has comment: http://stackoverflow.com/comment/31309799
downvote count: 0
has comment: http://stackoverflow.com/comment/31309148
upvote count: 4

http://stackoverflow.com/a/20952487
downvote count: 0
has comment: http://stackoverflow.com/comment/31478425
score: 3
type: Answer
has comment: http://stackoverflow.com/comment/31473641
has body: Kai has a very good answer, but I'll just throw out there that if you know the exact number of values you are trying to average (and you do, since you said it was an array), then you can divide each value by N before adding them all up. Then you would never exceed the limit of long. Example: the limit of long is roughly 9.22e18, so let's do an average near that limit: long[] arr = {Math.round(5e18), Math.round(9e18)}; double avg = 0.0d; int size = arr.length; for (int i = 0; i &lt; size; i++) { long l = arr[i]; double tmp = l/(double)size; avg += tmp; } (The Math.round() calls are needed since exponential notation numbers are doubles in Java.)
has comment: http://stackoverflow.com/comment/31469902
upvote count: 3
has comment: http://stackoverflow.com/comment/31469900
has comment: http://stackoverflow.com/comment/31469936
has comment: http://stackoverflow.com/comment/31477267
answers question: http://stackoverflow.com/q/20952230
has comment: http://stackoverflow.com/comment/31469978

http://stackoverflow.com/a/20967431
type: Answer
answers question: http://stackoverflow.com/q/20967382
downvote count: 0
score: 1
has body: console isn't usable. It's not a ConsoleWriter; it's null. If you try to call its methods, you'll get a NullPointerException. This isn't C++, where ConsoleWriter console; constructs a ConsoleWriter.
upvote count: 1

http://stackoverflow.com/a/20923026
has body: Rather than try to use a regular expression you could use a break iterator - java.text.BreakIterator. To get the words in a string use: BreakIterator iter = BreakIterator.getWordInstance(); iter.setText(text); for (int loc = iter.first(), lastLoc = 0; loc != BreakIterator.DONE; loc = lastLoc, loc = iter.next) { if (loc == 0) continue; String word = text.substring(lastLoc, loc); } Break iterators are used to find 'boundaries' in text - which might be words or sentences or something else. The example above uses the predefined word break iterator which returns the index of the beginning of a word or punctuation characters and moves through the text on successive calls. The loop is just extracting the words by using the current and previous locations returned by the iterator, punctuation will be extracted as separate words.
has comment: http://stackoverflow.com/comment/31417314
type: Answer
score: 0
answers question: http://stackoverflow.com/q/20915469

http://stackoverflow.com/comment/31542467
comment on: http://stackoverflow.com/q/20991373
has text: you reversed the order, you should include `html` in `jsp`. just create a `jsp` file and put the necessary part of `html` file into `jsp`
type: Comment
type: QuestionComment
score: 6

http://stackoverflow.com/q/20861960
type: UnansweredQuestion
tagged with: flowlayout
has body: In FlowLayout, default screen size is (0,0) and we have to set it explicitly by: setSize(200,400) But in GridLayout, we don't have to call this method, why?
answer count: 0
tagged with: swing
type: Question
has title: Why default screen size isn't (0,0) in GridLayout in javax.swing?
has comment: http://stackoverflow.com/comment/31306755
has comment: http://stackoverflow.com/comment/31299898
tagged with: java
has comment: http://stackoverflow.com/comment/31299007
score: 0
tagged with: grid-layout
tagged with: layout-manager

http://stackoverflow.com/q/20941509
favorite count: 0
has answer: http://stackoverflow.com/a/20941632
has comment: http://stackoverflow.com/comment/31450027
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31450078
tagged with: java
possible better answer: http://stackoverflow.com/a/20941532
tagged with: loops
tagged with: switch-statement
type: Question
has title: What alternatives are there to these switch statements?
has answer: http://stackoverflow.com/a/20941550
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20941550
has comment: http://stackoverflow.com/comment/31450053
has body: Just whipped up this extremely simple GPA calculator, wondering how I would use a loop to avoid the huge blocks of switch statements? I am very new to Java and just looking for some advice, any other ways to improve the program are greatly appreciated. Thanks in advance, guys! package helloPackage; import javax.swing.JOptionPane; public class GradePointAverage { public static void main(String[] args) { System.out.println("Welcome to the GPA calculator! Please enter your GPA into the popup window to find your GPA."); String firstClassInput = JOptionPane.showInputDialog(null,"Please enter your grade for your first class: (A+, A, A-, B+, etc.)"); String firstClass = firstClassInput.toUpperCase(); String secondClassInput = JOptionPane.showInputDialog(null,"Please enter your grade for your second class: (A+, A, A-, B+, etc.)"); String secondClass = secondClassInput.toUpperCase(); String thirdClassInput = JOptionPane.showInputDialog(null,"Please enter your grade for your third class: (A+, A, A-, B+, etc.)"); String thirdClass = thirdClassInput.toUpperCase(); String fourthClassInput = JOptionPane.showInputDialog(null,"Please enter your grade for your fourth class: (A+, A, A-, B+, etc.)"); String fourthClass = fourthClassInput.toUpperCase(); String fifthClassInput = JOptionPane.showInputDialog(null,"Please enter your grade for your fifth class: (A+, A, A-, B+, etc.)"); String fifthClass = fifthClassInput.toUpperCase(); double firstGrade = 0.0; double secondGrade = 0.0; double thirdGrade = 0.0; double fourthGrade = 0.0; double fifthGrade = 0.0; switch (firstClass){ case "A+": firstGrade = 4.33; break; case "A": firstGrade = 4.00; break; case "A-": firstGrade = 3.67; break; case "B+": firstGrade = 3.33; break; case "B": firstGrade = 3.00; break; case "B-": firstGrade = 2.67; break; case "C+": firstGrade = 2.33; break; case "C": firstGrade = 2.00; break; case "C-": firstGrade = 1.67; break; case "D+": firstGrade = 1.33; break; case "D": firstGrade = 1.00; break; case "D-": fir…
has comment: http://stackoverflow.com/comment/31450130
has answer: http://stackoverflow.com/a/20941541
has answer: http://stackoverflow.com/a/20941542
upvote count: 2
has answer: http://stackoverflow.com/a/20941716
has answer: http://stackoverflow.com/a/20941756
answer count: 7
has answer: http://stackoverflow.com/a/20941532
has comment: http://stackoverflow.com/comment/31450058

http://stackoverflow.com/a/20945436
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20900100
has body: Apparently it is a bug which can be fixed by adding this line: System.setProperty("http.keepAlive", "false"); I ran into an Android OS bug recently that is pretty harsh related to HTTPS connections. Basically, what happens is this: You want to setup a connection between the phone and a server, and you need to control both the input and the output. As a result, you use URL.openConnection(), with setDoInput() and setDoOutput() set to true: URL url = new URL("https://blahblahblah.com"); URLConnection conn = url.openConnection(); conn.setDoInput(true); conn.setDoOutput(true); At some point you use both conn.getOutputStream() to write to the stream, then conn.getInputStream() to get the response. You're doing an HTTPS connection. Some people report this happening on normal HTTP, but I've only seen it happen on HTTPS. The first request goes through fine and dandy. The second time you try to make the request, the connection doesn't send any data out and doesn't receive any data; it looks like it happens instantly. If you cast to an HttpURLConnection, conn.getResponseCode() returns -1 instead of anything meaningful. In other words, every other request, the request fails outright. This is a noted bug in Android, but it isn't fixed yet in any released versions. Even when it's fixed, you'll still have to deal with this on older versions of Android. There are a few workarounds. The first is to simply not use URLConnection; if you can find some way around it, avoid it. The second is to repeatedly make the same request until it works; it's a little too much of a hack for my tastes, but it'll work. Then there's the third workaround, which I do not claim to understand why it fixes the issue but it does. Just set this setting when your application begins: System.setProperty("http.keepAlive", "false"); Unfortunately this has some drawbacks (keep-alive is a good thing normally), but in comparison to mysteriously failed requests I'll ditch it. Source: http://daniel-codes.blogspot.com/2…

http://stackoverflow.com/comment/31308245
score: 0
comment on: http://stackoverflow.com/q/20854965
type: QuestionComment
type: Comment
has text: I used EJB interceptors and `@AroundInvoke` annotation in a `initSite` method. The problem with this approach is that I have to always create a method with the arguments `@PathParam( "site" ) String site` and `Site site` (I don't want to consult the database twice so I pass the instance as parameter from the interceptor). Any approach not requiring me to build a proper signature is welcome.

http://stackoverflow.com/comment/31410011
comment on: http://stackoverflow.com/q/20920845
score: 0
has text: @JqueryLearner exactly
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31555008
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20968476
has text: If you use Python, you might use PyCharm IDE. If you use ruby, you might use RubyMine. If you use C# you'd use Visual Studio. Bash a text editor. JS use sublime. etc etc etc. See my point now??
score: 0

http://stackoverflow.com/q/20884318
answer count: 1
has body: I have to read a ZIP code from Excel sheet. Zip code can be any of the following formats: ααααα 11111-αααα 3 3 3 3 3 - 6 6 6 6 12345 123456 12345-123456 I tried cell.getRichStringCellValue() and cell.getStringCellValue()but it's not working.
tagged with: file-io
has title: How to read alphanumeric values from Excel cells in Java?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20884670
has comment: http://stackoverflow.com/comment/31340678
accepted answer: http://stackoverflow.com/a/20884670
type: Question
score: 0
tagged with: java
tagged with: file

http://stackoverflow.com/q/20961481
has body: I am using "RSA/None/PKCS1Padding" as : Cipher RSACipher = Cipher.getInstance("RSA/None/PKCS1Padding"); This gives me exception as : java.security.NoSuchAlgorithmException: Cannot find any provider supporting RSA/None/PKCS1Padding Thanks for help.
tagged with: rsa
has comment: http://stackoverflow.com/comment/31488065
has comment: http://stackoverflow.com/comment/75903554
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: encryption
upvote count: 6
has answer: http://stackoverflow.com/a/20961878
tagged with: java
score: 6
has title: RSA/NONE/PKCS1Padding giving error as java.security.NoSuchAlgorithmException
type: Question

http://stackoverflow.com/a/20953704
has comment: http://stackoverflow.com/comment/31476622
score: 2
has comment: http://stackoverflow.com/comment/31757557
has body: You could place exception interceptor before your own interceptor instead of the json interceptor by extending json interceptor and override intercept method where you can catch errors. Then you can either add action errors or rethrow a custom exception which you can map in the action config or globally. <exception-mapping exception="org.exceptionmapping.CustomException" result="errorresult"/> This way you can map all json only interceptor errors with your custom exception.
downvote count: 0
has comment: http://stackoverflow.com/comment/110318653
has comment: http://stackoverflow.com/comment/31473007
has comment: http://stackoverflow.com/comment/31474559
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/20952538

http://stackoverflow.com/comment/31408772
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20920243
type: QuestionComment
has text: `(the message is not shown for the second time).` you mean 1st time? BTW, from your snippets of code I don't see any problem. Sounds like the issue is on other part

http://stackoverflow.com/comment/31599056
has text: Yes, it does. The components which don't use that much memory also work from within Eclipse (pos, ner). I solved the problem now though (see below).
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21018382
type: Comment

http://stackoverflow.com/q/20938434
tagged with: android
tagged with: google-cloud-endpoints
type: AnsweredQuestion
has body: I read that Objectify is a supported framework for use with Endpoints. How do I convert the sample from the GPE App Engine Connected Android Project wizard to deal with Objectify 4 data? I'm getting this: org.datanucleus.exceptions.ClassNotPersistableException: The class "com.example.MyObjectifyTestInfo" is not persistable. This means that it either hasnt been enhanced, or that the enhanced version of the file is not in the CLASSPATH (or is hidden by an unenhanced version), or the Meta-Data/annotations for the class are not found. I have searched a lot, but found nothing in stackoverflow or elsewhere. Thanks.
downvote count: 0
score: 1
tagged with: java
type: Question
upvote count: 1
answer count: 1
has title: Objectify with Endpoints for android
favorite count: 0
tagged with: objectify
has answer: http://stackoverflow.com/a/20940836
accepted answer: http://stackoverflow.com/a/20940836
tagged with: google-app-engine

http://stackoverflow.com/a/20865849
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20865824
upvote count: 3
has comment: http://stackoverflow.com/comment/31306687
score: 3
has comment: http://stackoverflow.com/comment/31306668
has comment: http://stackoverflow.com/comment/31306717
has body: The biggest issues I can see are... Extending from JFrame, but not actually using it... Reliance on static when not really required... Calling setVisible before anything has actually begin added. In fact, generally trying to manipulate the frame properties before anything was added to it and after it was made visible... public class Main { public static void main(String[] args){ EventQueue.invokeLater(new Runnable() { public void run() { JFrame xF = new JFrame("xFrame"); xF.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); xF.add(new JLabel(new ImageIcon("/Clicker/xS/cow.png"))); xF.setResizable(false); xF.setSize(WIDTH*SCALE,HEIGHT*SCALE); xF.setLocationRelativeTo(null); xF.setVisible(true); } } } } But since you never actually described what problems you were having, these are all guesses...

http://stackoverflow.com/a/20890423
has comment: http://stackoverflow.com/comment/31372649
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20889627
answers question: http://stackoverflow.com/q/20889627
has body: You're running out of AudioTracks, 20 in your case, 30 on my Nexus4, which gives me: 175-5975/? E/AudioFlinger﹕ no more track names available A solution - use global audioTrack object that you already have, and null it and create on every play: void playSound() { System.out.println("+++ PLAY "); //if audioTrack has been initialised, first, release any resources //then null it if (audioTrack != null) { audioTrack.release(); audioTrack = null; } //now create it again, note: use global audioTrack, //that means remove "final AudioTrack" here audioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, generatedSnd.length, AudioTrack.MODE_STATIC); audioTrack.write(generatedSnd, 0, generatedSnd.length); audioTrack.play(); }
upvote count: 2
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/31609529
score: 0
comment on: http://stackoverflow.com/q/21008982
type: Comment
type: QuestionComment
has text: You are showing `MANIFEST.MF` in the listing you added. Can you post the content?

subclipse
type: Tag
tag name: subclipse
tags question: http://stackoverflow.com/q/21016668

http://stackoverflow.com/comment/31586873
type: QuestionComment
comment on: http://stackoverflow.com/q/21013395
score: 0
has text: Please Somebody Help Me...
type: Comment

http://stackoverflow.com/q/20956385
favorite count: 0
has comment: http://stackoverflow.com/comment/31477232
has answer: http://stackoverflow.com/a/20956725
has comment: http://stackoverflow.com/comment/31477435
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: fasterxml
type: Question
has title: Jackson ObjectMapper & JsonGenerator - is it thread-safe?
accepted answer: http://stackoverflow.com/a/20956725
score: 5
upvote count: 5
answer count: 1
downvote count: 0
has body: I currently have a project which uses jackson faster xml to serialize/deserialize POJOs to Json using custom serializers and deserializers. From what I understand, the ObjectMapper is thread-safe once it has been created and configured. However, I have noticed when running tests with JMeter that occasionally the following can happen - Thread 1 enters CustomerSerializer and starts to serialize Thread 2 enters CustomSerializer, interuptting Thread 1, and starts to serialize from start to finish Thread 1 resumes, and the last thing being serialized is missing It seems to be that the JsonGenerator instance is being reset when the second thread has entered - surely this shouldn't be happening? I have checked several sites and threads to see if there are any settings or features I need to set, but from what I understand the ObjectMapper reuses JsonGenerator instances, could this be the issue? The following is a snippet from my custom serializer... @Override public final void serialize(Object o, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { jsonGenerator.writeStartObject(); ... Code here .... jsonGenerator.writeEndObject(); closeJsonGenerator(jsonGenerator); } And an example of where it is used SimpleModule sm = new SimpleModule(); sm.addSerializer(new myCustomSerializer()); new ObjectMapper().registerModule(sm) .writeValue(new myObject());

encoding
tags question: http://stackoverflow.com/q/20932290
tags question: http://stackoverflow.com/q/20909098
type: Tag
tags question: http://stackoverflow.com/q/20969215
tags question: http://stackoverflow.com/q/20864767
tags question: http://stackoverflow.com/q/21018025
tag name: encoding
tags question: http://stackoverflow.com/q/20930017

http://stackoverflow.com/a/20933643
has body: Instead of following in EmployeePayslip // Loading all fulltime employees in Background Thread // getting employee details from intent Intent i = getIntent(); // getting employee id (pid) from intent pid = i.getStringExtra(TAG_PID); give a try with following Bundle extras = getIntent().getExtras(); if (extras != null) { pid = extras.getString(TAG_PID); } Edited: Seems @user666 is correct. First correct the spelling of TAG_EMPLOYEE in both classes as follow: private static final String TAG_EMPLOYEE = "employee";
has comment: http://stackoverflow.com/comment/31436312
has comment: http://stackoverflow.com/comment/31436617
has comment: http://stackoverflow.com/comment/31436781
has comment: http://stackoverflow.com/comment/31436165
answers question: http://stackoverflow.com/q/20933492
has comment: http://stackoverflow.com/comment/31436504
score: 0
type: Answer

jinternalframe
tags question: http://stackoverflow.com/q/20990255
tag name: jinternalframe
tags question: http://stackoverflow.com/q/21014213
type: Tag

http://stackoverflow.com/a/20965013
has body: I figuered it out... I forgot to include: public Long getTeam(){ return team; }
type: Answer
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/20964974
upvote count: 3

http://stackoverflow.com/comment/31440467
has text: Actually, I tried this link also, but the problem is Login page where it redirect is , an html page.. using ur link, this is just showing the HTML page still.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20931722

runtime
tags question: http://stackoverflow.com/q/20988304
tags question: http://stackoverflow.com/q/20938662
tags question: http://stackoverflow.com/q/20925024
type: Tag
tag name: runtime
tags question: http://stackoverflow.com/q/21000931
tags question: http://stackoverflow.com/q/20876451
tags question: http://stackoverflow.com/q/20906018

http://stackoverflow.com/q/20921313
upvote count: 1
has comment: http://stackoverflow.com/comment/31411472
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20921371
tagged with: java
has comment: http://stackoverflow.com/comment/31410651
downvote count: 1
has comment: http://stackoverflow.com/comment/31410722
has title: Simple String matching in java
type: Question
has answer: http://stackoverflow.com/a/20921404
has answer: http://stackoverflow.com/a/20921601
has answer: http://stackoverflow.com/a/20921586
has answer: http://stackoverflow.com/a/20921392
possible better answer: http://stackoverflow.com/a/20921371
has body: I am trying to implement simple String matching. The algorithm should return 1 if the source String contains the pattern String. I cannot understand why it is returning -1 on the following inputs String source = "aababba"; String pattern = "abba"; Here is my implementation: public static int findMatch(String source, String pattern) { int j = 0, pos = -1; boolean matched = false; if(source.length() &lt; pattern.length()) return -1; for(int i = 0; i &lt; (source.length() - pattern.length()); i++) { if(source.charAt(i) == pattern.charAt(j)) j++; else j = 0; if(j == pattern.length()) { matched = true; break; } } if(matched) return 1; return -1; } EDIT: As many of you suggested, the culprit was the for loop. I should have made it as follows. The rest of the code is the same. Other solutions are also possible as shown in the answers. for(int i = 0; i &lt;= (source.length() - pattern.length()); i++) { if(source.charAt(i+j) == pattern.charAt(j)) {
has answer: http://stackoverflow.com/a/20921367
score: 0
has answer: http://stackoverflow.com/a/20921383
answer count: 7
has comment: http://stackoverflow.com/comment/31410653
favorite count: 0
has comment: http://stackoverflow.com/comment/31411149
accepted answer: http://stackoverflow.com/a/20921367

http://stackoverflow.com/a/20938228
score: 0
has body: Implement View.onClickListenerand above the ònClick` method you should include the @Override notation
type: Answer
answers question: http://stackoverflow.com/q/20937052

http://stackoverflow.com/a/21002628
answers question: http://stackoverflow.com/q/21002528
downvote count: 0
has body: I assume this is OSX - the JVM downloads to the where the installer says (/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk) you do not change it. the thing you download is an installer app, run that and it will download the jdk and place it in the correct directory. The old Apple supplied 1.6 version which is not now part of the OS is not in /Library/Java/JavaVirtualMachines/ but is in /System/Library/Java/JavaVirtualMachines/1.6.0.jdk
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/a/20868503
has body: Not sure if this is the proper way to avoid this situation, here s simple hack to keep the screen size just big enough to avoid being hidden by the tool bar. I just set the height a little less than the screen size. Not sure if it's exactly what you're looking for, but you can give it a try. import java.awt.Dimension; import java.awt.Toolkit; import javax.swing.JFrame; class SwingApplication { public static void main(String args[]) { JFrame frame = new JFrame("LabelTest"); final Dimension screenSize = Toolkit.getDefaultToolkit() .getScreenSize(); int width = (int)screenSize.getWidth(); int height = (int)screenSize.getHeight(); Dimension newDim = new Dimension(width, height - 40); frame.setSize(newDim); frame.setVisible(true); // FIRST visible = true frame.setResizable(false); // THEN resizable = false frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }
answers question: http://stackoverflow.com/q/20863585
score: 0
type: Answer

http://stackoverflow.com/comment/31569066
type: Comment
comment on: http://stackoverflow.com/a/21005488
has text: Yes, it is OK to use ==. But what you probably want to do is (if foo[i] != 0.0)
score: 0
type: AnswerComment

http://stackoverflow.com/q/21017616
score: 3
has comment: http://stackoverflow.com/comment/31592252
tagged with: java
tagged with: database
has title: Autogenerate Timestamp as Id for database?
accepted answer: http://stackoverflow.com/a/21017764
has body: @Id attribute has in general the ability to auto generate database primary key ids. I'd like to have a timestamp is Id (I can ensure that there will be no 2 same timestamps). Would you set the timestamp directly to the property of the variable, or initilize it within the constructor, or pass it as parameter in the constructor? @Entity public class MyDomain implements Serializable { @Id private Timestamp timestamp = new Timestamp(new Date().getTime()); public MyDomain() { this.timestamp = new Timestamp(new Date().getTime()); } public MyDomain(Timestamp timestamp) { this.timestamp = timestamp; } } What would you chose, and why?
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21018169
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21018169
has answer: http://stackoverflow.com/a/21017764
upvote count: 3
tagged with: timestamp
type: Question

http://stackoverflow.com/comment/31311972
score: 0
comment on: http://stackoverflow.com/a/20868695
type: Comment
type: AnswerComment
has text: does this means to use hashmap of arraylist to store the data ?

http://stackoverflow.com/a/22518999
has body: Right click on the project that you have imported. Go to Properties -> Android -> Project Build Target Just like mine , none of the checkboxes will be checked in your's too. Click/ Tick on any check box. Then Press Apply-> OK Your issue of "Unable to resolve target" will get solved. Hope this hepls. Comment for further help.
score: 0
answers question: http://stackoverflow.com/q/20980690
type: Answer

http://stackoverflow.com/q/20969371
type: Question
has body: I have an apache camel route which is processing a POJO on the exchange body. Please look at the sequences of lines marked from 1 to 3. from("direct:foo") .to("direct:doSomething") // 1 (POJO on the exchange body) .to("direct:storeInHazelcast") // 2 (destroys my pojo! it gets -1) .to("direct:doSomethingElse") // 3 (Where is my POJO??) ; Now I need to use the put operation on the hazelcast component which unfortunately needs to set the body to the value -1. from("direct:storeInHazelcast") .setBody(constant(-1)) .setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.PUT_OPERATION)) .setHeader(HazelcastConstants.OBJECT_ID, constant(LAST_FLIGHT_UPDATE_SEQ)) .to("hazelcast:map:MyNumber") ; For the line marked 2, I would like to send a COPY of the exchange to the storeInHazelcast route. Firstly, I tried .multicast(), but the exchange body was still screwed up (to -1). // shouldnt this copy the exchange? .multicast().to("direct:storeInHazelcast").end() Then I tried .wireTap(), which works as a "fire and forget" (async) mode, but I actually need it to block, and wait for it to complete. Can you make wireTap block? // this works but I need it to be sync processing (not async) .wireTap("direct:storeInHazelcast").end() So I'm looking for some tips here. As far as I can read, multicast() should have copied the exchange, but the setBody() in my storeInHazelcast route seens to screw up the original exchange. Alternatively maybe there is some other way to do this. Thanks in advance. Camel 2.10
has title: Apache camel - how to "wiretap" synchronously? Or just send a copy of an exchange?
tagged with: jbossfuse
tagged with: hazelcast
tagged with: apache-camel
possible better answer: http://stackoverflow.com/a/38588139
has answer: http://stackoverflow.com/a/38588139
has answer: http://stackoverflow.com/a/20981088
has answer: http://stackoverflow.com/a/44820954
has answer: http://stackoverflow.com/a/20971142
downvote count: 0
favorite count: 0
answer count: 5
has comment: http://stackoverflow.com/comment/41403994
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20971142
has answer: http://stackoverflow.com/a/51440963
score: 7
tagged with: java
upvote count: 7

http://stackoverflow.com/comment/31351949
has text: @ElliottFrisch, for example I try retrieving a .gif image from the server's directory. What I get as a response at the browser is "The image “http://localhost:6565/alien.gif” cannot be displayed because it contains errors". This is strange since all the HTML tags are generated correctly. If i try to get a simple hmtl file I get nothing.
comment on: http://stackoverflow.com/a/20889327
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31495365
comment on: http://stackoverflow.com/q/20965772
score: 0
type: Comment
type: QuestionComment
has text: Add the `final` modifier to variables and some questions will never have to be asked.

http://stackoverflow.com/comment/31559203
has text: If the second _class_ extends the first _class_ like you said, then because you used the `protected` access modifier, it will be able to access the variable `Text`. Unless, of course, you created another variable with the same name in the second _class_. If you only created the list (the first line of code you showed) and then ran `getServerInfoSize()`, it will return `0` because the list contains no elements. Also, you might want to read up on inheritance in Java.
score: 0
comment on: http://stackoverflow.com/q/21000390
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32406561
has text: Ok. I'll really appreciate it. Thanks.
comment on: http://stackoverflow.com/a/20997209
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/31490073
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20962631
has text: You are hiding the subtle difference by using `Float` instead of `float` in the second line. It works, of course, but the return type of the methods is different.

http://stackoverflow.com/comment/31420429
type: Comment
comment on: http://stackoverflow.com/a/20872920
has text: @EJP this is NOT android, but an ARM build of Java which is somewhat likely to be the same build as android
score: 0
type: AnswerComment

paintcomponent
tags question: http://stackoverflow.com/q/20907683
tags question: http://stackoverflow.com/q/20931994
tags question: http://stackoverflow.com/q/20893557
tag name: paintcomponent
tags question: http://stackoverflow.com/q/20931957
tags question: http://stackoverflow.com/q/20856152
tags question: http://stackoverflow.com/q/20858356
tags question: http://stackoverflow.com/q/20862921
tags question: http://stackoverflow.com/q/20914327
tags question: http://stackoverflow.com/q/20852536
tags question: http://stackoverflow.com/q/20867279
tags question: http://stackoverflow.com/q/20863082
tags question: http://stackoverflow.com/q/20924230
type: Tag

http://stackoverflow.com/comment/31630207
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21016531
has text: I said -remove- cascading. If you don't listen, I can't help you I'm afraid. Good luck figuring it out, I suggest you get a good book on JPA and actually learn this stuff.

jframe
tags question: http://stackoverflow.com/q/20865499
tags question: http://stackoverflow.com/q/21018083
tags question: http://stackoverflow.com/q/20959053
tags question: http://stackoverflow.com/q/20895621
tags question: http://stackoverflow.com/q/20929618
tags question: http://stackoverflow.com/q/20977812
tags question: http://stackoverflow.com/q/20927389
tags question: http://stackoverflow.com/q/20915507
tag name: jframe
tags question: http://stackoverflow.com/q/20898619
tags question: http://stackoverflow.com/q/20952058
tags question: http://stackoverflow.com/q/20980975
tags question: http://stackoverflow.com/q/20932471
tags question: http://stackoverflow.com/q/21010464
tags question: http://stackoverflow.com/q/20872118
tags question: http://stackoverflow.com/q/21010495
tags question: http://stackoverflow.com/q/20856763
tags question: http://stackoverflow.com/q/20939438
tags question: http://stackoverflow.com/q/20925193
tags question: http://stackoverflow.com/q/20914327
tags question: http://stackoverflow.com/q/20985622
tags question: http://stackoverflow.com/q/20950106
tags question: http://stackoverflow.com/q/20981879
tags question: http://stackoverflow.com/q/20910597
tags question: http://stackoverflow.com/q/21010609
tags question: http://stackoverflow.com/q/21018133
tags question: http://stackoverflow.com/q/20914074
tags question: http://stackoverflow.com/q/20890898
tags question: http://stackoverflow.com/q/20952863
tags question: http://stackoverflow.com/q/20994473
tags question: http://stackoverflow.com/q/20917944
tags question: http://stackoverflow.com/q/20987838
tags question: http://stackoverflow.com/q/20966718
tags question: http://stackoverflow.com/q/20995402
tags question: http://stackoverflow.com/q/20898487
tags question: http://stackoverflow.com/q/20939553
tags question: http://stackoverflow.com/q/20923346
tags question: http://stackoverflow.com/q/20868328
tags question: http://stackoverflow.com/q/20863585
tags question: http://stackoverflow.com/q/20914834
tags question: http://stackoverflow.com/q/20962864
tags question: http://stackoverflow.com/q/20869450
type: Tag
tags question: http://stackoverflow.com/q/21014861
tags question: http://stackoverflow.com/q/20982233
tags question: http://stackoverflow.com/q/20951761
tags question: http://stackoverflow.com/q/20990255

http://stackoverflow.com/q/20955117
favorite count: 0
has title: Handling JMSExceptions when using JMS, specifically ActiveMQ?
tagged with: activemq-classic
tagged with: mom
upvote count: 1
accepted answer: http://stackoverflow.com/a/20955618
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20955618
answer count: 1
downvote count: 0
has body: In the following snippet: Connection connection=getConnection(); try { Session session=connection.createSession(); try { Queue queue=session.createQueue("foobar"); MessageConsumer consumer=null; try { consumer = session.createConsumer(queue); } catch(JMSException e) { // Under what circumstances does this happen? } try { // ... } finally { if(consumer != null) consumer.close(); } } finally { session.close(); } } finally { connection.close(); } Under what circumstances is the caught JMSException thrown? When it happens, what is the proper way to handle the JMSException? I've read the relevant bits of JMS and ActiveMQ documentation and it doesn't seem to give any guidance on this point (other than use try/catch, obviously.) Also please forgive the contrived code example! For example, does a JMSException happen if session has "gone bad" in some way, so it's The Right Thing to tear down consumer and session and start over? Or does it mean connection has gone bad, and so I should tear down and rebuild everything in the application that is based on that connection? Or can a call to createConsumer() fail in a transient way, and retrying the call with the same session could succeed? Similarly, when would these lines throw a JMSException, ignoring something like a closed Session or Connection: Message message=consumer.receive(); producer.send(message); I'd like to understand how JMSExceptions should be handled in JMS in general, but answers specific to ActiveMQ are fine, too. (In fact, it's likely that any answer may have to be specific to a specific implementation, since JMS is just a spec.)
tagged with: jms

http://stackoverflow.com/q/20966046
tagged with: jax-ws
type: Question
has answer: http://stackoverflow.com/a/20966363
has answer: http://stackoverflow.com/a/20966255
score: 0
answer count: 3
type: UnansweredQuestion
tagged with: web-services
tagged with: spring
has answer: http://stackoverflow.com/a/20966860
has title: How to secure Cxf jax-ws webservice?
has body: I am new in web services. I have created web services using spring with CXF jax-ws implementation. Suppose I have "HelloWebService" in that I have webmethod "sayHello()" which will return string. when I hit url: localhost:8080/ProjName/service/HelloWebService?wsdl It shows me wsdl on browser. Now, I want to ask username and password when user hit this url on browser. How can I do this?
tagged with: cxf
linked to: http://stackoverflow.com/q/8782602
tagged with: java

http://stackoverflow.com/comment/31548461
has text: Aesthetically, 1st one :) Otherwise, all same.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20994728

http://stackoverflow.com/comment/31303248
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20862393
type: Comment
has text: I think it is better to force someone to think and do some reading. You learn by trying not by using code that someone else wrote for you. By pointing the OP to the tutorial they can start with that working code and then customize it for their particular requirement. Of course the OP accepted this answer because he didn't have to do any work.

http://stackoverflow.com/a/20932849
answers question: http://stackoverflow.com/q/20932537
has comment: http://stackoverflow.com/comment/31459283
has comment: http://stackoverflow.com/comment/31460430
has comment: http://stackoverflow.com/comment/31433265
type: Answer
has body: Try the following: public static void differentFontTypeInSameCell(){ Workbook wb = new HSSFWorkbook(); Sheet sheet = wb.createSheet("TestSheet"); Cell cell = sheet.createRow(0).createCell(0); Font underlineFont = wb.createFont(); underlineFont.setUnderline(HSSFFont.U_DOUBLE); Font boldFont = wb.createFont(); boldFont.setBoldweight(Font.BOLDWEIGHT_BOLD); Font italicFont = wb.createFont(); italicFont.setItalic(true); CellStyle style = wb.createCellStyle(); style.setFont(underlineFont); cell.setCellStyle(style); RichTextString richString = new HSSFRichTextString("Underline, Bold, Italic"); richString.applyFont(11, 15, boldFont); richString.applyFont(17, 23, italicFont); cell.setCellValue(richString); } Will look like You can change the font colors as well in the same way... refer here
upvote count: 14
has comment: http://stackoverflow.com/comment/31460812
score: 14
has comment: http://stackoverflow.com/comment/132370573
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20932537

http://stackoverflow.com/q/20887721
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20887764
has body: I newbie in this programming language and when I created timer, got errors. First I import: import java.util.Timer; Then created timer: public class Road extends JPanel implements ActionListener { Timer Timer = new Timer(); timer.schedule(); Image img = new ImageIcon("res/Road.png").getImage(); Player p = new Player(); public void paint(Graphics g){ g = (Graphics2D) g; g.drawImage(img, p.layer1, 0, null); g.drawImage(p.img, p.x, p.y, null); } public void actionPerformed(ActionEvent e){ p.move(); repaint(); } } But in lane timer.schedule() I got error that this is a syntax error on token "schedule" or identifier expected after this token
has answer: http://stackoverflow.com/a/20887765
type: Question
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/20887754
upvote count: 2
has title: How to create timer in Java?
has comment: http://stackoverflow.com/comment/31347067
has answer: http://stackoverflow.com/a/20887738
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/31347075

http://stackoverflow.com/comment/31480008
has text: @user3157669: I don't see what that comment has to do with the question or with my answer. Your problem is that your code raises a `TypeError`. I showed you why it does that, and how to fix it. So fix that error and move forward until you get stuck again, then ask a new question.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/20942998
type: AnswerComment

http://stackoverflow.com/comment/31410908
comment on: http://stackoverflow.com/a/20921404
score: 1
type: AnswerComment
type: Comment
has text: Yes, you are right I didn't see them, my fault. But on the other hand I offered something else than you, by proposing to compute the shorter length instead of only source length.

http://stackoverflow.com/a/21213111
has body: @Waterbear Thanks so much for your solution about getting an SHA-1 certificate instead of SHA-2. This was definitely the problem I was having. (I would have posted this underneath your comment, but StackOverflow said it was way too long.) I had gotten a 3-year certificate, and by default GoDaddy gives an SHA-2 for certificates expiring after a certain date. However, even when I re-keyed and asked for an SHA-1, I still ended up with an SHA-2. I had to revoke my certificate and then start the process from scratch to get an SHA-1 certificate. (By starting from scratch, I mean GoDaddy must again verify your company and phone number and all that.) By the way, if you do revoke your certificate, make sure you ask GoDaddy for permission first because technically they don't have to give you a refund. In addition, I wasn't able to get a 3-year certificate because anything that expires after a certain date (2016?) must be SHA-2 and not SHA-1. I basically had to get a refund for my 3-year certificate and instead get a 1-year certificate to even have the SHA-1 option. But after going with SHA-1, GoDaddy's instructions in approach#1 worked fine. I would recommend doing generating your CSR manually using the keytool command (instead of automatically through a web browser). Later, you just download the PEM file and import it into the keystore using the keytool command. (This is what GoDaddy's describes in "approach 1" in the link posted in the question.) Lastly if you do have to have a certificate reissued, and go through this process again, I would highly recommend choosing another company besides GoDaddy for code-signing. Their tech support was absolutely horrendous. Their support techs even admitted to me they weren't trained in this. The hours spent on this issue greatly offset any money saved on the cert.
upvote count: 2
answers question: http://stackoverflow.com/q/20896880
score: 2
downvote count: 0
type: Answer

http://stackoverflow.com/q/20982394
has body: I was reading some articles on topic "implement runnable vs extend thread" and I do understand that implementing runnable is prefered because in Java you can't have multiple inheritance. I also read some article that said when you use run() method it just executes the code in current thread, and when you use start() it creates new thread which is I think better, but it depends. But I am still confused about, why you should implement Runnable in class? Why is that needed? Or extending Thread? You can create anonymous thread and start it without implementing runnable or anything. Sample code of anonymous thread without implementing or extending new Thread() { public void run() { System.out.print("Example"); } }.start(); EDIT: After some answers and comments, I think what I did not understand was bit more clarified. I actually did not know the reason of implementing Runnable if its run method does not create new Thread. But many of you told me you can use something like this new Thread(new Runnable()) So finally I want to know - This code up here, does it create a new Thread and executes the code inside the run method ?
has comment: http://stackoverflow.com/comment/31527043
has answer: http://stackoverflow.com/a/20982553
linked to: http://stackoverflow.com/q/541487
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31526728
score: 2
has title: When you should implement Runnable?
has comment: http://stackoverflow.com/comment/31526850
has answer: http://stackoverflow.com/a/20982688
has comment: http://stackoverflow.com/comment/31527743
upvote count: 3
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/31526680
has answer: http://stackoverflow.com/a/20982494
type: Question
accepted answer: http://stackoverflow.com/a/20982731
linked to: http://stackoverflow.com/q/15471432
has comment: http://stackoverflow.com/comment/31527912
has comment: http://stackoverflow.com/comment/31526967
has comment: http://stackoverflow.com/comment/31526827
answer count: 7
has answer: http://stackoverflow.com/a/20982411
favorite count: 0
possible better answer: http://stackoverflow.com/a/20982625
has answer: http://stackoverflow.com/a/20982574
has answer: http://stackoverflow.com/a/20982731
has answer: http://stackoverflow.com/a/20982625
tagged with: multithreading

http://stackoverflow.com/a/20942296
has comment: http://stackoverflow.com/comment/31451557
type: Answer
has body: I believe your problem is that your class Character is-a Spriter and has-a Spriter (and probably shouldn't "have-a" Spriter but I can't tell because you didn't post all of your code). You never initialized the super instance of your Character. public class Character extends Spriter{ public Character(Spriter s, long health, long power) { // super(health, power); // &lt;-- Speculation, no constructors shown in your code. this.s = s; this.health = health; this.power = power; super.setX(randomY()); //&lt;-- set the super value super.setY(randomY()); //&lt;-- again. // s.setX() // &lt;-- not sure, why do you have s? }
answers question: http://stackoverflow.com/q/20941717
has comment: http://stackoverflow.com/comment/31452122
has comment: http://stackoverflow.com/comment/31451664
has comment: http://stackoverflow.com/comment/31451531
has comment: http://stackoverflow.com/comment/31451747
has comment: http://stackoverflow.com/comment/31451684
has comment: http://stackoverflow.com/comment/31451757
score: 0
has comment: http://stackoverflow.com/comment/31452181

http://stackoverflow.com/comment/31309062
has text: its working fine. but what could be the problem in using try catch methods(throwing exceptions)?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20858598

http://stackoverflow.com/a/20908066
score: 0
type: Answer
has body: import java.util.Scanner; public class StackFlow { public static void main(String[] args) { Scanner console = new Scanner(System.in); final int Username = 3387; final int Password = 5183; final int AccountNumber = 22334455; int EnteredUsername; int EnteredPassword; int EnteredAccountNumber; for(int s=0;s&lt;=3;s++) {if (s&lt;3) {System.out.println("Enter Username"); EnteredUsername = console.nextInt(); System.out.println("Username Entered is " + EnteredUsername); System.out.println("Enter Password"); EnteredPassword = console.nextInt(); System.out.println("Password Entered is " + EnteredPassword); System.out.println("Enter Account Number"); EnteredAccountNumber = console.nextInt(); System.out.println("Account Number Entered is " + EnteredAccountNumber); if (Username == EnteredUsername &amp;&amp; (Password == EnteredPassword) &amp;&amp; (AccountNumber == EnteredAccountNumber)) { System.out.println("Welcome"); break; } else { System.out.println("Wrong Username, Password or Account Number. Please try again"); } } else { System.out.println("You waste your 3 chances Bye-Bye"); } } }}
answers question: http://stackoverflow.com/q/20906739

http://stackoverflow.com/comment/43959107
type: Comment
has text: How much feasible is this approach ?
comment on: http://stackoverflow.com/a/23383041
type: AnswerComment
score: 0

http://stackoverflow.com/a/20869504
answers question: http://stackoverflow.com/q/20869473
score: 4
has comment: http://stackoverflow.com/comment/31314129
has comment: http://stackoverflow.com/comment/31313304
has body: I don't know why you think committing a transaction frees heap memory. Running garbage collection does that. OOM error can happen if your perm gen is exhausted. The easy answer is to change your min and max heap sizes and perm gen size when you start the JVM and see if it goes away. I'd recommending getting a profiler, like VisualVM, and seeing what is consuming your memory at runtime. It should be easy to fix. I'd guess that you're trying to commit too large a chunk at once. Break it up into smaller pieces and see if that helps.
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/q/20966998
tagged with: java
downvote count: 1
type: Question
has body: I am making a program to convert one temperature to another temperature. In example, Fahrenheit to Celsius, Celsius to Fahrenheit, Celsius to kelvin, etc. I've got the GUI set up, but now i'm getting errors during conversion. I've looked for conversion methods, but can't seem to find any. So i'm writing them based on formulas i've seen online. private static class EventHandler implements ActionListener { /** * this method gets called when an object we are listening to is interacted with * * @param evt ActionEvent that interacted with */ public void actionPerformed(ActionEvent evt) { //creates the formating we would like for the numbers DecimalFormat df = new DecimalFormat("#.##"); //if the event triggered was celInput than if (evt.getSource() == cText) { String strcText = cText.getText(); double cTemp = Double.parseDouble(strcText); fText.setText("" + convertCtoF(cTemp)); kText.setText("" + convertCtoK(cTemp)); }else if(evt.getSource() == fText) { String strfText = fText.getText(); double fTemp = Double.parseDouble(strfText); cText.setText("" + convertFtoC(fTemp)); kText.setText("" + convertFtoK(fTemp)); }else if(evt.getSource() == kText) { String strkText = kText.getText(); double kTemp = Double.parseDouble(strkText); cText.setText("" + convertKtoC(kTemp)); fText.setText("" + convertKtoF(kTemp)); } }//end actionPerformed method } public static double convertCtoF(double c) { return (c / (5/9)) + 32; } public static double convertFtoC(double f) { return (5/9) * (f - 32); } public static double convertCtoK(double c) { return c + 273.15; } public static double convertFtoK(double f) { return convertFtoC(f) + 273.15; } public static double convertKtoC(double k) { return k - 273.15; } public static double convertKtoF(double k) { return ((9/5) * convertKtoC(k)) + 32; } That's all the code I think would be necessary in order to find the logic error. Any help would be greatly appreciated, as I cannot see why this is occurring.
upvote count: 0
tagged with: temperature
has comment: http://stackoverflow.com/comment/31497657
has title: Logic Error in Temperature Conversion
has comment: http://stackoverflow.com/comment/31497434
tagged with: logic
has answer: http://stackoverflow.com/a/20967038
answer count: 3
has answer: http://stackoverflow.com/a/20968359
score: -1
favorite count: 0
has answer: http://stackoverflow.com/a/20967124
type: UnansweredQuestion

http://stackoverflow.com/q/20936053
has comment: http://stackoverflow.com/comment/31438928
has comment: http://stackoverflow.com/comment/31439270
has title: How to implement an already well implemented module(like stack) in java using a linked list
tagged with: linked-list
linked to: http://stackoverflow.com/q/5552117
tagged with: stack
tagged with: java
linked to: http://stackoverflow.com/q/12056784
type: Question
score: 0
has comment: http://stackoverflow.com/comment/31439287
has comment: http://stackoverflow.com/comment/31439587
answer count: 1
has comment: http://stackoverflow.com/comment/31439101
favorite count: 0
has body: I'm trying to implement an stack using a linked list in Java, But I'm not sure which methods I have to implement(stack is a simple example here), How can I somehow get the methods and then extend my linked list class to implement my own class of stack I know that somehow I have to use some kind of interface but it would be a great help if someone could guide me here.
has answer: http://stackoverflow.com/a/20936279
has comment: http://stackoverflow.com/comment/31438987
has comment: http://stackoverflow.com/comment/31439151
has comment: http://stackoverflow.com/comment/31439161
upvote count: 3
type: UnansweredQuestion
tagged with: interface
linked to: http://stackoverflow.com/q/13638289
downvote count: 3

http://stackoverflow.com/comment/31342342
score: 0
type: Comment
has text: Thanks Leigh and Steve for the help I did finally get it figured out with your help. In reference to what Leigh said, yes you were absolutely right, not sure why I didn't catch that but nonetheless. This is what I came up with and it works as expected....code below. One thing of note is that I did however run into an additional issue when running my code. I got this weird index error "Attempting to use index type '-1' where index types are not allowed (1 or -1 only)." But I was able to resolve that issue. Thanks again!
comment on: http://stackoverflow.com/a/20860142
type: AnswerComment

http://stackoverflow.com/comment/31461203
type: Comment
comment on: http://stackoverflow.com/a/20934376
score: 0
type: AnswerComment
has text: Ohh ! Thanks ! Can u please also suggest how can I get HttpOnly cookies using Jsoup or some other way ?

http://stackoverflow.com/comment/31478569
type: Comment
has text: in my real problem I'll put more than one byte into outputbuffer array if it has enough space and than I'll write it into file. In your solution I couldnt see where should I use outputbuffer array ?
comment on: http://stackoverflow.com/a/20956822
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31546768
has text: Can you post your `web.xml` and `dispatcher-servlet.xml`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20992525
score: 0

http://stackoverflow.com/comment/31300808
type: AnswerComment
comment on: http://stackoverflow.com/a/20862055
has text: What is interesting for me is that I dont actually need the values of these tags, I just need their names...
score: 0
type: Comment

http://stackoverflow.com/comment/31433137
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20932986
score: 0
has text: sir i got it from your above comment on my post and i am really thankfull from the depth of my heart. It is my bad that i didn't post the xml file and once again thanks alot Sir.

http://stackoverflow.com/q/20987644
answer count: 1
tagged with: tomcat
has answer: http://stackoverflow.com/a/20987768
type: UnansweredQuestion
has title: Mysql communication error in tomcat even with out using any mysql in application
tagged with: java
tagged with: mysql
has body: I am Getting following error when ever i am starting my tomcat com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.net.ConnectException MESSAGE: Connection refused I am getting this error even with out using any application in my tomcat. Could you please help me why tomcat is looking for mysql connect at the time of start Regards
type: Question
has comment: http://stackoverflow.com/comment/31536455
score: 0
has comment: http://stackoverflow.com/comment/31536394

http://stackoverflow.com/a/20972607
has body: It's a static initializer. It's executed when the class is loaded (or initialized). For more details please read http://docs.oracle.com/javase/tutorial/java/javaOO/initial.html
type: Answer
answers question: http://stackoverflow.com/q/20972577
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/a/20953046
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/20938075
score: 3
has body: This is actually a reasonably easy use case with Akka's clustering. 50K sessions represented as an Actor instance for each is not very high load. The reason to use clustering is only for fault tolerance. The idea behind the architecture would be to have a web tier for handling RESTful requests that correspond to the sessions. These requests would be sent to the Akka cluster and routed to the appropriate session Actor by session ID, or a new one would be created. When a session is done, you stop the actor that is associated with it. Note that the session actors should send themselves timeout messages via the scheduler. Upon completion of handling a new message, the actor should schedule itself a message via the ActorSystem scheduler for 15 minutes (or whatever your timeout is). When a new session message is received, that scheduled task should be cancelled, the new update handled, and then a new timeout scheduled. There is a plausible race condition here, in that a timeout message may be in your session actor's mailbox queue AFTER a session message, but if your timeout message includes a time of when it was scheduled (the 15 minutes ago), you can check that and ignore it and reschedule another (just as a safety mechanism to avoid a memory leak). If the time is greater than 15 minutes ago, then you stop the actor. To see how the distribution of work to the session actors would be implemented, please see the "Distributed Workers with Akka and Java" template in Typesafe's Activator. You will have a fully running clustered Akka application that you can tailor to do the session management as I've described above. You can then export the project and work on it in Eclipse/IntelliJ/Sublime/TextMate/etc. To download Activator, see here.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20938075

http://stackoverflow.com/comment/31309805
type: Comment
has text: the sweets are already in the jar. would you like to see the xml code?
comment on: http://stackoverflow.com/a/20867405
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31942413
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20987321
has text: possible duplicate of [Android-Opencv: Procedure of using SURF in opencv](http://stackoverflow.com/questions/7410852/android-opencv-procedure-of-using-surf-in-opencv)
score: 1

http://stackoverflow.com/comment/31582091
comment on: http://stackoverflow.com/a/20988595
score: 0
type: AnswerComment
type: Comment
has text: REPORT ANALYSIS FOR GOVERNMENT

http://stackoverflow.com/comment/31370748
comment on: http://stackoverflow.com/a/20898601
score: 0
type: AnswerComment
type: Comment
has text: Here's a suggestion. I see you have a `SavingsAccount` array. So you probably want multiple accounts. I also you that you're trying to access a specific account by account id in the actionPerformed if the `checkB` is pressed. What you should do then, if loop through the array and if the id is found, _then_ use that account to do your work.

http://stackoverflow.com/comment/31575153
has text: So the only thing that I can do is casting object?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21008518
type: Comment

http://stackoverflow.com/comment/31368256
comment on: http://stackoverflow.com/q/20898983
has text: Regex is not the best option in this case.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20959345
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31483779
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/20959576
has comment: http://stackoverflow.com/comment/31483947
has body: This time I'm trying to realize file upload to server using Spring. But also get NullPointerException on file upload controller. mvc-dispatcher-servlet: <?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:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> <property name="maxUploadSize" value="100000000"/> //Other beans... </beans> Controller method: @RequestMapping(value = "/uploadAvatar", method = RequestMethod.POST) public String uploadAvatar(@ModelAttribute("avatar") UploadedFile uploadedFile, BindingResult result) { InputStream inputStream = null; OutputStream outputStream = null; System.out.println(uploadedFile.getFile().isEmpty()); //[Line21] Here I have NullPointerException MultipartFile file = uploadedFile.getFile(); String fileName = file.getName(); if(result.hasErrors()) return "profile"; try { inputStream = file.getInputStream(); File newFile = new File("/resources/img/" + fileName); outputStream = new FileOutputStream(newFile); int read = 0; byte[] bytes = new byte[1024]; while ((read = inputStream.read(bytes)) != -1) { outputStream.write(bytes, 0, read); } } catch (IOException e) { e.printStackTrace(); } return "index"; } Uploded File: public class UploadedFile { private MultipartFile file; public MultipartFile getFile() { return file; } public void setFile(MultipartFile file) { System.out.println("setFile"); this.file = file; } } Web Page: <form:form m…
has title: Spring file upload using MultipartResolver. NullPointerException
upvote count: 1
tagged with: spring
accepted answer: http://stackoverflow.com/a/20959576
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31484016
has comment: http://stackoverflow.com/comment/31483582

http://stackoverflow.com/q/20875682
downvote count: 3
has comment: http://stackoverflow.com/comment/31325628
type: Question
tagged with: java
has title: calculating with java with two file program
has comment: http://stackoverflow.com/comment/31325615
upvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20875740
tagged with: date-arithmetic
score: -3
has comment: http://stackoverflow.com/comment/31325588
has body: I have a question on how to calculate with java. In my case, I think I am doing the calculations right, but when I run it, I get a few 0s and some absurd number. How can I fix this? Any help will be greatly appreciated. Below is my code: public class CO2Footprint { private int NumberOfPeople, CO2PerPerson, lightBulbs, months; private double TotalEmission, ReductionPerPaper, ReductionPerPlastic, ReductionPerGlass, ReductionPerCan, TotalReduction, FamilyNetEmission, annualGasoline, electricityBill , lightBulbsRecycled, annualFuelUse, averageMonthlyCostElec, emissionFactor, monthlyCostSeptElec, monthlyCostOct, monthlyCostNov, averagePricePerKilowatt, totalWaste, elecPrice, NetEmission; private boolean paper, plastic, glass, can; CO2Footprint(int numPeople, boolean bpaper, boolean bplastic, boolean bglass, boolean bcans, double annuallGasoline , double electricityyPrice, int lighttBulbs){ NumberOfPeople = 0; paper = bpaper; plastic = bplastic; glass = bglass; can = bcans; ReductionPerPaper = 184; CO2PerPerson = 1018; ReductionPerPlastic = 25.6; ReductionPerGlass = 46.6; ReductionPerCan = 165.8; TotalEmission = 0; annualGasoline = 16.5; electricityBill = 0; lightBulbs = 10; lightBulbsRecycled = 0; annualFuelUse = 0; averageMonthlyCostElec = 0; emissionFactor = 1.37; monthlyCostSeptElec = 551.51; monthlyCostOct = 392.84; monthlyCostNov = 445.42; months = 12; averagePricePerKilowatt = 4.83; totalWaste = 0; NetEmission = 0.0; } // method for calculating total emission public double totalEmission(){ TotalEmission = NumberOfPeople * CO2PerPerson; return TotalEmission; } // method for calculating CO2 reduction public double reduction(){ TotalReduction = 0; ReductionPerPaper = 0; ReductionPerPlastic = 0; ReductionPerGlass = 0; ReductionPerCan = 0; if(paper = true){ ReductionPerPaper = 184; }else{ ReductionPerPaper = 0; } if(plastic = true){ ReductionPerPlastic = 25.6; }else{ ReductionPerPlastic = 0; } if(glass = true){ ReductionPerGlass = 46.6; }else{ ReductionPerGlass = 0; } i…

http://stackoverflow.com/comment/31557196
has text: If you know Java, I would suggest you continue with Java.
type: Comment
comment on: http://stackoverflow.com/q/20999456
type: QuestionComment
score: 1

http://stackoverflow.com/q/20995664
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/31550417
has body: Consider a class User public class User{ int userId; String name; Date date; } Now I have a List&lt;User&gt; of size 20, how can I find the max date in the list without using manual iterator?
has answer: http://stackoverflow.com/a/20996009
tagged with: collections
type: Question
has answer: http://stackoverflow.com/a/53724878
score: 88
has comment: http://stackoverflow.com/comment/31550576
tagged with: java
has answer: http://stackoverflow.com/a/20996161
upvote count: 88
answer count: 7
has answer: http://stackoverflow.com/a/61045791
has answer: http://stackoverflow.com/a/59537785
favorite count: 0
has answer: http://stackoverflow.com/a/49390762
has answer: http://stackoverflow.com/a/66238258
has comment: http://stackoverflow.com/comment/31550163
has comment: http://stackoverflow.com/comment/31550142
accepted answer: http://stackoverflow.com/a/20996009
has comment: http://stackoverflow.com/comment/31550445
has title: How to find Max Date in List<Object>?
possible better answer: http://stackoverflow.com/a/49390762

http://stackoverflow.com/a/31976315
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/20908316
has body: This can be solved by adding the new version of javaassist as a shared library . The details are described here [http://www-01.ibm.com/support/docview.wss?uid=swg27006159#usingserver][1]. The shared library should be assigned against the a new class loader defined at the server configuration. The class loading policy should be PARENT_LAST for this class loader
type: Answer
upvote count: 2

http://stackoverflow.com/comment/59654373
type: AnswerComment
has text: They are completely different codebases these days, as evidenced in this case by the lack of a `MarginType` interface in Apache POI (Java), which means your answer doesn't work!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/35989343

http://stackoverflow.com/comment/31501055
comment on: http://stackoverflow.com/a/20968789
has text: i did try this, and it's not working, but tx forthe effort (:
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/25792369
has body: There is NoConnection Error that get thrown for the Request. Please catch the error in @Override public void onErrorResponse(VolleyError volleyError) { String message = null; if (volleyError instanceof NetworkError) { message = "Cannot connect to Internet...Please check your connection!"; } else if (volleyError instanceof ServerError) { message = "The server could not be found. Please try again after some time!!"; } else if (volleyError instanceof AuthFailureError) { message = "Cannot connect to Internet...Please check your connection!"; } else if (volleyError instanceof ParseError) { message = "Parsing error! Please try again after some time!!"; } else if (volleyError instanceof NoConnectionError) { message = "Cannot connect to Internet...Please check your connection!"; } else if (volleyError instanceof TimeoutError) { message = "Connection TimeOut! Please check your internet connection."; } }
downvote count: 1
accepted answer of: http://stackoverflow.com/q/21011279
upvote count: 113
has comment: http://stackoverflow.com/comment/64400303
answers question: http://stackoverflow.com/q/21011279
score: 112
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/78603111

http://stackoverflow.com/comment/31363140
has text: Declaring vars within functions or within control flow statements make them private. [Here](http://javascript.crockford.com/private.html) is a detailed description.
type: Comment
comment on: http://stackoverflow.com/a/20895892
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31467466
has text: where is your files store is it in table ?
score: 0
comment on: http://stackoverflow.com/q/20949396
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31428537
type: QuestionComment
comment on: http://stackoverflow.com/q/20893802
has text: Uh... A String is NOT a char array ... [Strings are Objects](http://stackoverflow.com/questions/13202051/are-java-string-objects-an-array-of-chars)
score: 0
type: Comment

http://stackoverflow.com/a/46685022
type: AcceptedAnswer
downvote count: 0
upvote count: 48
has comment: http://stackoverflow.com/comment/129723126
type: Answer
accepted answer of: http://stackoverflow.com/q/20896935
has body: The accepted answer was not fixed my problem, the working solution is to set the default schema as mentioned by Coder DOCTORASSIST And also to initialize the creation of the schema: <property name="hibernate.connection.url" value="jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;INIT=CREATE SCHEMA IF NOT EXISTS DOCTORASSIST"/> As mentioned by user2180794 the parameter test is the name of the database and not the name of the schema
answers question: http://stackoverflow.com/q/20896935
score: 48

http://stackoverflow.com/q/20907011
tagged with: java
has body: The pom build file works fine before, but today, I am seeing error of Caused by: org.apache.maven.plugin.version.PluginVersionNotFoundException: The plugin 'org.codehaus.mojo:cobertura-maven-plugin' does not exist or no valid version could be found I run mvn with "-X", and I am not seeing it tried to resolve or load from remote repository. [DEBUG] cobertura-maven-plugin: using locally installed snapshot [DEBUG] Artifact not found - using stub model: Unable to determine the latest version To force it reload repository, I removed org\codehaus folder from my local repository, still got the same error. I am very curious to know why maven does not load it from external repository. Here is the stack trace. Caused by: org.apache.maven.plugin.version.PluginVersionNotFoundException: The plugin 'org.codehaus.mojo:cobertura-maven-plugin' does not exist or no valid version could be found at org.apache.maven.plugin.version.DefaultPluginVersionManager.resolvePluginVersion(DefaultPluginVersionManager.java:229) at org.apache.maven.plugin.version.DefaultPluginVersionManager.resolvePluginVersion(DefaultPluginVersionManager.java:91) at org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPluginManager.java:179) at org.apache.maven.plugin.DefaultPluginManager.loadPluginDescriptor(DefaultPluginManager.java:1642) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1540)
has answer: http://stackoverflow.com/a/20911615
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31392322
has comment: http://stackoverflow.com/comment/31392687
type: Question
has title: org.codehaus.mojo:cobertura-maven-plugin does not exist or no valid version
accepted answer: http://stackoverflow.com/a/20911615
tagged with: maven-cobertura-plugin
score: 0
tagged with: maven
answer count: 1

http://stackoverflow.com/comment/31393747
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/20912108
has text: While mostly the same as JoeC's below, I think this is the better implementation from a usability standpoint because it gives the user an idea about the validation criteria.

http://stackoverflow.com/q/20866807
has body: Possible duplicate of Google App Engine JDO enhancement is failing. This is my first app engine app which I'm implementing based on "appengine-java-sdk-1.8.8" and Intellij Idea 13.0. Following image shows my application. I have designed my application based on tutorial on Intellij Idea page. In web.xml file if I clear lines 8-18 and remove mobilesoft.asia package from src folder then application works fine and when I click on Run button then I can see my "Hello world" message that I have written on index.jsp file. However, with having of my package and lines 8-18 in web.xml then exception happens when I click on Run button. Any suggestion would be appreciated. ============== Edit: I downloaded 'datanucleus-appengine-2.0.0-final-dist' via this page. Seems it is latest release. Then I compared with what items I found under appengine-java-sdk-1.8.8\lib\opt\tools\datanucleus\v2 and realized that seems appengine has newer version of datanucleus. Therefore, app engine shouldn't have problem with compile, I'm confused....
has answer: http://stackoverflow.com/a/20867468
tagged with: java
accepted answer: http://stackoverflow.com/a/20867468
score: -1
type: Question
upvote count: 0
tagged with: intellij-idea
tagged with: ant
has title: Google AppEngine Enhancer: Encountered a problam: Unexpected exception
tagged with: android
answer count: 1
linked to: http://stackoverflow.com/q/14554774
favorite count: 0
tagged with: google-app-engine
downvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/31288591
comment on: http://stackoverflow.com/q/20856694
type: Comment
has text: @TejKiran yes i got that so i have remove that comment and added solution.
score: 0
type: QuestionComment

http://stackoverflow.com/q/20857795
has body: In a nutshell, I have a ListView and when I scroll through it, I get grow heaps and on the device I can see it hooking. I've read something about recycling Bitmaps, but I haven't found a solution for doing this in my project. TeamFragment.java: public class TeamFragment extends ListFragment implements OnItemClickListener { private TeamListAdapter adapter; public TeamFragment() {} @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); this.fragmentNumber = getArguments().getInt(ARG_FRAGMENT_NUMBER); adapter = new TeamListAdapter(this.getActivity()); setListAdapter(adapter); getListView().setOnItemClickListener(this); } @Override public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int position, long id) { Intent intent = new Intent(view.getContext(), TeamDetailActivity.class); Bundle extra = new Bundle(); extra.putInt("drawable", adapter.getItem(position).getDrawable()); extra.putString("name", adapter.getItem(position).getName()); extra.putString("title", adapter.getItem(position).getTitle()); extra.putString("description", adapter.getItem(position).getDescription()); intent.putExtra("extra", extra); startActivityForResult(intent, 0); } } TeamListAdapter.java public class TeamListAdapter extends BaseAdapter { private final LayoutInflater inflater; private final List&lt;HumanItem&gt; humanItems; private String[] teamname_array; private String[] teamname_extra_array; private String[] teamdescription_array; private String[] teamid_array; public TeamListAdapter(Context context) { inflater = LayoutInflater.from(context); humanItems = new ArrayList&lt;HumanItem&gt;(); teamid_array = context.getResources().getStringArray( R.array.teamids); teamname_array = context.getResources().getStringArray( R.array.teamnames); teamname_extra_array = context.getResources().getStringArray( R.array.teamnames_extra); teamdescription_array = context.getResources().getStringArray( R.array.teamdescriptions); HumanItem …
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/20857830
tagged with: java
tagged with: bitmap
type: Question
has title: Grow Heaps in Android ListView
linked to: http://stackoverflow.com/q/20627849
tagged with: listview
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/20857832

http://stackoverflow.com/comment/31310142
score: 1
comment on: http://stackoverflow.com/q/20867864
type: Comment
type: QuestionComment
has text: what are the parameters you are trying to access ? could you post your web.xml files ?

http://stackoverflow.com/a/31051761
has body: 1) Let me call your wsdl file buzzor.wsdl. Save your wsdl in your project Directory as below and then Generate classes from wsdl file using wsdl2java plugin. In your pom.xml add this. org.apache.cxf cxf-codegen-plugin 3.1.0 generate-sources generate-sources ${project.build.directory}/generated-sources/cxf ${project.basedir}/src/main/resources/wsdl/buzzor.wsdl classpath:wsdl/buzzor.wsdl -client wsdl2java You will see the generated classes as below.. ApplicationServicePortType_ApplicationServiceHttpPort_Client.java is a sample client, which you can use to write your custom client if you want. in your case let us use ApplicationServicePortType.java which defines 2 methods a) public java.lang.String getApplication(); b) public http.model_application_buzzor_atpl.ApplicationResult addApplication(...); 2) in your spring context configure the Jaxws client. <beans xmlns:jaxws="http://cxf.apache.org/jaxws" xsi:schemaLocation="http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"> <jaxws:client id="applicationService" serviceClass="com.atpl.buzzor.application.service.ApplicationServicePortType" address="http://localhost:8081/buzzor-service/services/ApplicationService" /> 3) in your Camel route you can invoke a bean... @Inject private SoapUtils soapUtils; ... from("direct:some-endpoint") .bean(soapUtils,"invokeWebserviceAndGetResponse") 4) in your SoapUtils class you can inject the applicationService bean and invoke the webservice import com.atpl.buzzor.application.service.ApplicationServicePortType; import http.model_application_buzzor_atpl.ApplicationResult; import http.model_application_buzzor_atpl.Application; import http.model_application_buzzor_atpl.User; public class SoapUtils { @Inject private ApplicationServicePortType applicationService; public void invokeWebserviceAndGetResponse(Exchange exchange) { java.lang.String response = applicationService.getApplication(); ..or.. Application application = new Application(); //or whichever way you generate this. …
type: Answer
answers question: http://stackoverflow.com/q/20883021
score: 0

http://stackoverflow.com/comment/31383990
has text: BTW, I'm getting onLocationChanged() method fired constantly on Samsung Galaxy Ace 2 I8160.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20906053

http://stackoverflow.com/q/20929119
has comment: http://stackoverflow.com/comment/31426094
has body: I've signed my jar file with a key I've created, but whenever I try to run my app i get the error: java.security.AccessControlException: access denied ("java.awt.AWTPermission" "createRobot") This error arises even after I agree to allow the application to run. The application is a simple applet using JOGL and JBullet. You can find it here: http://kevservices.com/jogl.php I'm using the robot to keep the mouse centered as much as possible and remain within the bounds of the application. I've searched for solutions and have tried what I've found; To no avail.
tagged with: java
type: Question
has title: My jar file is signed but I still get a security exception
score: 0
linked to: http://stackoverflow.com/q/3446524
tagged with: permissions
tagged with: jogl
answer count: 0
has comment: http://stackoverflow.com/comment/31426184
type: UnansweredQuestion

http://stackoverflow.com/q/20915832
type: AnsweredQuestion
has body: I am working on an android application extending activity and implementing Runnable. The problem is that the run() function is not launched and I'm not sure if implementing Runnable make it launch automaticly as AsyncTask? Here is my code public class MainActivity extends FragmentActivity implements ActionBar.TabListener, Runnable { ... @Override public void run() { // mediaPlayer is myMediaPlayer // progress is my SeekBar Log.w("Tunesto", "testabababab"); int currentPosition = 0; int total = mediaPlayer.getDuration(); progress.setMax(total); while (mediaPlayer != null &amp;&amp; currentPosition &lt; total) { try { Thread.sleep(1000); currentPosition = mediaPlayer.getCurrentPosition(); } catch (InterruptedException e) { return; } catch (Exception e) { return; } progress.setProgress(currentPosition); Log.w("MyApp", String.valueOf(currentPosition)); } } } Obviously if I launch Run fro, the UI Thread it will freeze the screen because of the sleep method, so how should I do to let the Run method to run? Thank you!
downvote count: 0
tagged with: multithreading
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20915889
has title: Android - Runnable run() function is not working
answer count: 2
has comment: http://stackoverflow.com/comment/31401485
upvote count: 1
tagged with: runnable
has answer: http://stackoverflow.com/a/20915964
accepted answer: http://stackoverflow.com/a/20915964
favorite count: 0
tagged with: android
possible better answer: http://stackoverflow.com/a/20915889
tagged with: android-asynctask

3d-model
type: Tag
tags question: http://stackoverflow.com/q/20984214
tag name: 3d-model

http://stackoverflow.com/comment/31421058
type: Comment
comment on: http://stackoverflow.com/q/20926207
type: QuestionComment
has text: Window is the class which extends JFrame. It was part of an old method (instead of cards) I tried to use and is now of no use. I've removed it and the program behaves the same.
score: 0

http://stackoverflow.com/comment/31332881
type: Comment
has text: @SureshkumarPanneerselvan Added the code.
comment on: http://stackoverflow.com/q/20879513
score: 0
type: QuestionComment

http://stackoverflow.com/a/20906226
answers question: http://stackoverflow.com/q/20905780
accepted answer of: http://stackoverflow.com/q/20905780
has comment: http://stackoverflow.com/comment/31381668
upvote count: 1
has body: Actually you have messages.log it is in your graph.db directory. And there are loads of diagnostic, config, tuning, memory and other information in that file. So very valuable.
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/20860283
tagged with: java
has answer: http://stackoverflow.com/a/20865560
tagged with: datasource
type: Question
score: 5
tagged with: jndi
tagged with: tomcat
answer count: 2
linked to: http://stackoverflow.com/q/4099095
tagged with: jdbc
favorite count: 0
has title: Adding datasource programmatically to JNDI context in embedded tomcat 7
upvote count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20864169
has body: I'm trying to register a new datasource before the server starts but on lookup execution I'm getting javax.naming.NameNotFoundException: Name [jdbc/db] is not bound in this Context. Unable to find [jdbc]. This is how I start tomcat: Tomcat tomcat = new Tomcat(); //... ContextResource resource = new ContextResource(); resource.setName("jdbc/db"); resource.setAuth("Container"); resource.setType("javax.sql.DataSource"); resource.setScope("Sharable"); resource.setProperty("driverClassName", "org.hsqldb.jdbc.JDBCDriver"); resource.setProperty("url", "jdbc:hsqldb:hsql://localhost:1234/mydb1"); tomcat.getServer().getGlobalNamingResources().addResource(resource); tomcat.start(); tomcat.getServer().await(); The lookup: Connection conn = null; try { Context initContext = new InitialContext(); Context envContext = (Context) initContext.lookup("java:/comp/env"); DataSource ds = (DataSource) envContext.lookup("jdbc/db"); conn = ds.getConnection(); conn.createStatement().... } catch (Exception e) { e.printStackTrace(); } What am I missing here?
downvote count: 0

http://stackoverflow.com/a/20878316
type: Answer
score: 3
downvote count: 1
has body: Just iterate over the list and for each element check if it's an integer or not: int sum = 0; for (Object o : ll) { if (o instanceof Integer) { sum += ((Integer)o).intValue(); } }
has comment: http://stackoverflow.com/comment/31330056
upvote count: 4
has comment: http://stackoverflow.com/comment/31330167
has comment: http://stackoverflow.com/comment/31330304
answers question: http://stackoverflow.com/q/20878280

http://stackoverflow.com/q/20984472
has body: I have made an interface that covers all classes using generics, however I need additional methods for one class that implements this interface. I like to be able to use the dynamic binding of declaring variables as the interface, and then initialising it using one of the classes. This way my methods can be much easier to implement. However, it makes it tricky with one. To try and sum up the program simply, I have an interface: DataType&lt;T&gt; { public T getParameter(); public void setParameter(T value); } and the classes that implement this type are: StringData implements DataType&lt;String&gt; IntData implements DataType&lt;Int&gt; BooleanData implemets DataType&lt;Boolean&gt; DoubleData implements DataType&lt;Double&gt; and the one I want to have additional methods; ArrayData implements DataType&lt;ArrayList&lt;DataType&gt;&gt; The ArrayData class contains an ArrayList of the other DataTypes. So I want additional methods for adding, removing and getting a DataType to the list. However, these methods can't be called when using the Dynamic Binding technique above because not all DataType variables, so I was wondering if anyone know's a way around this, or anything I have missed. Thanks.
tagged with: interface
has title: Using extra methods when implementing an interface
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20984535
accepted answer: http://stackoverflow.com/a/20984535
tagged with: implements
tagged with: java
type: Question
tagged with: dynamic-binding
tagged with: class
score: 0
answer count: 1

http://stackoverflow.com/comment/31394783
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20912568
type: QuestionComment
has text: Why do you want to compile the files automatically without running them i.e. when you run/debug/profile the files will be compiled.

http://stackoverflow.com/a/21205048
has body: I have fixed the problem : For anyone having an error like this , You should make sure that @ManagedBean and the scope annotation are imported from javax.faces.bean.* otherwise the mangedBen won't be able to get the values from the JSF page. You need also to make sure that you input fields are inside a form element . For more details refer to this ManagedBean Params not accepted and Bean seemingly not in scope
answers question: http://stackoverflow.com/q/20874229
type: Answer
accepted answer of: http://stackoverflow.com/q/20874229
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/20881315
tagged with: java
downvote count: 2
type: Question
tagged with: object
has title: Does interface extend Object class?
tagged with: inheritance
linked to: http://stackoverflow.com/q/6056124
answer count: 3
has comment: http://stackoverflow.com/comment/31335342
duplicate of: http://stackoverflow.com/q/6056124
score: 1
has answer: http://stackoverflow.com/a/20881386
favorite count: 0
has answer: http://stackoverflow.com/a/20881447
has body: Means, by default in Java every class extends Object class. So interface also extends Object class or not?
type: UnansweredQuestion
tagged with: interface
has comment: http://stackoverflow.com/comment/31335249
has answer: http://stackoverflow.com/a/20881384
upvote count: 3

http://stackoverflow.com/a/21015188
has comment: http://stackoverflow.com/comment/31621290
type: Answer
has body: Not necessarily: the serialized version of two different objects does not need to be byte-equals for the two objects to be equals. There is nothing in the Serializable contract that makes any relationship between equals and the result of writeObject. Furthermore, from the Serialized Form (writeObject) documentation for Hashtable: .. [and Hashtable serializes] the key (Object) and value (Object) for each key-value mapping represented by the Hashtable The key-value mappings are emitted in no particular order. While, when I say two different objects above I mean "created independently", because I think it makes a better case overall, let's consider the contract for Object.clone to ascertain that it adds no additional restrictions (in fact, clone loses the equals restriction): Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression: x.clone() != x will be true, and that the expression: x.clone().getClass() == x.getClass() will be true, but these are not absolute requirements. While it is typically the case that: x.clone().equals(x) will be true, this is not an absolute requirement. As a further counter-example of clone implying an object which has the exact same serialized representation, consider an object that implements clone using serialization (which is perfectly valid and done in some languages): since serialization has no such requirement of byte-equality (e.g. ordering, as in the case of Hastable.writeObject), then the restored order of such serialization/deserialization (and later serialization) is not guaranteed either. Just because such a rule works on all the types/implementations used in practice (and it very likely will), does not imply that types for which byteEquals(serialize(a), serialize(clone(a)) is not true violate any stated contract or are otherwise implemented incorrectly. Here is some code using a Hashtable (I choose this type beca…
has comment: http://stackoverflow.com/comment/31624531
score: 0
answers question: http://stackoverflow.com/q/21013820

http://stackoverflow.com/comment/31475717
has text: I just went on to the other computer and double-clicked exactly how I ran it!
comment on: http://stackoverflow.com/q/20955488
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31445317
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20939129
score: 2
has text: You're the developer, shouldn't you know?

http://stackoverflow.com/q/20999320
score: 6
tagged with: jetty
tagged with: weld
accepted answer: http://stackoverflow.com/a/21024322
upvote count: 6
type: AnsweredQuestion
has body: I'm using Jetty 9.1 and Jersey 2.5.1. Jersey has built-in support for Jetty, so I start my server like that: public static void main(String[] args) { URI baseUri = UriBuilder.fromUri("http://localhost/").port(8080).build(); ResourceConfig config = ResourceConfig.forApplicationClass(MyApplication.class); Server server = JettyHttpContainerFactory.createServer(baseUri, config); } MyApplication simply calls this.packages(...) to lookup my REST api classes. However, the REST api class contains a @Inject annotated field, which should be injected by WELD. Obviously WELD is not started (CDI support not enabled), and weirder, it looks like HK2 (used by Jersey 2) is trying to perform the injection. (I have a org.glassfish.hk2.api.UnsatisfiedDependencyException when hitting the REST endpoint). How do I setup correctly WELD (preferably programmatically)?
tagged with: java
has title: Jetty Embedded, Jersey 2, Weld
type: Question
has comment: http://stackoverflow.com/comment/31559363
has answer: http://stackoverflow.com/a/21024322
answer count: 1
downvote count: 0
tagged with: jersey-2.0
favorite count: 0

http://stackoverflow.com/a/21011058
accepted answer of: http://stackoverflow.com/q/21011027
has body: I think you meant aString += " " + arrayName[row][col]; As it is, you're overwriting the string in each iteration.
answers question: http://stackoverflow.com/q/21011027
score: 4
type: AcceptedAnswer
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/31358436
score: 0
type: AnswerComment
has text: @Alex Sure but ... if he's getting that back in an HTTP query that's kinda ... odd.
type: Comment
comment on: http://stackoverflow.com/a/20892998

http://stackoverflow.com/a/20869409
score: 78
has comment: http://stackoverflow.com/comment/31447996
has comment: http://stackoverflow.com/comment/41282237
upvote count: 79
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/31334485
has body: Yes you can run JavaFX application on iOS, android, desktop, RaspberryPI (no windows8 mobile yet). Work in Action : We did it! JavaFX8 multimedia project on iPad, Android, Windows and Mac! JavaFX Everywhere Ensemble8 Javafx8 Android Demo My Sample JavaFX application Running on Raspberry Pi My Sample Application Running on Android JavaFX on iOS and Android Dev Resources : Android : Building and deploying JavaFX Applications on Android iOS : NetBeans support for JavaFX for iOS is out! Develop a JavaFX + iOS app with RoboVM + e(fx)clipse tools in 10 minutes If you are going to develop serious applications here is some more info Misc : At present for JavaFX Oracle priority list is Desktop (Mac,windows,linux) and Embedded (Raspberry Pi, beagle Board etc) .For iOS/android oracle done most of the hardwork and opnesourced javafxports of these platforms as part of OpenJFX ,but there is no JVM from oracle for ios/android.Community is putting all together by filling missing piece(JVM) for ios/android,Community made good progress in running JavaFX on ios (RoboVM) / android(DalvikVM). If you want you can also contribute to the community by sponsoring (Become a RoboVM sponsor) or start developing apps and report issues. Edit 06/23/2014 : Johan Vos created a website for javafx ports JavaFX on Mobile and Tablets,check this for updated info ..
has comment: http://stackoverflow.com/comment/55911353
answers question: http://stackoverflow.com/q/20860931

scheduler
tags question: http://stackoverflow.com/q/20875009
type: Tag
tag name: scheduler
tags question: http://stackoverflow.com/q/21013983

http://stackoverflow.com/comment/79896712
type: Comment
comment on: http://stackoverflow.com/a/20888967
type: AnswerComment
score: 0
has text: Depends on the `Provider` in use also https://doridori.github.io/Android-Security-Beware-of-the-default-IV

http://stackoverflow.com/a/20896357
answers question: http://stackoverflow.com/q/20896040
type: Answer
upvote count: 2
score: 2
downvote count: 0
has body: as the string represents a Hashmap inside another Hashmap you can use some thing like, HashMap&lt;String, HashMap&gt; hashMap = new Gson().fromJson(json, HashMap.class);

http://stackoverflow.com/q/20912455
favorite count: 0
tagged with: parsing
has comment: http://stackoverflow.com/comment/31394930
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/31395072
has comment: http://stackoverflow.com/comment/31395761
accepted answer: http://stackoverflow.com/a/20912733
has title: Math Expression Parser
has comment: http://stackoverflow.com/comment/31395226
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/31394685
has answer: http://stackoverflow.com/a/20912733
type: AnsweredQuestion
score: 2
downvote count: 0
has body: I found the code of Math Expression Parser from Dreamincode Forum. My question is, on that code I think everything is going all right, but when I had a testcase '(2(3+5)' , that was valid, whereas this test case is completely wrong but if I give the test case '(3+5)2)' it was detect as non valid input. Anyone knows why this is happening? //enum for Operator "objects" import java.util.*; public enum Operator { ADD("+", 1) { double doCalc(double d1, double d2) { return d1+d2; } }, SUBTRACT("-",1) { double doCalc(double d1, double d2) { return d1-d2; } }, MULTIPLY("*", 2) { double doCalc(double d1, double d2) { return d1*d2; } }, DIVIDE("/",2) { double doCalc(double d1, double d2) { return d1/d2; } }, STARTBRACE("(", 0) { double doCalc(double d1, double d2) { return 0; } }, ENDBRACE(")",0) { double doCalc(double d1, double d2) { return 0; } }, EXP("^", 3) { double doCalc(double d1, double d2) { return Math.pow(d1,d2); } }; private String operator; private int precedence; private Operator(String operator, int precedence) { this.operator = operator; this.precedence = precedence; } public int getPrecedenceLevel() { return precedence; } public String getSymbol() { return operator; } public static boolean isOperator(String s) { for(Operator op : Operator.values()) { //iterate through enum values if (op.getSymbol().equals(s)) return true; } return false; } public static Operator getOperator(String s) throws InvalidOperatorException { for(Operator op : Operator.values()) { //iterate through enum values if (op.getSymbol().equals(s)) return op; } throw new InvalidOperatorException(s + " Is not a valid operator!"); } public boolean isStartBrace() { return (operator.equals("(")); } //overriding calculation provided by each enum part abstract double doCalc(double d1, double d2); } //error to be thrown/caught in ProjectOne.java class InvalidOperatorException extends Exception { public InvalidOperatorException() { } public InvalidOperatorException(String s) { super(s); } } //reading…
has comment: http://stackoverflow.com/comment/31395354

http://stackoverflow.com/comment/31385256
type: Comment
type: QuestionComment
has text: see http://stackoverflow.com/questions/585534/what-is-the-best-way-to-find-the-users-home-directory-in-java and http://stackoverflow.com/questions/1198911/how-to-get-local-application-data-folder-in-java
comment on: http://stackoverflow.com/q/20907831
score: 0

http://stackoverflow.com/comment/43803396
type: Comment
has text: With respect, type erasure was a half-assed attempt to bring a feature to Java without breaking backwards compatibility. It's not a strength. If the major concern were that you might try to instantiate an object with no parameterless constructor, the right answer is to allow a constraint of "types with parameterless constructors", not to cripple a language feature.
score: 56
type: AnswerComment
comment on: http://stackoverflow.com/a/21843984

http://stackoverflow.com/comment/31361431
type: Comment
comment on: http://stackoverflow.com/q/20894885
has text: @ElliottFrisch: Or go full silly and use "horsey"
score: 1
type: QuestionComment

http://stackoverflow.com/q/20852254
possible better answer: http://stackoverflow.com/a/20852502
has body: I have been using Eclipse for 2 years for development, but this filter concept I am still struggling to understand during debugging. I usually debug in remote port mode. Most of the times, My Eclipse catches the break point/exception in Unwanted Packages [Packages usually from other Sources like Spring, Java ThreadPool etc..] and annoys me by bringing up the debug window. I would like to configure Eclipse to catch breakpoints in my package only. Just ignore any where else, don't halt them or notify me.
score: 5
has title: Eclipse Debugging Filter Unwanted Packages
type: AnsweredQuestion
tagged with: filtering
tagged with: java
has answer: http://stackoverflow.com/a/20852763
tagged with: eclipse
type: Question
linked to: http://stackoverflow.com/q/6290470
tagged with: debugging
answer count: 2
upvote count: 5
downvote count: 0
tagged with: breakpoints
accepted answer: http://stackoverflow.com/a/20852763
has answer: http://stackoverflow.com/a/20852502
favorite count: 0

http://stackoverflow.com/comment/31622918
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20914388
type: Comment
has text: Alright thanks so much, I have used the answer by MagicMan coz it seems shorter to me. Thankyou MagicMan.

http://stackoverflow.com/comment/31299484
type: AnswerComment
score: 0
has text: im getting the same length for the trim(), "\\s+" seems to work ill try it with replace()
type: Comment
comment on: http://stackoverflow.com/a/20862077

http://stackoverflow.com/a/21455396
accepted answer of: http://stackoverflow.com/q/20993264
has body: The Answer is No, the @Value annotation is not part of Internationalization. It's use in conjunction with Internationalization is an error and will break when you try to change the Local.
score: 1
answers question: http://stackoverflow.com/q/20993264
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/20901929
accepted answer of: http://stackoverflow.com/q/20901300
downvote count: 0
answers question: http://stackoverflow.com/q/20901300
has comment: http://stackoverflow.com/comment/31375657
has comment: http://stackoverflow.com/comment/31375920
score: 4
type: AcceptedAnswer
has body: It's not strange at all, the allocation is failing which is throwing an exception. By catching the exception you are saying that the program can continue, by not catching the exception you are saying that you can't handle it and the program exits. Inside your while loop you are doing: byte[] x = ref.get(); This is creating a new Strong reference from your Soft Reference. As soon as you do that it is no longer eligible for collection. You don't clear that Strong Reference before you go on to do the new allocation. Do x = null after you have done the test.
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/31374146

http://stackoverflow.com/comment/31380188
score: 0
type: Comment
type: AnswerComment
has text: This works, thank you. However it doesn't take into account the rest of the loop and sleeps only the time required for the method, and the rest of the loop is more important than this. Also, shouldn't it be `Thread.sleep(200-(time2-time1));`
comment on: http://stackoverflow.com/a/20903792

http://stackoverflow.com/comment/31593280
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/44881/discussion-between-sachin-grover-and-sujith-ps)
comment on: http://stackoverflow.com/q/21012485
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/20930096
upvote count: 3
downvote count: 1
tagged with: git
has title: Why can I not add .jar to eclipse git repo?
possible better answer: http://stackoverflow.com/a/20935688
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31428493
has answer: http://stackoverflow.com/a/20935688
has comment: http://stackoverflow.com/comment/31428545
has body: I am using Eclipse Kepler for Java. Normally you can add internal/external .jars to a Java project in the build path located in the properties. Why, when I clone a git repo and import it into my projects, do I lose that ability? I don't understand. I kinda need to do that.
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/31428344
type: Question
answer count: 3
has answer: http://stackoverflow.com/a/58169615
favorite count: 0
has answer: http://stackoverflow.com/a/20942333
accepted answer: http://stackoverflow.com/a/20942333
has comment: http://stackoverflow.com/comment/31428568
linked to: http://stackoverflow.com/q/8486403
has comment: http://stackoverflow.com/comment/31428524

http://stackoverflow.com/comment/31577980
comment on: http://stackoverflow.com/q/21009712
score: 0
type: Comment
type: QuestionComment
has text: @TwilightSun: it's good point. I also used it as my argument in debate.

http://stackoverflow.com/comment/31295248
comment on: http://stackoverflow.com/a/20860129
type: AnswerComment
score: 0
type: Comment
has text: how does 1 java exe know to talk to another java exe ?

http://stackoverflow.com/comment/31301168
type: AnswerComment
type: Comment
has text: Well, if you wanted something like that, you could write `String[] arr = {"20", "22", "24"}; for (String s: arr) { if (var.equals(s)) { yourCodeHere(); } }`, but a [mathematical operator](http://en.wikipedia.org/wiki/Operator_%28mathematics%29) doesn't work like our English where we make a bunch of things implicit.
comment on: http://stackoverflow.com/a/20862910
score: 0

http://stackoverflow.com/a/20942424
has comment: http://stackoverflow.com/comment/31487094
upvote count: 7
downvote count: 1
has comment: http://stackoverflow.com/comment/115292055
has body: To be clear by "duration" you mean the total time the music would play without looping. I don't think the Libgdx sound APIs expose this (the lowest common denominator sound API across desktop, Android and Web is pretty low ...). You may be able to get this information out of the files you're loading into system, though (e.g., if they're wav or mp3 files there should be APIs to query their duration).
answers question: http://stackoverflow.com/q/20941866
score: 6
type: Answer

oracle-agile-plm
type: Tag
tags question: http://stackoverflow.com/q/20881891
tag name: oracle-agile-plm

http://stackoverflow.com/comment/31329507
comment on: http://stackoverflow.com/a/20878084
score: 0
type: Comment
has text: Yeah I understand. But what about second question?
type: AnswerComment

http://stackoverflow.com/q/20888297
answer count: 1
has answer: http://stackoverflow.com/a/20958700
score: 0
tagged with: android
type: UnansweredQuestion
tagged with: java
has body: First off I'm new with Java so bear with me. I am working on modifying the master detail template to list 2 lines from a dummy content file (this will later pull from shared prefs) and am not quite sure how to pull this off. My Dummy Content class is this: package com.fasttracksites.skyrimjournal.data; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class JournalEntries { /** * An array of sample (dummy) items. */ public static List&lt;JournalEntry&gt; ITEMS = new ArrayList&lt;JournalEntry&gt;(); /** * A map of sample (dummy) items, by ID. */ public static Map&lt;String, JournalEntry&gt; ITEM_MAP = new HashMap&lt;String, JournalEntry&gt;(); static { // Add 3 sample items. addItem(new JournalEntry("1", "08-30-1995", "Item 1", "Item 1 Details")); addItem(new JournalEntry("2", "08-30-1998", "Item 2", "Item 2 Details")); addItem(new JournalEntry("3", "08-30-2013", "Item 3", "Item 3 Details")); } private static void addItem(JournalEntry item) { ITEMS.add(item); ITEM_MAP.put(item.mId, item); } /** * A dummy item representing a piece of content. */ public static class JournalEntry { public String mId; public String mDate; public String mTitle; public String mContent; public JournalEntry(String id, String date, String title, String content) { mId = id; mDate = date; mTitle = title; mContent = content; } @Override public String toString() { return mContent; } } } It is instantiated in EntryListActivity like so: protected static ArrayList&lt;JournalEntry&gt; mJournalEntries = new ArrayList&lt;JournalEntry&gt;(); This is then being attached to the List in EntryListFragment (which is where I'm having trouble at) like so: String[] keys = { JournalEntries.ITEMS } int[] ids = { android.R.id.text1, android.R.id.text2 }; SimpleAdapter adapter = new SimpleAdapter(getActivity(), EntryListActivity.mJournalEntries, android.R.layout.simple_list_item_activated_2, keys, ids); setListAdapter(adapter); How do I properly attach the Dum…
type: Question
has title: Using simple_list_item_activated_2 in Android App

http://stackoverflow.com/comment/31576272
type: Comment
comment on: http://stackoverflow.com/q/21008982
type: QuestionComment
has text: Show your JAR's [manifest](http://docs.oracle.com/javase/tutorial/deployment/jar/manifestindex.html).
score: 1

http://stackoverflow.com/q/20968248
score: 0
tagged with: java
has title: File Reading in Java, with same file readers
type: Question
has comment: http://stackoverflow.com/comment/31499890
linked to: http://stackoverflow.com/q/18002896
tagged with: file-io
answer count: 3
has comment: http://stackoverflow.com/comment/31500122
type: UnansweredQuestion
has body: I have two files to be read using same variables for the task with the following code: try { FileInputStream fis = new FileInputStream(filename1); InputStreamReader isr = new InputStreamReader(fis, "UTF8"); BufferedReader br = new BufferedReader(isr); String line=""; while((line=br.readLine())!=null){ System.out.println(line); } // Do i need to add these 3 statements ... //br.close(); //isr.close(); //fis.close(); //Without the above 3 statements also the code works fine ... fis = new FileInputStream(filename2); isr = new InputStreamReader(fis, "UTF8"); br = new BufferedReader(isr); line=""; while((line=br.readLine())!=null){ System.out.println(line); } br.close(); isr.close(); fis.close(); } catch (Exception e) { e.printStackTrace(); } The filereading in java doesn't bother about closing the opened stream and releasing any system resources associated with it for the first file filename1? No exceptions thrown.
has comment: http://stackoverflow.com/comment/31499949
has answer: http://stackoverflow.com/a/20968394
tagged with: resource-leak
has answer: http://stackoverflow.com/a/20968371
tagged with: performance
has answer: http://stackoverflow.com/a/20968374

http://stackoverflow.com/comment/31429613
comment on: http://stackoverflow.com/q/20931001
score: 0
has text: Not working consistently or not at all? What are your input files? What does "not working" mean exactly?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20898619
has comment: http://stackoverflow.com/comment/31367722
has answer: http://stackoverflow.com/a/20898906
has comment: http://stackoverflow.com/comment/31367875
upvote count: 3
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/31367981
type: Question
accepted answer: http://stackoverflow.com/a/20898906
answer count: 2
has comment: http://stackoverflow.com/comment/31367755
has comment: http://stackoverflow.com/comment/31367786
has comment: http://stackoverflow.com/comment/31368058
has comment: http://stackoverflow.com/comment/31367826
has answer: http://stackoverflow.com/a/20898968
has comment: http://stackoverflow.com/comment/31367663
tagged with: jcombobox
favorite count: 0
tagged with: jframe
possible better answer: http://stackoverflow.com/a/20898968
has comment: http://stackoverflow.com/comment/31367736
has comment: http://stackoverflow.com/comment/31367907
has comment: http://stackoverflow.com/comment/31367708
has body: Hello and i am using one Combobox and when i triggered IteamStateChage event then that action called twice. but if i called twice i can not make make it possible what i want to do. So is there any way to called IteamStatechange evet only once. when i change iteam into the Jcombobox. i just need once action of itemStatechange. and using Item State change only.![Here Screen Shot for same.][1] please help me for same. and thank you for you ans in advance.
tagged with: swing
has comment: http://stackoverflow.com/comment/31368170
score: 2
type: AnsweredQuestion
has title: ItemStateChanged called twice into JComboBox

http://stackoverflow.com/q/20887572
has comment: http://stackoverflow.com/comment/31346734
type: Question
has answer: http://stackoverflow.com/a/20887720
tagged with: rot13
has answer: http://stackoverflow.com/a/20887674
downvote count: 0
answer count: 6
upvote count: 1
has comment: http://stackoverflow.com/comment/31347796
has comment: http://stackoverflow.com/comment/31347129
has comment: http://stackoverflow.com/comment/31346822
possible better answer: http://stackoverflow.com/a/20887602
has answer: http://stackoverflow.com/a/20889208
favorite count: 0
tagged with: encryption
has answer: http://stackoverflow.com/a/20887636
has answer: http://stackoverflow.com/a/20887602
has answer: http://stackoverflow.com/a/57310802
has body: I tried to implement Rot13 and to make it as minimal as possible, this are my results so far: if ( (c &gt;= 'A') &amp;&amp; (c &lt;= 'Z') ) c=((c-'A'+13)%26)+'A'; if ( (c &gt;= 'a') &amp;&amp; (c &lt;= 'z') ) c=((c-'a'+13)%26)+'a'; return c; I showed this to my Prof and he said it would be possible in two lines. I don't know how i could shrink this code further and not generating wrong output. Thanks for your help EDIT: if nothing changed (outer range ascii) it should only return c. Maybe the solution is the second answer + return line c in case nothing returned.
has title: Rot 13 Minimal Version Java
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/20887674

http://stackoverflow.com/comment/31569864
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21001657
has text: @JBNizet - Tnx. But shouldn't JPA automatically remove or add to the association table based on the new list? I would think by just `project.clientEmployees = new ArrayList<>();` and saving project, all the associations should be deleted. I do that for my other @OneToMany relations and it works...I was thinking it might be that the association table has two foreign keys so does not auto do it?

http://stackoverflow.com/comment/31347067
has text: You can't execute code in the body of a class. You'll need to do it in a method, in a constructor, or in an instance initializer block.
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/20887721

http://stackoverflow.com/a/20963645
has comment: http://stackoverflow.com/comment/31536439
accepted answer of: http://stackoverflow.com/q/20963575
score: 20
has body: Compile this little program (I realized I should have used your example, but it makes no difference) public static void main(String[] args) { try { Float s = Float.parseFloat("0.0327f"); } finally { System.out.println("hello"); } } I used &gt;java -version java version "1.8.0-ea" // should be same for 7 Java(TM) SE Runtime Environment (build 1.8.0-ea-b118) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b60, mixed mode) And then execute javac -v -c &lt;fully qualified class name&gt; to get the bytecode. You will see something like public static void main(java.lang.String[]); flags: ACC_PUBLIC, ACC_STATIC Code: stack=2, locals=3, args_size=1 0: ldc #2 // String 0.0327f 2: invokestatic #3 // Method java/lang/Float.parseFloat:(Ljava/lang/String;)F 5: invokestatic #4 // Method java/lang/Float.valueOf:(F)Ljava/lang/Float; 8: astore_1 9: getstatic #5 // Field java/lang/System.out:Ljava/io/PrintStream; 12: ldc #6 // String hello 14: invokevirtual #7 // Method java/io/PrintStream.println:(Ljava/lang/String;)V 17: goto 31 20: astore_2 21: getstatic #5 // Field java/lang/System.out:Ljava/io/PrintStream; 24: ldc #6 // String hello 26: invokevirtual #7 // Method java/io/PrintStream.println:(Ljava/lang/String;)V 29: aload_2 30: athrow 31: return Exception table: from to target type 0 9 20 any 20 21 20 any LineNumberTable: line 10: 0 line 12: 9 line 13: 17 line 12: 20 line 14: 31 StackMapTable: number_of_entries = 2 frame_type = 84 /* same_locals_1_stack_item */ stack = [ class java/lang/Throwable ] frame_type = 10 /* same */ You'll notice the code inside the finally appears twice, once before the goto and once after. You'll also notice the Exception table which specifies which statement to go to if an exception occurs at some line. So if any exception happens between statement 0-9, go to line 20 and execute the everything inside the finally, after the goto. If no exception occurs, execute the finally and then execute the goto skipping the finally after the goto. In all cases you w…
has comment: http://stackoverflow.com/comment/43937586
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43945386
has comment: http://stackoverflow.com/comment/43941804
answers question: http://stackoverflow.com/q/20963575
type: Answer
has comment: http://stackoverflow.com/comment/43936836
has comment: http://stackoverflow.com/comment/31536422
upvote count: 20

http://stackoverflow.com/q/20872489
has comment: http://stackoverflow.com/comment/31319409
score: 0
tagged with: radix-sort
has answer: http://stackoverflow.com/a/20872534
answer count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31319601
upvote count: 1
tagged with: java
has body: i was wondering, when i have a list of integers and i need to sort them, and i know that they are integers in 32 bit, can i use radix sort (with counting sort as its stable sort) to sort them in o(n) time? isn't it just 32 counting sorts using the bits representation on the numbers starting from LSB? i know that general sorts with no previous knowledge of the numbers take o(nlogn), but isnt the fact that they are 32 bit integers is all i need to make it an o(n) sort? thanks!
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31319475
has comment: http://stackoverflow.com/comment/31319413
has title: using radix sort on 32bit numbers

http://stackoverflow.com/comment/31520801
comment on: http://stackoverflow.com/a/20979386
type: AnswerComment
has text: don't forget to also note that the hashCode method should be overridden as well.
score: 5
type: Comment

http://stackoverflow.com/comment/31579694
type: AnswerComment
has text: @steven_110791 no, `remoteUser` returns null only if browser did not fill this field, it is browser's action rather than a bug.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21010541

http://stackoverflow.com/a/20852873
downvote count: 0
answers question: http://stackoverflow.com/q/20852837
upvote count: 2
type: Answer
has body: Downloading the large images for each image and then down sampling is going to be very inefficient. First the download size is larger than needed. Second you need to load it into memory to perform the down sample and third down sampling is somewhat slow. You can use web api which return you a list of thumbnail urls and full image urls that you can lazy download as the view comes on screen and use the cache to keep them around a while. Make sure you down sample the sizes of the thumbnails as well. I would then when the user clicks on an image go download the full image and on the background when it arrives down sample it before displaying it. You need to implement the LazyLoading is the best way to download the image from url asynchronously. Check out the tutorial You need read the documentation before proceeding to working with images.
score: 2

http://stackoverflow.com/comment/31417908
has text: I decided not to do an inner class of activity because I need 3 or more AsynkTask. In the question it's passed the result to an interface, but I would send this data to a Graph class, because I'll also send Edges and the class will be quite big. How can I send it to the other class from the interface?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20924865
type: Comment

http://stackoverflow.com/q/20914224
upvote count: 1
has comment: http://stackoverflow.com/comment/31398148
type: Question
score: 1
tagged with: java
has title: Comparing the strings in two different arraylists
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31397984
has comment: http://stackoverflow.com/comment/31398289
has comment: http://stackoverflow.com/comment/31398810
favorite count: 0
has comment: http://stackoverflow.com/comment/31397983
tagged with: arraylist
type: UnansweredQuestion
has body: As I'm teaching myself Java, I've been programming a Battleship like game, but I've run into a problem with my method for making sure that when I create a new ship I don't add it unless all of its location values are unique. I'm doing something wrong, because my method isn't working and I'm getting duplicate values (or ships that have the same location). I have two ArrayLists: The first list is an ArrayList of the Ship objects (a field on my game controller class) The second list is an ArrayList of the Locations in the form of a String (e.g. A5, B17, etc.) (this is a field on my Ship object) My method for checking to see if a ship I'm about to add to the ArrayList of Ship objects has unique locations is as follows: private boolean hasUniqueLocs(Ship ship) { for (Ship x : theShips) { for (String y : ship.shipLocation) { System.out.println("Checking to see if " + x.shipLocation + " ship contains this value: " + y); if (x.shipLocation.contains(y)) { return false; } } } return true; } So "theShips" is my ArrayList of Ships field on the GameController (with my Main method). And "shipLocation" is my ArrayList field on the Ship object that holds the locations. My println() statement never runs, so for some reason I'm never getting the for loops going? Thank you for any guidance or insight you can provide here!
has answer: http://stackoverflow.com/a/20914629
has comment: http://stackoverflow.com/comment/31398020

http://stackoverflow.com/comment/31290227
type: QuestionComment
comment on: http://stackoverflow.com/q/20857635
score: 1
has text: `StringIndexOutOfBoundsException: length=8; regionStart=1; regionLength=29`
type: Comment

http://stackoverflow.com/comment/31417984
score: 0
comment on: http://stackoverflow.com/a/20924865
type: AnswerComment
has text: but I can use them just on the method of the interface, or I'm wrong?
type: Comment

http://stackoverflow.com/comment/32117290
score: 0
type: Comment
type: QuestionComment
has text: For anyone else looking `getWorlds()[0]` will usually return your default world, though `Bukkit.getWorld(worldName)` is preferable. Alternatively, get the world from a player instance using `player.getWorld()` if you know the player is in that world.
comment on: http://stackoverflow.com/q/20961279

http://stackoverflow.com/comment/31494741
score: 0
comment on: http://stackoverflow.com/a/20965333
type: Comment
has text: Thanks for quick reply. Yes i have added the same namespace. I am trying to add the code but there is a problem with formatting.
type: AnswerComment

http://stackoverflow.com/a/20923959
type: Answer
has body: How about something like this: for each element in list A add element to list nonDup Its basically just plain text which can be read by anyone. You could choose more speaking names for the variables. You could also choose begin loop and end loop to show the scope of the loop instead of indentication.
answers question: http://stackoverflow.com/q/20923806
score: 3
upvote count: 3
downvote count: 0

http://stackoverflow.com/comment/31441634
comment on: http://stackoverflow.com/q/20937169
type: Comment
has text: Do you have some sample backend response?
type: QuestionComment
score: 0

http://stackoverflow.com/q/20940881
answer count: 2
favorite count: 0
upvote count: 3
tagged with: spring-mvc
possible better answer: http://stackoverflow.com/a/24526776
has title: Problems with including Bootstrap to SpringMVC project via WebJars
downvote count: 0
tagged with: twitter-bootstrap
has answer: http://stackoverflow.com/a/20940991
accepted answer: http://stackoverflow.com/a/20940991
tagged with: maven
type: AnsweredQuestion
score: 3
tagged with: java
tagged with: eclipse
has body: I've tried to use Bootstrap in my SpringMVC project: link to GitHub repo Unfortunately, CSS files are not visible. The browser is throwing errors in the console like this: GET http://localhost:8080/finager/webjars/jquery/2.0.3/jquery.js 404 (Not Found) I think pom.xml has proper configuration, because I am able to view included WebJars (Bootstrap and JQuery) in Eclipse under Java Resources -> Libraries -> Maven Dependencies. I've also set path in servlet-context.xml like this (last line): &lt;!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory --&gt; &lt;resources mapping="/resources/**" location="/resources/" /&gt; &lt;resources mapping="/webjars/**" location="/META-INF/resources/webjars/"/&gt; I think this line is correct, because Tomcat no longer says that it don't know how to handle request starting with '/webjars/. All tutorials that I've found lists only these steps, and I couldn't find any useful information on the Internet. I've spent whole day on this, as I am new to Spring development , so any help would be hugely appreciated. Thanks in advance!
type: Question
has answer: http://stackoverflow.com/a/24526776

http://stackoverflow.com/comment/31429145
score: 0
comment on: http://stackoverflow.com/q/20930400
type: Comment
type: QuestionComment
has text: i am sending emails. question is posted here an i will only answer here. You can check the snap shot also. Only other changes is the xml and the view ids for my conveinience which you can change appropriately

http://stackoverflow.com/comment/31368983
type: AnswerComment
score: 1
type: Comment
comment on: http://stackoverflow.com/a/20899394
has text: It depends on the underlying algorithm. They usually use simple operation (bitwise shifts, additions multiplications etc.) over fixed size chunks of the original data.

http://stackoverflow.com/a/21003860
downvote count: 0
answers question: http://stackoverflow.com/q/21003803
type: Answer
upvote count: 1
score: 1
has body: Your KeyEvent variable is "e" not "event". You have the wrong variable name.

http://stackoverflow.com/a/20895785
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20895753
downvote count: 0
answers question: http://stackoverflow.com/q/20895753
type: Answer
has comment: http://stackoverflow.com/comment/31362929
has body: You don't seem to instatiate solver anywhere so it's null in onClick(). Instantiate it somewhere before, for example in onCreate() or where you declare it: Solver solver = new Solver();
upvote count: 2
score: 2

http://stackoverflow.com/a/22692387
answers question: http://stackoverflow.com/q/20950228
score: 8
downvote count: 0
upvote count: 8
has body: I had a similar issue - for clarity, you need the following lines at the top of your sketch: import java.io.BufferedWriter; import java.io.FileWriter;
type: Answer

http://stackoverflow.com/comment/31295907
comment on: http://stackoverflow.com/q/20860490
type: Comment
type: QuestionComment
has text: No, but school extra programming assignment. I just need some help in ways to approach this problem.
score: 0

http://stackoverflow.com/comment/31461854
score: 0
type: AnswerComment
has text: And secondly by stating "Simply you cannot do that." , what are you trying to say -"You cannot invoke Servlet from a POJO" ???
type: Comment
comment on: http://stackoverflow.com/a/20948283

http://stackoverflow.com/a/66948559
type: Answer
answers question: http://stackoverflow.com/q/20922958
has body: Use providedRuntime in Gradle to move the tomcat jars to WEB-INF/lib-provided folder as recommended in Gradle documentation dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat' }
score: 0

http://stackoverflow.com/q/20885830
possible better answer: http://stackoverflow.com/a/20885908
tagged with: cross-platform
linked to: http://stackoverflow.com/q/11113974
tagged with: persistence
has comment: http://stackoverflow.com/comment/31343430
has answer: http://stackoverflow.com/a/20885974
type: AnsweredQuestion
score: 3
downvote count: 0
has body: Is there a platform-independent way to get a path to store program data in Java? This is surely a very basic question but I can't seem to find the answer anywhere. I am looking for a path to store user data such as user preferences or historical data input. On Windows we would normally store it in C:\Program Files\APPNAME, C:\Program Files (x86)\APPNAME or C:\ProgramData\APPNAME depending on the OS and architecture. On Unix we could store preferences in /etc/APPNAME or /opt/APPNAME depending on the context. On Mac we have a special cabinet to store program's data. In java, how do we get a location like this in a platform-independent way?
favorite count: 0
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/20885908
accepted answer: http://stackoverflow.com/a/20885974
has title: Platform-independent way to get a path to store program data
upvote count: 3
tagged with: java

http://stackoverflow.com/comment/31579771
type: AnswerComment
has text: Well its a straightforward concept.and there is always a first time. The reason you should use stringbuffer is because you are going to create objects unnecessarily in the heap since every string concat operation is creating a new object and it isnt a good practice to do so. http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/StringBuffer.html
type: Comment
comment on: http://stackoverflow.com/a/21011084
score: 0

http://stackoverflow.com/q/20972328
type: Question
tagged with: jpa
score: 0
accepted answer: http://stackoverflow.com/a/20972483
has title: Hibernate list mapping
answer count: 1
type: AnsweredQuestion
tagged with: mapping
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/20972483
has body: I am trying to map entities so I'll have following or similar effect (preferably without OrderItem.quantity) : Here is my entity : public class Orders implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @ManyToOne private UserCreds user; @OneToMany private List&lt;Item&gt; orderedItems; I end up with OrdersItem join table mapped with just 2 columns : item_id and order_id, both are keys thus it wont let me persist order with repeating items. Adding id column for OrderItems should do the trick: OrdersItem table that I except: | ID | ORDER_ID | ITEM_ID 1 25 31 2 25 31 3 25 12 4 25 12 5 25 62 etc.. But I just couldnt get that working, or maybe my solution is completely wrong?

http://stackoverflow.com/comment/31309167
has text: http://stackoverflow.com/questions/11155392/spring-mvc-error-with-form-tag-and-command might help
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20867349

http://stackoverflow.com/comment/31346288
type: Comment
score: 0
type: AnswerComment
has text: Thanks. You are ready not all item.getPaymentDate() contains date, some can be null.
comment on: http://stackoverflow.com/a/20887088

http://stackoverflow.com/comment/31356402
score: 0
has text: @svenoaks In the OtherList class when I change tabs or change activities
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20892118

http://stackoverflow.com/a/30743196
type: Answer
has body: Add it in your web application (dispatcher-servlet.xml). Check this example if you need. switch user link
answers question: http://stackoverflow.com/q/20998284
score: 0
has comment: http://stackoverflow.com/comment/49542277

http://stackoverflow.com/a/71608369
has body: In my case, the error was due to some dependencies using log4j v 1.x that I removed from the classpath. So I introduced the log4j-1.2-api to bridge v 1.x to 2.x as recommended in the Apache Migration guide: After introducing this dependency in my build.gradle, the error disappeared : implementation 'org.apache.logging.log4j:log4j-1.2-api:2.17.+!!'
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20909446
score: 1
upvote count: 1

http://stackoverflow.com/q/20879124
has comment: http://stackoverflow.com/comment/31331687
tagged with: javascript
has comment: http://stackoverflow.com/comment/31331589
tagged with: http://stackoverflow.com/tag/c
has body: I have a series of points, which represent mobile devices within a room. Previously I have systematically emitted a ping from each and recorded the time at which it arrives at the others to calculate the distances. Here's a simple diagram of an example network. The bottom A node should have been a D instead After recording the distances I have the distance information in hashes. A = {B: 2, C: 1, D: 3} B = {A: 2, C: 2, D: 2} C = {A: 1, B: 2, D: 2} D = {A: 3, B: 2, C: 2} My maths is rusty, but I feel like I should be able to then draw circles using these values as the respective and then intersect the circles to calculate a relative graph of the nodes. Every time I try to do it I start out with a series of circles drawn around the root node (in this case A) that looks something like this: I know that the other nodes must lie on the lines that I have drawn around A, but without being able to position them, how do you draw their distances so that you may intersect the circles and create the graph?
has comment: http://stackoverflow.com/comment/31332178
has comment: http://stackoverflow.com/comment/31331557
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31331718
has comment: http://stackoverflow.com/comment/31333789
has comment: http://stackoverflow.com/comment/31331554
favorite count: 0
has comment: http://stackoverflow.com/comment/31332005
has comment: http://stackoverflow.com/comment/31331508
has comment: http://stackoverflow.com/comment/31331533
score: 8
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31332060
has comment: http://stackoverflow.com/comment/31331419
has answer: http://stackoverflow.com/a/20879563
has title: Positioning Devices (Intersecting Circles)
tagged with: java
accepted answer: http://stackoverflow.com/a/20879563
upvote count: 8
type: Question
has comment: http://stackoverflow.com/comment/31331469
tagged with: algorithm
has comment: http://stackoverflow.com/comment/31331753
tagged with: math

http://stackoverflow.com/comment/31367196
has text: Hi, I'm using httpClient 3.1. I don't think it's an httpClient issue. Because I tried both httpClient 3.x and 4.x. And the result is same. So I suspect if jetty did something on the parameter names.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20897294

http://stackoverflow.com/a/20945526
has comment: http://stackoverflow.com/comment/31503575
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31562617
type: Answer
accepted answer of: http://stackoverflow.com/q/20945447
answers question: http://stackoverflow.com/q/20945447
has body: I don't think there's anything built-in for that. You'd have to use the custom method support to roll your own: http://docs.spring.io/spring-data/jpa/docs/1.4.3.RELEASE/reference/html/repositories.html#repositories.custom-implementations
score: 0

http://stackoverflow.com/comment/31592041
comment on: http://stackoverflow.com/a/21017512
score: 0
type: AnswerComment
has text: Edited the answer. Code included !
type: Comment

http://stackoverflow.com/comment/31452646
comment on: http://stackoverflow.com/q/20942754
score: 0
type: Comment
type: QuestionComment
has text: What comes after those logs? It seems like it's updating the rest of the `Activity` fields.

http://stackoverflow.com/comment/31484016
type: Comment
comment on: http://stackoverflow.com/q/20959345
score: 0
type: QuestionComment
has text: @mserioli yes! All dependencies added.

http://stackoverflow.com/a/77467980
has body: I spent some hours with a "no route to host" - exception. Then I realised I started the application with -Djava.net.preferIPv6Addresses=true but the system wasn't configured for IP v6.
score: 0
answers question: http://stackoverflow.com/q/20983060
type: Answer

deployment
tags question: http://stackoverflow.com/q/20924833
tags question: http://stackoverflow.com/q/20995502
tag name: deployment
tags question: http://stackoverflow.com/q/21009610
tags question: http://stackoverflow.com/q/20968071
tags question: http://stackoverflow.com/q/20895400
type: Tag
tags question: http://stackoverflow.com/q/20976018
tags question: http://stackoverflow.com/q/21017357

http://stackoverflow.com/comment/31496922
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20966666
has text: post full exception log

http://stackoverflow.com/q/20887366
type: Question
answer count: 2
favorite count: 0
has answer: http://stackoverflow.com/a/20887378
possible better answer: http://stackoverflow.com/a/29103158
tagged with: jdbc
tagged with: spring
score: 6
tagged with: maven
upvote count: 7
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/29103158
tagged with: java
tagged with: hibernate
has body: I have created a program (SPRING+HIBERNATE) through Maven two weeks ago and now it is having a problem with loading JDBC driver (which wasn't occur until now). So, my pom.xml file looks like this: 4.0.0 com.spring.hib HibPav 1.0-SNAPSHOT org.springframework spring 2.5.6 mysql mysql-connector-java 5.1.27 org.springframework spring-hibernate3 2.0.5 dom4j dom4j 1.6.1 javax.transaction jta 1.1 org.springframework spring-jdbc 3.2.5.RELEASE org.hibernate hibernate-core 4.2.7.Final It seems that this file is clear. But what is the main problem that JDBC driver cannot be loaded while I am trying to create a dataSource bean. Other files: datasource file <?xml version="1.0" encoding="UTF-8"?> properties/database.properties properties file jdbc.driverClassName=com.mysql.jdbc.Driver; jdbc.url=jdbc:mysql://localhost/mydb jdbc.username=myinfuser jdbc.password=myinfuserpw Error: Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [spring/database/datasource.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [com.mysql.jdbc.Driver;] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1279) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java…
has title: JDBC driver cannot be loaded. Why? (Spring,Hibernate)
accepted answer: http://stackoverflow.com/a/20887378

http://stackoverflow.com/comment/31559645
comment on: http://stackoverflow.com/a/21000456
score: 0
type: AnswerComment
has text: @serega6531: Please let us explain again, you don't understand that by using inheritance, you **are** creating another instance of the variables. 1+ to this answer.
type: Comment

http://stackoverflow.com/q/20921763
tagged with: java
downvote count: 2
upvote count: 1
type: Question
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/218384
has title: How to avoid null properties?
score: -1
has answer: http://stackoverflow.com/a/20921787
tagged with: eclipse
has comment: http://stackoverflow.com/comment/31411859
has body: I am working on an exercise where i build a bank system, I created an account class, a client class and a bank class, however when I check the program I get: Exception in thread "main" java.lang.NullPointerException. Here are my classes: package bank.elements; public class Account { private int id; private float balance; //constructors public Account(int id, float balance){ this.setId(id); this.setBalance(balance); } public Account (int id){ this.id=id; this.setBalance(0); } //getters public int getId(){ return this.id; } public float getBalance(){ return this.balance; } //setters public void setBalance(float balance){ this.balance+=balance; } public void setId(int id){ this.id=id; } } package bank.elements; public class Client { private int id; private String name; private String rank; private float balance; private Account[] accounts = new Account[100]; public Client(){ } //getters public int getId(){ return id; } public String getName(){ return name; } public String getRank(){ return rank; } public float getBalance(){ return balance; } public float getAccountBalance(int id){ float balance = 0; for (int i = 0; i &lt; accounts.length; i++) { if(accounts[i].getId()==id){ balance = accounts[i].getBalance(); } } return balance; } public float getFortune(){ float sum = 0; for (int i = 0; i &lt; accounts.length; i++) { sum+=getAccountBalance(i); } sum+=getBalance(); return sum; } //setters public void setName(String name){ this.name = name; } public void setBalance(float balance){ this.balance+=balance; } public void setId(int id){ this.id=id; } public void addAccount(int id){ for (int i = 0; i &lt; accounts.length; i++) { if(accounts[i]==null){ accounts[i].setId(id); } } } } package bank.elements; public class Bank { public Bank(){ } public Client[] clients = new Client[100]; public float getBalance(){ float sum = 0; for (int i = 0; i &lt; clients.length; i++) { sum+= clients[i].getFortune(); } return sum; } public void addClient(){ for (int i = 0; i &lt; clients.lengt…
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31411622
linked to: http://stackoverflow.com/q/4660142
accepted answer: http://stackoverflow.com/a/20921787
has comment: http://stackoverflow.com/comment/31411491

http://stackoverflow.com/comment/31542170
has text: since this date format is necessary and should not be changed
score: 0
comment on: http://stackoverflow.com/q/20991172
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31542082
comment on: http://stackoverflow.com/q/20991113
has text: if the poll doesn't have to update the dialog on the page, place the dialog outside the update container
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20872244
score: 1
has comment: http://stackoverflow.com/comment/31326718
upvote count: 1
accepted answer of: http://stackoverflow.com/q/20871734
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20871734
type: Answer
has body: hard to be sure without real user pass, but I do see that there are other parameters in the form on the page, these are the post parameters copied from firebug: __EVENTVALIDATION=/wEWAwKN6cKWAwLyj/OQAgKXtYSMCscHt6cC4FDeXTt5x3mYsdjD8St4 __VIEWSTATE=/wEPDwULLTE4ODE4ODcyMjBkZOuwb1/ExHPAeKuIx34zh6mjfI29 tbPassWord=pass tbUserName=user you'll have to first get the page, then parse for __EVENTVALIDATION and __VIEWSTATE to find their generated values and only then add them to the POST data. EDIT: also note a small typo, change "tbPassword" to "tbPassWord"
has comment: http://stackoverflow.com/comment/31349168

http://stackoverflow.com/comment/31366125
has text: also Op need to look into the array index
score: 1
comment on: http://stackoverflow.com/a/20897694
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31416405
type: Comment
comment on: http://stackoverflow.com/a/20914324
score: 0
type: AnswerComment
has text: @RichardTingle Ok so I can come up with two decent strategies. One is to prefix each "Apple" with a semi-unique magic byte sequence. When the deserialization fails, read byte by byte until you hit the magic bytes. This should mean that you are at the next apple. But it's not guaranteed, so you might get false positives and handle those. The more correct version is to prefix each apple with size, and to do mark() before reading an apple, and reset() and skip the bad apple after deserialization failure. This requires access to the underlying stream, which can be done in various hackish ways.

http://stackoverflow.com/a/20899840
type: Answer
has body: Change your main method with below code public static void main(String arg[]) { List&lt;StudInfo&gt; students = new ArrayList&lt;StudInfo&gt;(); int maxs,nos; Scanner ip1=new Scanner(System.in); System.out.print("\nEnter No. of Students : "); nos=ip1.nextInt(); for(maxs=1;maxs&lt;=nos;maxs++) { System.out.println("\nWelcome to Student database"); System.out.print("\n Enter Student [ "+maxs+" ] details"); StudInfo s = new StudInfo(); s.getdata(); students.add(s); } for (StudInfo s : students) { s.display(); } } This will print all the student list. In your code you are just storing the last student details in the s reference. This will store all the StudInfo details in the students list
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/20898347
downvote count: 0

http://stackoverflow.com/a/21021494
accepted answer of: http://stackoverflow.com/q/21016157
has comment: http://stackoverflow.com/comment/43906054
upvote count: 14
has body: Fixed. It was problem with spring test db unit library. Some description of problem here https://github.com/springtestdbunit/spring-test-dbunit/issues/46 - current version visible in maven repos 1.0.1 is not working with spring 4. So I needed to clone repo and build version 1.1.0-SNAPSHOT.
answers question: http://stackoverflow.com/q/21016157
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 14

http://stackoverflow.com/q/20915121
has answer: http://stackoverflow.com/a/20915256
accepted answer: http://stackoverflow.com/a/20915256
favorite count: 0
tagged with: google-app-engine
tagged with: android
possible better answer: http://stackoverflow.com/a/21126696
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21126696
downvote count: 0
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/20749908
tagged with: authentication
has title: Self made authentication on Android with App Engine Endpoints and Java
type: Question
has body: I implemented Endpoints with Oauth2, and I am not happy with it. I look at some random game from Storm8, and they don't require the user to log in, and asks almost no permissions. Then I look at my game and I see lots of potentially dangerous permissions, and even that is not enough: in game it asks me to "know who you are on google". And I am not a big company, just a small developer, so people will wonder if I am not trying to hack them. And all I need is to know the user ID, and to know that this is really the user from the request. I think it is unacceptable. I decided I will not use the authentication promoted by Google, and use my own instead: I'll give unique ID to user, and random password, and allow to change them (or not, if they do not log in from different devices). I'll store login / pass in shared preferences and send them in every request. So I have following questions that are very essential for me and I'll be very grateful for answers or hints: 1) Is there any strong reason not to go this way? I will be able to greatly reduce amount of permissions, and improve user experience. 2) I belive all the communication between android application and endpoint is via HTTPS by default, am I right?
answer count: 2
upvote count: 1

http://stackoverflow.com/a/21030967
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21014407
upvote count: 1
has body: I assume you're trying to create a mapping of countryIds to countryNames, correct? This can be done in Gson, but really isn't what it is designed for. Gson is primarily intended translate JSON into equivalent Java objects (e.g. an array into a List, an object into an Object or a Map, etc.) and not for transforming arbitrary JSON into arbitrary Java. If it's possible, the best thing for you to do would be to refactor your JSON. Consider the following format: { "1": "India", "2": "United State" } It's less verbose, easier to read, and most notably, easy to parse with Gson: Type countryMapType = new TypeToken&lt;Map&lt;Integer,String&gt;&gt;(){}.getType(); Map&lt;Integer,String&gt; countryMap = gson.fromJson(sb.toString(), countryMapType); If you cannot edit your JSON syntax, you'll have to manually parse the JSON data into the structure you're trying to create, which will be somewhat tedious and involved. Best to read up on the Gson User Guide to learn how. As an aside, you call your Map&lt;String, String&gt; object listOfCountry, which is a confusing name - is it a map or a list? Avoid using names like "list" for objects that aren't lists. In this case I would suggest either countries or countryMap.
type: Answer

http://stackoverflow.com/comment/31334609
score: 0
comment on: http://stackoverflow.com/q/20880711
type: Comment
type: QuestionComment
has text: possible duplicate of [How to see the input and output in storm](http://stackoverflow.com/questions/20877656/how-to-see-the-input-and-output-in-storm)

http://stackoverflow.com/comment/31299121
has text: Agreed with @JeffGohlke but it does look like an enum would make more sense here.
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20861984

semaphore
type: Tag
tags question: http://stackoverflow.com/q/21007680
tag name: semaphore

http://stackoverflow.com/comment/31580941
type: AnswerComment
has text: you can also create custom view for this if you want to define image view.
score: 0
comment on: http://stackoverflow.com/a/20987778
type: Comment

http://stackoverflow.com/comment/31532313
has text: Thanks again for the essential hints that actually led to a working solution.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20961911
type: Comment

http://stackoverflow.com/q/20998371
has body: I have some problems with my code. For some reason my thread.start() doesn't activate my run() method. In pure desperation I have simply replaced my code in run() with a printing function, but nothing is being printed. Can someone help me by explaining what is wrong in my code? public class Screen extends JPanel implements Runnable{ Thread thread = new Thread(); Frame frame; public Screen(Frame frame){ this.frame = frame; frame.setSize(horizontal * 25 + 24 , (vertical) * 25 + 48); this.frame.addKeyListener(new KeyHandler(this)); thread.start(); } public void run(){ System.out.println("Boom"); } } I got a lot of stuff in between and under this code, but this is the only part essential to the thread and frame.
accepted answer: http://stackoverflow.com/a/20998407
has title: Thread.start() doesn't initialize run()
answer count: 5
has comment: http://stackoverflow.com/comment/31555229
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20998421
has answer: http://stackoverflow.com/a/20998441
possible better answer: http://stackoverflow.com/a/20998421
tagged with: multithreading
tagged with: swing
has answer: http://stackoverflow.com/a/20998642
has comment: http://stackoverflow.com/comment/31555085
has comment: http://stackoverflow.com/comment/31555204
has answer: http://stackoverflow.com/a/20998407
linked to: http://stackoverflow.com/q/3404301
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/20998455

http://stackoverflow.com/comment/31317058
score: 0
type: AnswerComment
type: Comment
has text: Since you are using php here is a starting point http://php.net/manual/en/mysqli.ssl-set.php
comment on: http://stackoverflow.com/a/20871338

http://stackoverflow.com/a/20970092
answers question: http://stackoverflow.com/q/20969292
downvote count: 0
has body: A middle ground would be to create normal as a thread local, perhap's by using Twitter's Local implementation. This would help if the normal.sample method was particularly expensive. You can also be certain that no two parallel operations will be running on the same thread at the same time :)
type: Answer
upvote count: 2
score: 2

http://stackoverflow.com/a/21002722
has body: Remove the @Test annotations. They are causing to run all test cases.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21000822

http://stackoverflow.com/comment/31593521
has text: @Clockwork-Muse. I'm 95% convinced that your answer is the right one. Difficult to prove of course. If you put as an answer I'll accept it as such. I wish (Simple)DateFormat was immutable ... but Christmas is over for now. :-(
comment on: http://stackoverflow.com/q/21017502
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/31481948
type: Comment
comment on: http://stackoverflow.com/a/20958482
score: 0
type: AnswerComment
has text: also, i hadn't had much experience with threading in general, so the doc didn't _particularly_ help

http://stackoverflow.com/comment/31506965
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20969090
score: 0
has text: Thanks for the quick reply, I have updated my query. May be it will help you to understand better

http://stackoverflow.com/comment/31483802
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20959537
score: 0
has text: `toArray(T[] a)` already does

http://stackoverflow.com/a/20971746
has comment: http://stackoverflow.com/comment/31506706
accepted answer of: http://stackoverflow.com/q/20971439
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20971439
type: Answer
has comment: http://stackoverflow.com/comment/31513231
score: 1
upvote count: 1
has body: And who would call ActivityStore&lt;Dog&gt; ? Your manifest ? No, you can't do just that. But, if you got something like DogStoreActivity extends ActivityStore&lt;Dog&gt;, then it's perfectly fine to define Activities like this.

http://stackoverflow.com/comment/31494223
score: 0
has text: @Nandy what I was leading you to is asking a separate question regarding the IO with your ftdi serial chip. You presented two issues in your question here and I elected to answer the easy one first. You should accept this answer if it solved the initial problem then follow up with another question via "Ask Question" since the scenario is different now (app doesn't crash due to UI freezing, it crashed due to your serial communication). Then people can more easily and directly help you solve that problem. And, yes, I think there's some reading in your future (=
type: Comment
comment on: http://stackoverflow.com/a/20963169
type: AnswerComment

http://stackoverflow.com/comment/31313069
type: AnswerComment
comment on: http://stackoverflow.com/a/20869337
type: Comment
has text: What? That is my downvote... and I am considering flagging it as spam as well. Please read the question again to see what OP is asking.
score: 0

http://stackoverflow.com/q/20995472
has answer: http://stackoverflow.com/a/21138075
answer count: 1
tagged with: wsdl
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31641860
has comment: http://stackoverflow.com/comment/41916017
type: UnansweredQuestion
tagged with: web-services
tagged with: cxf
has comment: http://stackoverflow.com/comment/31629262
tagged with: java
upvote count: 1
has body: I am building a WSDL-first java web-service using CXF2.7.7 that uses MTOM. My intention is to be able to upload large ( multiple Gigabytes) files through this web-service Below is a fragment of my the WSDL &lt;!-- WSDL for MTOM service --&gt; &lt;wsdl:types&gt; &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://objectstoreservice.example.com/" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://objectstoreservice.example.com/"&gt; &lt;xs:element name="objectReqParam" type="tns:objectReqParam"/&gt; &lt;xs:element name="objectRespParam" type="tns:objectRespParam"/&gt; &lt;xs:complexType name="objectReqParam"&gt; &lt;xs:sequence&gt; &lt;xs:element minOccurs="0" name="objName" type="xs:string"/&gt; &lt;xs:element minOccurs="0" maxOccurs="1" name="ObjData" type="xs:base64Binary" xmime:expectedContentTypes="application/octet-stream"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;xs:complexType name="objectRespParam"&gt; &lt;xs:sequence&gt; &lt;xs:element minOccurs="0" name="respCode" type="xs:string"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:schema&gt; &lt;/wsdl:types&gt; &lt;wsdl:message name="objectUploadRequest"&gt; &lt;wsdl:part name="objectReqParam" element="tns:objectReqParam"&gt; &lt;/wsdl:part&gt; &lt;/wsdl:message&gt; &lt;wsdl:message name="objectUploadResponse"&gt; &lt;wsdl:part name="objectRespParam" element="tns:objectRespParam"&gt; &lt;/wsdl:part&gt; &lt;/wsdl:message&gt; &lt;wsdl:portType name="ObjectStoreService"&gt; &lt;wsdl:operation name="uploadObject"&gt; &lt;wsdl:input name="objectUploadRequest" message="tns:objectUploadRequest"/&gt; &lt;wsdl:output name="objectUploadResponse" message="tns:objectUploadResponse"/&gt; &lt;/wsdl:operation&gt; &lt;/wsdl:portType&gt; &lt;wsdl:binding name="ObjectStoreServiceServiceSoapBinding" type="tns:ObjectStoreService"&gt; &lt;soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/&gt; &lt;wsdl:operation name=…
type: Question
has title: WSDL first MTOM enabled cxf 2.7 web-service client causes Java heap space error for large attachments
tagged with: mtom

http://stackoverflow.com/comment/130388626
comment on: http://stackoverflow.com/a/41502551
has text: does this support control of one screen to another?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31302872
has text: Yes, as I said it's jodatime DateTime. Here is the println: class org.joda.time.DateTime
comment on: http://stackoverflow.com/q/20863650
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20995535
has body: How can I set a fixed width of a JComboboxs popup-menu that is using GridBagLayout and fill=HORIZONTAL? One of the things I tried is to just override the getSize() method but dose not work. public class ComboBoxSize extends JFrame { public static void main(String args[]) { // THE COMBOBOX String labels[] = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J" }; JComboBox&lt;String&gt; comboBox = new JComboBox&lt;String&gt;(labels) { public Dimension getSize() { Dimension d = getPreferredSize(); d.width = 50; return d; } }; comboBox.setMaximumRowCount(comboBox.getModel().getSize()); // ADD COMBOBOX TO PANEL JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.weightx = 1; c.fill = GridBagConstraints.HORIZONTAL; panel.add(comboBox, c); // ADD PANEL TO FRAME JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(panel); frame.setSize(300, 200); frame.setVisible(true); } }
has comment: http://stackoverflow.com/comment/31550579
type: Question
has comment: http://stackoverflow.com/comment/31553163
tagged with: jcombobox
has title: Change JCombobox popup width
score: 0
tagged with: java
tagged with: swing
answer count: 1
has answer: http://stackoverflow.com/a/20996900
tagged with: gridbaglayout
has comment: http://stackoverflow.com/comment/31550714
linked to: http://stackoverflow.com/q/956003
has comment: http://stackoverflow.com/comment/31550534
tagged with: layout
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/956003

http://stackoverflow.com/q/20922436
has comment: http://stackoverflow.com/comment/31412781
score: 5
answer count: 1
tagged with: graph-algorithm
downvote count: 0
has comment: http://stackoverflow.com/comment/31412754
favorite count: 0
has comment: http://stackoverflow.com/comment/31413209
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31424930
has answer: http://stackoverflow.com/a/20928516
has comment: http://stackoverflow.com/comment/31413066
has comment: http://stackoverflow.com/comment/31413270
has body: For a directed graph G(V,E) where it has negative weights, I searched some similar topics and it seems Bellmanford can detect negative cycles. But it stops once negative cycles found, so how can we list all negative cycles in this case? Given thoughts on Eric Lippert's suggestion, I tried removing negative cycles once found from graph, but I feel this is not correct, why? because the graph changes after cycles are removed and there could be extra non-negative cycles in old graph but not gonna be found in new graph. Can someone please help clear my mind on this issue? this can be implemented in either java or c# (i prefer c# though) thanks
has title: List all negative cycles in directed graph
type: Question
has comment: http://stackoverflow.com/comment/31414287
tagged with: c#
tagged with: algorithm
upvote count: 5
tagged with: java

http://stackoverflow.com/q/20892680
accepted answer: http://stackoverflow.com/a/20892886
tagged with: spring
type: AnsweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/31356982
tagged with: java
tagged with: hibernate
has body: I use Spring 3 and Hibernate 4. I try to save a Users entity in database but it's not working. When i call the method finUsersByUsername(String username) it's work well. But when i use the save method defined in GenericDao it's does not work. I don't understand it. If someone could help me ? Domain class users: @Entity @Table(name="USERS") public class Users{ @Id @Column(name="USERNAME", length=50,nullable=false ) private String username; @Column(name="PASSWORD",length=50, nullable=false) private String password; @Column(name="ENABLED", nullable=false) private Boolean enabled; @Column(name="LASTNAME",length=50) private String lastName; @Column(name="FIRTSNAME",length=50) private String firstName; @Column(name="DATEOFBIRTH") private Date dateOfBirth; @Column(name="EMAIL",length=50, nullable=false) private String email; @Column(name="PHONENUMBER",length=50) private String phoneNumber; ... getters and setters } Generic DAO interface : public interface GenericDao<T, PK extends Serializable> { PK create(T newInstance); T read(PK id); List<T> readAll(); List<T> readByCriteria(Criterion criterion); void update(T transientObject); void delete(T persistentObject); } DAO implementation: @Repository public class GenericDaoImpl<T, PK extends Serializable> implements GenericDao<T, PK> { @Autowired private SessionFactory sessionFactory; public void setSessionFactory(SessionFactory sessionFactory) { this.sessionFactory = sessionFactory; } private Class<T> type; public GenericDaoImpl() { super(); } public GenericDaoImpl(Class<T> type) { this.type = type; } @Transactional @SuppressWarnings("unchecked") public PK create(T object) { return (PK) getSession().save(object); } @SuppressWarnings("unchecked") public T read(PK id) { return (T) getSession().get(type, id); } public List<T> readAll() { return readByCriteria(); } @SuppressWarnings("unchecked") public List<T> readByCriteria(Criterion... criterion) { Criteria crit = getSession().createCriteria(type); for (Criterion c : criterion) …
has title: GenericDAO method does (such as save)not work with Hibernate and Spring
tagged with: dao
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31357051
has answer: http://stackoverflow.com/a/20892886

diagram
tags question: http://stackoverflow.com/q/20976933
type: Tag
tags question: http://stackoverflow.com/q/21002944
tag name: diagram

http://stackoverflow.com/q/21000822
answer count: 2
has title: Using Spring and @IfProfileValue how to get only a certain method to run
tagged with: junit
type: UnansweredQuestion
tagged with: maven
tagged with: spring
has body: I have a test class and pom as visible here: https://gist.github.com/llaskin/8319222 When I run the maven command mvn clean test -Dtest.profile.discriminator=Twitter my goal is only to have testNumber2() run, as its the only test that has the appropriate test.profile.discriminator, however instead I get all the tests in the class running(1,2,3). How can I make this work?
has answer: http://stackoverflow.com/a/21000985
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21002722
score: 0

http://stackoverflow.com/q/20890554
has title: Lock Free Circular Array
has answer: http://stackoverflow.com/a/20890627
favorite count: 0
has answer: http://stackoverflow.com/a/20890640
tagged with: circular-buffer
answer count: 5
upvote count: 6
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20890642
tagged with: lock-free
score: 6
linked to: http://stackoverflow.com/q/45907210
has answer: http://stackoverflow.com/a/20890753
has body: I am thinking about implementing a lock free circular array. One problem is maintaining the head and tail pointers in a lock free manner. The code I have in mind is: int circularIncrementAndGet(AtomicInteger i) { i.compareAndSet(array.length - 1, -1); return i.incrementAndGet(); } Then I would do something like: void add(double value) { int idx = circularIncrementAndGet(tail); array[idx] = value; } (Note that if the array is full old values will be overwritten, I am fine with that). Does anyone sees a problem with this design? I suspect there might be a race condition I am not seeing.
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/78214929
has answer: http://stackoverflow.com/a/20890642
downvote count: 0
possible better answer: http://stackoverflow.com/a/20890627

http://stackoverflow.com/comment/31394007
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20911451
type: Comment
has text: Also worth noting: there is a general lack of context, so I am just guessing as to what you're trying to do. In general, its considered bad practice to open your database connection to the public for any reason; they're generally not designed for that. Putting a service in front for validation and security is the expected practice.

http://stackoverflow.com/comment/31570088
type: Comment
type: QuestionComment
score: 2
has text: If you are a newbie, then start by studying Java tutorials. You can't expect to learn Java by asking 500 questions on SO.
comment on: http://stackoverflow.com/q/21006061

http://stackoverflow.com/q/20897702
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31366396
has answer: http://stackoverflow.com/a/20898353
type: Question
has body: I found below code does not work, and it will give out exception file not found. What's the problem and how to fix it? try { boolean exsit = xmlTools.isExist(); Log.d(TAG, "&gt; 1 " + exsit); } catch (Exception e) { Log.d(TAG, "&gt; 1 " + e.getMessage()); e.printStackTrace(); } TheisExist() method is like below: public boolean isExist()throws Exception{ boolean flag=false; FileInputStream fs= mContext.openFileInput(mConfigFile); if( fs != null ){ flag=true; } return flag; } The exception thrown below: ( 4654):/data/data/com.demo.exmaple/files/appUsageD ata.xml: open failed: ENOENT (No such file or directory)
tagged with: android-layout
has title: Android method openFileOutput get "open failed: ENOENT" error
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31366647
accepted answer: http://stackoverflow.com/a/20898353
tagged with: android
tagged with: android-intent
has comment: http://stackoverflow.com/comment/31366179

http://stackoverflow.com/comment/31312237
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20868891
has text: @AnkurShanbhag have you seen that????
score: 0

http://stackoverflow.com/comment/31513049
comment on: http://stackoverflow.com/a/20974815
type: Comment
has text: I tried that at first. But I understated the problem, its not simply one level. Imagine a bank level, then a department level, then team level, then individual level, each holding ~50 pieces of information.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31514828
comment on: http://stackoverflow.com/q/20975789
type: QuestionComment
has text: Something like `System.out.println("actionName="+ActionContext.getContext().getName())`
score: 0
type: Comment

http://stackoverflow.com/comment/31521106
comment on: http://stackoverflow.com/q/20963091
has text: @jtahlborn: did you see the quotes around "concurrently"? You can read/write from multiple sockets as data is available / buffer space is available in each. So while not really concurrent, it allows handling multiple sockets in a non-sequential manner, without having to block when one of the sockets is waiting for data to arrive / go over the pipe, which can lead to the speed ups I explained. Looks like you need to play more with asynchronous i/o. A comment really is sort of short to explain all that, you know...
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/21017840
has comment: http://stackoverflow.com/comment/31591605
has comment: http://stackoverflow.com/comment/31591374
score: 0
has body: Try this: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.splash); Thread splash=new Thread(){ public void run(){ try{ sleep(2000); }catch(Exception e){ e.printStackTrace(); }finally{ startActivity(new Intent(getApplicationContext(),StartMenu.class)); finish(); } } }; splash.start(); } And your Manifest.xml: &lt;activity android:name="com.example.mapcard.Splash" android:label="@string/app_name" &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;
type: Answer
answers question: http://stackoverflow.com/q/21017690

http://stackoverflow.com/q/21013349
downvote count: 0
tagged with: inheritance
has comment: http://stackoverflow.com/comment/31583654
possible better answer: http://stackoverflow.com/a/21013391
score: 3
has answer: http://stackoverflow.com/a/21013391
has comment: http://stackoverflow.com/comment/31583536
has comment: http://stackoverflow.com/comment/31583521
accepted answer: http://stackoverflow.com/a/21013577
favorite count: 0
has title: How to count the number of instances of a particular class in inheritance tree, created explicitly?
type: AnsweredQuestion
tagged with: object
tagged with: oop
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/31583489
has body: class A { static int i; { System.out.println("A init block"+ ++i); } } class B extends A { static int j; { System.out.println("B init block"+ ++j); } } class C extends B { static int k; { System.out.println("C init block"+ ++k); } public static void main(String abc[]) { C c =new C(); } } In the code above, we can easily count the number of objects created for each class. But if i want to check the number of object created explicitly , i mean if I create C's object using new C(), or B's object using new B(), then it should give the count accordingly Take for example, C c2=new C(); B b2=new B(); So it should give the output of B's count as 1 and not 2.
has comment: http://stackoverflow.com/comment/31583804
has answer: http://stackoverflow.com/a/21013577
type: Question
answer count: 2

http://stackoverflow.com/q/20916479
has body: String date1 = jTextField.getText(); String date2 = jTextField2.getText(); // using CDate... pre=conn.prepareStatement("select * from Table where Date " + "between CDate(?) and CDate(?) order by Date"); pre.setString(1, date1); // bind param 1 pre.setString(2, date2); // bind param 2 ResultSet rs=pre.executeQuery(); When we take dates from 01/12/2013 to 31/01/2014 it just returns me records up to 31/12/2013. Another issue is when we take date from 01/01/2014 to 31/12/2014 then it returns me records from all dates of 2013 also. Please help me to solve this. Thank you. My Date column have data type as Text. Please provide me correct query to find dates records between two string inputted dates.
has comment: http://stackoverflow.com/comment/31439398
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20916561
tagged with: java
accepted answer: http://stackoverflow.com/a/20934825
has answer: http://stackoverflow.com/a/20916561
has comment: http://stackoverflow.com/comment/31402422
type: Question
has comment: http://stackoverflow.com/comment/31402506
tagged with: date
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31402493
tagged with: sql
has comment: http://stackoverflow.com/comment/31402552
has answer: http://stackoverflow.com/a/20934825
has title: getting wrong result when working with dates

http://stackoverflow.com/comment/31479344
has text: This doesn't work, I add the line in the doInBackground and I get a `Unreachable code` error
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20956863
score: 0

http://stackoverflow.com/a/20913196
answers question: http://stackoverflow.com/q/20911127
type: Answer
has comment: http://stackoverflow.com/comment/31396812
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/31397900
has comment: http://stackoverflow.com/comment/31425640
has comment: http://stackoverflow.com/comment/31398087
has body: I'm hardly an Emacs veteran, but I do have an emacs obsession. For Java: semantic-mode doesn't seem to work in practice, but can theoretically jump-to-definition evil-mode (a bit overkill...) can jump to definitions just fine with evil-goto-definition this works very well, and I'd even suggest porting it to a non-evil environment if possible imenu (this uses a regex engine to find definitions) is already used as a fallback in semantic-ia-fast-jump doesn't seem to work well on variables For Javascript: Javascript has some very complicated scope styles, and, unfortunately, such styles are commonplace so regex based solutions can and will jump to the wrong definition at times. semantic-mode doesn't work at all evil-goto-definition (uses a regex engine) works great as always imenu (uses a regex engine) doesn't seem to work well on variables Tern is a battery of (alien) semantic analysers which seems to integrate well with Emacs In general, I'd really recommend using evil if you can, it's superb. If you think of evil as being, well, evil, then: For variables use semantic-ia for jumps in Java, and tern for jumps in JS For functions use imenu. It works well on both Java and JS. And finally, here's some code that I use for almost all of my jumping. It lets you choose any function to jump to and uses imenu, so you can jump to things other than the current symbol-at-point. (defun ido-goto-symbol (&amp;optional symbol-list) "refresh imenu and jump to a place in the buffer using ido." (interactive) (unless (featurep 'imenu) (require 'imenu nil t)) (cond ((not symbol-list) (let ((ido-mode ido-mode) (ido-enable-flex-matching (if (boundp 'ido-enable-flex-matching) ido-enable-flex-matching t)) name-and-pos symbol-names position) (unless ido-mode (ido-mode 1) (setq ido-enable-flex-matching t)) (while (progn (imenu--cleanup) (setq imenu--index-alist nil) (ido-goto-symbol (imenu--make-index-alist)) (setq selected-symbol (ido-completing-read "symbol? " symbol-names)) (string= (first im…
downvote count: 0

http://stackoverflow.com/q/20882501
answer count: 2
has answer: http://stackoverflow.com/a/20883106
tagged with: jpa
downvote count: 0
has title: Why do we have to give database credentials in persistence.xml
tagged with: jpa-2.0
favorite count: 0
has answer: http://stackoverflow.com/a/20882653
has comment: http://stackoverflow.com/comment/31337673
has body: We are using JPA 2.0 and we created the datasource in websphere and tried to access the database through the J2SE application. We are getting Invalid Username and password error. If we give the user name and password in persistence.xml it works fine. Please anybody explain me why do we have to give the DB credentials in persistence.xml since we have the data source. Note: Data Source was created successfully and the test was success. persistence.xml <?xml version="1.0" encoding="UTF-8"?> jdbc/TestDataSource <property name="openjpa.Optimistic" value="false" /> <property name="openjpa.LockManager" value="pessimistic" /> <property name="javax.persistence.jdbc.user" value="admin" /> <property name="javax.persistence.jdbc.password" value="admin#2" />
type: UnansweredQuestion
upvote count: 1
type: Question
tagged with: jakarta-ee
score: 1
tagged with: java

http://stackoverflow.com/comment/31306791
comment on: http://stackoverflow.com/q/20865824
type: Comment
score: 1
has text: BTW - I edited your question to replace the title with a statement of intent - what you are trying to achieve. Please don't use titles like your original title in future. I suspect that is in large part why the 8 down-votes were added. It is just silly. Another factor might be claiming you have checked *"every possible question"* when.. you obviously haven't.
type: QuestionComment

http://stackoverflow.com/comment/31350073
has text: I guess you are working with files at another place in your program, too. You should post that code.
comment on: http://stackoverflow.com/q/20889272
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21014651
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21015058
has comment: http://stackoverflow.com/comment/31585707
has comment: http://stackoverflow.com/comment/31590483
answer count: 3
score: 3
has title: How to deal with various cases of defensive programming?
downvote count: 0
has body: This is an example of defensive copy in Effective java. Assume that scenario's in my underlying questions need a defensive copy, and cannot do with a comment asking client to avoid mutating objects passed in. public Period(Date start, Date end) { this.start = new Date(start.getTime()); this.end = new Date(end.getTime()); } Questions: What to do if Date did not have a constructor to take itself in, to make my self more general, an object is passed with no mechanism to replicate itself, and such object does not belong to us, ie we cant change it in any way ? What if the constructor took type parameter as an argument, say Period(T object) and T could be mutable so needs defensive copy. We dont have any idea of what is T. How to do defensive copy in this case ? What is an interface is passed where some of its subclasses do have a constructor like Date to create an object of itself and some of its subclasses dont have any mechanism to do so ? How deep should we defensively copy ? Lets say we copy an array, but array elements were mutable ?
tagged with: generics
has comment: http://stackoverflow.com/comment/31585774
favorite count: 0
tagged with: constructor
has answer: http://stackoverflow.com/a/21014800
has comment: http://stackoverflow.com/comment/31586300
possible better answer: http://stackoverflow.com/a/21015030
accepted answer: http://stackoverflow.com/a/21014800
upvote count: 3
has answer: http://stackoverflow.com/a/21015030
tagged with: java
tagged with: defensive-copy
type: Question

http://stackoverflow.com/q/20950086
has comment: http://stackoverflow.com/comment/31466024
has title: Can we switch off finalizers?
has answer: http://stackoverflow.com/a/20963467
has answer: http://stackoverflow.com/a/44780454
has comment: http://stackoverflow.com/comment/31465702
linked to: http://stackoverflow.com/q/7644556
has answer: http://stackoverflow.com/a/20952631
downvote count: 0
has body: As there is little guarantee about when and even if finalizers run and finalizers are almost considered a smell nowadays - is there any way to persuade the JVM to completely skip all finalization processes? I ask because we have a mammoth application which, when moved to a newer JVM (not sure which at this stage) is brought to its knees by what looks very much like the known problems with finalisers (exceptions being thrown and therefore very slow GC). Added There is some discussion on Troubleshooting a java memory leak: finalization? where it is suggested that the primary problem arises when exceptions are thrown within finalizers because that slows down the finalization process dramatically. My issue shows as a dramatic slow-down when memory becomes low and analysis of heap dumps show a large number of Finalizer objects (over 10,000,000) - suggesting to me that the slowdown could be their fault because they are delaying the GC. Obviously I may be wrong. I do not have the power to demand a refactor.
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/31470838
has comment: http://stackoverflow.com/comment/31478186
tagged with: finalizer
has comment: http://stackoverflow.com/comment/31466654
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/31488263
upvote count: 16
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20952631
possible better answer: http://stackoverflow.com/a/76255302
has answer: http://stackoverflow.com/a/76255302
tagged with: java
score: 16
has comment: http://stackoverflow.com/comment/31467529
type: Question
has comment: http://stackoverflow.com/comment/31471116

http://stackoverflow.com/comment/31592806
has text: can you please give me some examples how to use HasMap in to my code and please clarify your point ,its confusing @svz
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21017636
type: Comment

http://stackoverflow.com/comment/59325865
type: Comment
has text: thanx very much for the answer you helped me ^_^... but I eant to ask another question, could I print the content of each cluster according to specific attribute e.g. name? or this is just the only way to show the data
comment on: http://stackoverflow.com/a/29985924
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31339411
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20879966
has text: we actually tried it no luck. One example, it strips every 'onclick' when we actually want it to strip it only when onclick executes malicious code. Another example, style should be filtered ONLY when it contains malicious style='background:url("javascript:alert('XSS')")'. I guess we want the lib to be smart enough distinguishing malicious one from good one. JSoup does not have that capability.

http://stackoverflow.com/a/20958890
answers question: http://stackoverflow.com/q/20958775
downvote count: 0
has comment: http://stackoverflow.com/comment/31483793
has comment: http://stackoverflow.com/comment/31485241
score: 1
has comment: http://stackoverflow.com/comment/31485098
type: Answer
has body: it doesn't appear that the testng jars are on your classpath. I'm guessing they live under c:/testng so you'll want to add something to your -cp reflecting that.
has comment: http://stackoverflow.com/comment/31484282
has comment: http://stackoverflow.com/comment/31489424
upvote count: 1

eclipse
tags question: http://stackoverflow.com/q/21009870
tags question: http://stackoverflow.com/q/20919424
tags question: http://stackoverflow.com/q/21016837
tags question: http://stackoverflow.com/q/20955488
tag name: eclipse
tags question: http://stackoverflow.com/q/20967878
tags question: http://stackoverflow.com/q/20855791
tags question: http://stackoverflow.com/q/20934240
tags question: http://stackoverflow.com/q/20914983
tags question: http://stackoverflow.com/q/20870708
tags question: http://stackoverflow.com/q/20875834
tags question: http://stackoverflow.com/q/20984561
tags question: http://stackoverflow.com/q/20859108
tags question: http://stackoverflow.com/q/20997592
tags question: http://stackoverflow.com/q/20958826
tags question: http://stackoverflow.com/q/20988000
tags question: http://stackoverflow.com/q/20884763
tags question: http://stackoverflow.com/q/20856091
tags question: http://stackoverflow.com/q/20952699
tags question: http://stackoverflow.com/q/20987481
tags question: http://stackoverflow.com/q/20952200
tags question: http://stackoverflow.com/q/20872771
tags question: http://stackoverflow.com/q/20887485
tags question: http://stackoverflow.com/q/20864854
tags question: http://stackoverflow.com/q/20988711
tags question: http://stackoverflow.com/q/20974519
tags question: http://stackoverflow.com/q/20887878
tags question: http://stackoverflow.com/q/20936174
tags question: http://stackoverflow.com/q/20881754
tags question: http://stackoverflow.com/q/20970397
tags question: http://stackoverflow.com/q/20851574
tags question: http://stackoverflow.com/q/20857723
tags question: http://stackoverflow.com/q/20933922
tags question: http://stackoverflow.com/q/20965965
tags question: http://stackoverflow.com/q/20947002
tags question: http://stackoverflow.com/q/20893905
tags question: http://stackoverflow.com/q/20917274
tags question: http://stackoverflow.com/q/20969714
tags question: http://stackoverflow.com/q/20929786
tags question: http://stackoverflow.com/q/20930156
tags question: http://stackoverflow.com/q/20957044
tags question: http://stackoverflow.com/q/20932377
tags question: http://stackoverflow.com/q/20953836
tags question: http://stackoverflow.com/q/20905905
tags question: http://stackoverflow.com/q/21003944
tags question: http://stackoverflow.com/q/20981976
tags question: http://stackoverflow.com/q/21013657
tags question: http://stackoverflow.com/q/20877574
tags question: http://stackoverflow.com/q/20871428
tags question: http://stackoverflow.com/q/20979060
tags question: http://stackoverflow.com/q/21015713
tags question: http://stackoverflow.com/q/20942548
tags question: http://stackoverflow.com/q/20861752
tags question: http://stackoverflow.com/q/20867864
tags question: http://stackoverflow.com/q/20967683
tags question: http://stackoverflow.com/q/20935122
tags question: http://stackoverflow.com/q/20893619
tags question: http://stackoverflow.com/q/20961613
tags question: http://stackoverflow.com/q/21000931
tags question: http://stackoverflow.com/q/21000894
tags question: http://stackoverflow.com/q/20954007
tags question: http://stackoverflow.com/q/20907487
tags question: http://stackoverflow.com/q/20850193
tags question: http://stackoverflow.com/q/20948014
tags question: http://stackoverflow.com/q/20993915
tags question: http://stackoverflow.com/q/20949392
tags question: http://stackoverflow.com/q/20968792
tags question: http://stackoverflow.com/q/21001274
tags question: http://stackoverflow.com/q/20969953
tags question: http://stackoverflow.com/q/20921763
tags question: http://stackoverflow.com/q/20878928
tags question: http://stackoverflow.com/q/20935854
tags question: http://stackoverflow.com/q/20987918
tags question: http://stackoverflow.com/q/20988843
tags question: http://stackoverflow.com/q/20922210
tags question: http://stackoverflow.com/q/21004983
tags question: http://stackoverflow.com/q/20968476
tags question: http://stackoverflow.com/q/20907912
tags question: http://stackoverflow.com/q/20967421
tags question: http://stackoverflow.com/q/20975534

http://stackoverflow.com/q/20983497
score: 0
tagged with: android
has body: I'm novice in SQLite. I have an int array: int[][] data = new int[32768][256]. So, I decided to use SQLite database to store data content. I want to create a table named "data_content" and put data in cells a b c (c = data[a][b]) But I want to save (in the /sdcard/) that large amount of values (8 388 608) in less than 1 minute, if possible. How I can do that? I will very appreciate any code. I'm very sorry about my English, I've used Google Translate sometimes.
type: UnansweredQuestion
tagged with: android-sqlite
tagged with: java
has title: (Android) How to save a large amount of Integers into SQLite database really fast?
has answer: http://stackoverflow.com/a/20983558
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/20984098

http://stackoverflow.com/a/21025960
answers question: http://stackoverflow.com/q/20864499
upvote count: 5
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/137098142
score: 5
has body: This article from Martin Fowler answers your question. You're a mockist, as I'm, but there are many people who don't like this approach and prefer the classicist approach (e.g. Kent Beck). Roy Osherove says that the goal of a test, when it fails, is to identify the production code causing the problem, and having that in mind is obvious that the more fine grained the better. For sure being a mockist may be overwhelming for beginners, but once you're used to the mechanisms of a Mocking library the benefits are uncountable while the effort is not much higher than the other approach.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20864499

http://stackoverflow.com/a/24262406
upvote count: 1
has body: com.splunk.Service class has a login method which is called when Service.connect(loginArgs) method is called.Login method has below line: ResponseMessage response = post("/services/auth/login", args); the path http://&lt;&lt;yourhost&gt;&gt;/services/auth/login might be invalid. Overriding com.splunk.Service class by our own implementation solves the problem.
downvote count: 0
answers question: http://stackoverflow.com/q/20869474
type: Answer
score: 1

android-dialog
type: Tag
tags question: http://stackoverflow.com/q/21009950
tag name: android-dialog

http://stackoverflow.com/q/20940390
downvote count: 0
answer count: 1
favorite count: 0
tagged with: eclipse-rcp
has body: I have the following build.properties in my sample application: source.. = src/ output.. = bin/ bin.includes = plugin.xml,\ META-INF/,\ . File was generated by IDE. What does dot at the end mean? If it means to process all files in the current directory, then what for plugin.xml file mentioned there? Since it is in the current directory it would be processed implicitly by dot. If it means to process all subdirectories in the current directory, then what for META-INF directory mentioned there? Since it is in the current directory it would be processed implicitly by dot. If non above is correct, then what does dot mean actually? If I set there some myfile.bin, what will happen then?
upvote count: 6
type: UnansweredQuestion
score: 6
tagged with: java
has answer: http://stackoverflow.com/a/20945471
has title: What does dot mean in bin.includes in build.properties in Eclipse RCP?
tagged with: eclipse
type: Question

parsing
tags question: http://stackoverflow.com/q/20982283
tags question: http://stackoverflow.com/q/20899839
tags question: http://stackoverflow.com/q/20949590
tags question: http://stackoverflow.com/q/21010003
tags question: http://stackoverflow.com/q/20937270
tag name: parsing
tags question: http://stackoverflow.com/q/20946618
tags question: http://stackoverflow.com/q/20923583
tags question: http://stackoverflow.com/q/20875403
tags question: http://stackoverflow.com/q/20986514
tags question: http://stackoverflow.com/q/21007431
tags question: http://stackoverflow.com/q/20917989
tags question: http://stackoverflow.com/q/20984323
tags question: http://stackoverflow.com/q/20951710
tags question: http://stackoverflow.com/q/20998787
tags question: http://stackoverflow.com/q/20863759
tags question: http://stackoverflow.com/q/20916229
type: Tag
tags question: http://stackoverflow.com/q/20890483
tags question: http://stackoverflow.com/q/20924346
tags question: http://stackoverflow.com/q/20940132
tags question: http://stackoverflow.com/q/20949556
tags question: http://stackoverflow.com/q/20951951
tags question: http://stackoverflow.com/q/21009207
tags question: http://stackoverflow.com/q/20912455
tags question: http://stackoverflow.com/q/20873326
tags question: http://stackoverflow.com/q/21007485
tags question: http://stackoverflow.com/q/20862135

http://stackoverflow.com/a/20921586
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20921313
upvote count: 1
score: 1
has body: I think you already know the reason why it return wrong. You can try this: j = 0； while（j &lt;= (source.length() - pattern.length())）{ for (i = pattern.length(); i &gt;= 0 &amp;&amp; pattern[i] == source[i + j]; --i); if (i &lt; 0)) { matched = true; break; } else j++； } about string matching, there are many methods, you can use KMP, BM and Sunday and so on, and performance comparation is: KMP &lt; BM &lt; Sunday, you can try these and they are very userful.

http://stackoverflow.com/comment/31368194
type: Comment
type: QuestionComment
has text: Did you try directly setting without going through the hash map (ruling out issues in the hash map itself) ?
comment on: http://stackoverflow.com/q/20898280
score: 0

android-tabhost
tags question: http://stackoverflow.com/q/20971925
tags question: http://stackoverflow.com/q/20920702
tag name: android-tabhost
type: Tag

http://stackoverflow.com/comment/31453907
type: AnswerComment
has text: thanks ankit, can i expect the same output every time.we can't force GC to run. GC-cleanup activity will be performed on a bunch of objects. and running GC depends on JVM.
comment on: http://stackoverflow.com/a/20943528
type: Comment
score: 0

http://stackoverflow.com/q/20891425
has answer: http://stackoverflow.com/a/69670465
downvote count: 0
tagged with: java
type: Question
score: 18
has answer: http://stackoverflow.com/a/62692288
has title: Can Java Protocol Buffers ever return null on the list getter of a repeated field?
answer count: 3
favorite count: 0
tagged with: protocol-buffers
upvote count: 18
has comment: http://stackoverflow.com/comment/31354604
has answer: http://stackoverflow.com/a/20893995
has body: Say you have a repeated field. message Foo { optional int32 val = 1; } message Bar { repeated Foo foo = 1; } This will generate the method List&lt;Foo&gt; getFooList() Is there any circumstance where getFooList will return null? Or will it always return a List, even if it's empty?
possible better answer: http://stackoverflow.com/a/62692288
accepted answer: http://stackoverflow.com/a/20893995
type: AnsweredQuestion

http://stackoverflow.com/a/20944196
has comment: http://stackoverflow.com/comment/31455049
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31455376
has comment: http://stackoverflow.com/comment/31460725
upvote count: 1
has comment: http://stackoverflow.com/comment/31455549
has comment: http://stackoverflow.com/comment/31455229
has comment: http://stackoverflow.com/comment/31454978
has body: What is the public_html folder of this production server? If I remember correctly, isn't this the public folder for any LAMP based sites hosting servers which are mapped with the local Apache server ? For Tomcat7 deployments, it is required that you place your war ( or folder ) inside the webapps folder located at $Tomcat_dir$/webapps. Also make sure from the logs that your application is getting properly deployed or not.
type: Answer
answers question: http://stackoverflow.com/q/20944165

http://stackoverflow.com/a/20975008
score: 0
answers question: http://stackoverflow.com/q/20965658
type: Answer
has body: Exception cause is that you are not calling ObjectOutputStream.writeInt(int) before writing objects. As far as I understand you are trying to store number of objects, which is stored in the file. So, you should do it like this: obj.writeInt(2); public class Test implements Serializable { private static final long serialVersionUID = 243705916609512381L; private String name; public void setName(String name) { this.name = name; } public String getName() { return name; } } public static void main(String[] args) { Test s = new Test(); s.setName("Test"); Test s1 = new Test(); s1.setName("Test 2"); ObjectOutputStream oos = null; FileOutputStream fileOutputStream = null; FileInputStream fileInputStream = null; ObjectInputStream ois = null; try { fileOutputStream = new FileOutputStream("C:\\test.txt"); oos = new ObjectOutputStream(fileOutputStream); oos.writeInt(2); oos.writeObject(s1); oos.writeObject(s); oos.flush(); oos.close(); fileOutputStream.close(); fileInputStream = new FileInputStream("C:\\test.txt"); ois = new ObjectInputStream(fileInputStream); int readInt = ois.readInt(); System.out.println("Read int " + readInt); Test readObject = (Test) ois.readObject(); System.out.println(readObject.getName()); Test readObject2 = (Test) ois.readObject(); System.out.println(readObject2.getName()); ois.close(); fileInputStream.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { // close everything } }

http://stackoverflow.com/q/20903870
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/31377133
tagged with: eclipse-plugin
favorite count: 0
linked to: http://stackoverflow.com/q/6286701
has comment: http://stackoverflow.com/comment/31377174
has answer: http://stackoverflow.com/a/20904518
accepted answer: http://stackoverflow.com/a/20904518
type: AnsweredQuestion
has title: To change colour of text in java console
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/4846937
has comment: http://stackoverflow.com/comment/31377342
linked to: http://stackoverflow.com/q/7962748
linked to: http://stackoverflow.com/q/7091003
duplicate of: http://stackoverflow.com/q/4846937
tagged with: eclipse
has body: I am writing java program in eclipse, the program check condition and prints appropriate message as output. All i want to do is print output message in black color when condition is true and print message in red color when condition is false. Is it possible to do so?
score: 0
upvote count: 1

http://stackoverflow.com/q/20869138
type: AnsweredQuestion
score: 15
has comment: http://stackoverflow.com/comment/31312791
has comment: http://stackoverflow.com/comment/31312995
tagged with: java
has body: How to get an Integer instead of Long from JSON? I want to read JSON in my Java program, but when I get a JSON value which is a number, my parser returns a number of type Long. I want to get an Integer. I tried to cast the long to an integer, but java throws a ClassCastException (java.lang.Long cannot be cast to java.lang.Integer). I tried several things, such as first converting the long to a string, and then converting with Integer.parseInt(); but also that doesn't work. I am using json-simple Edit: I still can't get it working. Here is an example: jsonItem.get("amount"); // returns an Object I can do this: (long)jsonItem.get("amount"); But not this: (int)jsonItem.get("amount"); I also can't convert it with Integer newInt = new Integer(jsonItem.get("amount")); or Integer newInt = new Integer((long)jsonItem.get("amount"));
type: Question
has answer: http://stackoverflow.com/a/20869175
tagged with: long-integer
tagged with: http://stackoverflow.com/tag/json
possible better answer: http://stackoverflow.com/a/70602808
has comment: http://stackoverflow.com/comment/31312524
has answer: http://stackoverflow.com/a/70602808
upvote count: 15
accepted answer: http://stackoverflow.com/a/20869175
answer count: 2
tagged with: casting
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31313149
has title: JSON - simple get an Integer instead of Long
tagged with: integer

http://stackoverflow.com/comment/31456594
score: 0
type: Comment
has text: Think this has been asked before: http://stackoverflow.com/a/16426868/3112803
type: QuestionComment
comment on: http://stackoverflow.com/q/20945080

http://stackoverflow.com/comment/36154348
type: AnswerComment
comment on: http://stackoverflow.com/a/20912733
score: 0
type: Comment
has text: I'm trying to add implicit multiplication to [a parser](https://github.com/silentmatt/js-expression-eval), and I have just concluded that to make it properly you need to take order of operations into account. Consider `2x^2x`, which if written by hand should be interpreted as `2*x^(2*x)` -- in the exponential you need parenthesis, but in the base you should _not_ have parenthesis. (Maybe this isn't really about order of operations, but that our mathematical writing is inconsistent. Anyway, it seems that regexp won't solve it completely.)

http://stackoverflow.com/q/20986051
has body: This is on Ubuntu 12.04/ Java 7, 64bit Working on project to create java bindings for WebkitGtk Version 2. My primary interest in WebkitGTK is DOM access and manipulation as against just displaying web pages. For V2, WebkitGtk team changed architecture which allows DOM access via extensions. Extensions are loaded by WebKitWebProcess which is a separate process fired when webkit is started. I got most of it under control. My extension is getting loaded and JVM is started and my java classes are getting loaded and mostly working as expected. Right now my debugging technique is basically println statements and/or log statements. Wondering if I can attach a java debugger so that I can debug java code more easily. If I run jps command, PID of WebKitWebProcess does show up. So someone is aware that this process has JVM. Preferred debugger will be eclipse. Basically it boils down to how to attach java debugger where VM is stared using JNI_CreateJavaVM and process is already running.
favorite count: 0
has title: Attaching debugger to JVM created by JNI_CreateJavaVM
type: UnansweredQuestion
score: 1
tagged with: java
type: Question
tagged with: jdb
tagged with: java-native-interface
has answer: http://stackoverflow.com/a/21004871
tagged with: jnienv
upvote count: 1
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/31473641
comment on: http://stackoverflow.com/a/20952487
type: Comment
score: 1
type: AnswerComment
has text: Oh yes, well, I assumed the average of the array of longs would be a `double`. You'd have to store each `arr[i]/N` as a double... if the desired result is a long, you could recast or round at the end.

http://stackoverflow.com/comment/31411810
type: QuestionComment
has text: Yes Realised it now, thanx for the comment.
type: Comment
comment on: http://stackoverflow.com/q/20921788
score: 0

http://stackoverflow.com/comment/31350137
type: QuestionComment
comment on: http://stackoverflow.com/q/20889286
has text: XOR is exclusive or -- they can't be equal. `!=` means not equal.
score: 0
type: Comment

http://stackoverflow.com/comment/31374146
type: Comment
has text: Thanks for your quick response! (I goofed up even in my test code!)
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/20901929

http://stackoverflow.com/a/20927139
has comment: http://stackoverflow.com/comment/31422184
accepted answer of: http://stackoverflow.com/q/20927104
type: Answer
answers question: http://stackoverflow.com/q/20927104
has body: You're only asking for the column index for a column COUNT that does not exist in the cursor. Hence -1 is returned. To retrieve the count value, move the cursor to the first row and get the first column value: if (cursor.moveToFirst()) { catCount = cursor.getInt(0); } (A COUNT(*) query will always have a result row but it's a good habit to check the result of moveToFirst() anyway.)
has comment: http://stackoverflow.com/comment/31422126
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/31422172
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/20900142
has title: Understanding regular expression output
downvote count: 2
has body: I need help to understand the output of the code below. I am unable to figure out the output for System.out.print(m.start() + m.group());. Please can someone explain it to me? import java.util.regex.*; class Regex2 { public static void main(String[] args) { Pattern p = Pattern.compile("\\d*"); Matcher m = p.matcher("ab34ef"); boolean b = false; while(b = m.find()) { System.out.println(m.start() + m.group()); } } } Output is: 0 1 234 4 5 6 Note that if I put System.out.println(m.start() );, output is: 0 1 2 4 5 6
has answer: http://stackoverflow.com/a/20900446
has comment: http://stackoverflow.com/comment/31370417
tagged with: java
has answer: http://stackoverflow.com/a/20900669
type: Question
linked to: http://stackoverflow.com/q/18384930
answer count: 3
has answer: http://stackoverflow.com/a/20900427
has comment: http://stackoverflow.com/comment/31370576
tagged with: regex
duplicate of: http://stackoverflow.com/q/18384930
has comment: http://stackoverflow.com/comment/31370750
has comment: http://stackoverflow.com/comment/31370564
favorite count: 0
upvote count: 2
type: UnansweredQuestion
score: 0

http://stackoverflow.com/comment/31431858
type: AnswerComment
has text: Oddly, the original code had overridden both methods, and in `paintComponent(..)` it caused an infinite loop by setting the BG color.. Definitely the OP should go through the two links you added.
type: Comment
comment on: http://stackoverflow.com/a/20932144
score: 0

http://stackoverflow.com/q/20889887
downvote count: 0
has answer: http://stackoverflow.com/a/20889925
has title: More that one components "linked" to each other
favorite count: 0
has answer: http://stackoverflow.com/a/20889962
has body: It is vary usual to have 2 swing components doing the same job. For example we can have a button in a toolbar used as a "save" button, and a JMenuItem (File-save...) doing the same. My question is: Is there a way to keep one component "linked" to another so we don't have to repeat code? Of course we can simply create a single method and call it from both components, but I am learning java now and I would like to ask if it is possible to do it another way.
has comment: http://stackoverflow.com/comment/31352759
tagged with: swing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31351391
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/20889925
type: Question
accepted answer: http://stackoverflow.com/a/20889962
answer count: 2
upvote count: 1

http://stackoverflow.com/comment/31423209
type: Comment
has text: IMHO short lived actor make sense if you have a task which needs to be done once e.g. on startup and never again. If you have a recurring task, just have an actor which lives for the life of the application.
comment on: http://stackoverflow.com/a/20927474
score: 0
type: AnswerComment

http://stackoverflow.com/a/21000083
has comment: http://stackoverflow.com/comment/31558950
type: Answer
has body: Open the File in append mode by passing true to FileWriter(String fileName, boolean append) constructor ,So that it wont override the existing content. Constructs a FileWriter object given a file name with a boolean indicating whether or not to append the data written. fWriter = new FileWriter(file.getAbsoluteFile(), true);
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/21000064
accepted answer of: http://stackoverflow.com/q/21000064
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31563111

http://stackoverflow.com/q/20933718
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20934186
answer count: 2
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/20934186
has body: My class for saving screenshots works fine: public class ScreenshotSaver { private static int counter = 1; public static void saveScreenshot() { FileHandle fh; do { fh = new FileHandle("screenshot" + counter++ + ".png"); } while (fh.exists()); Pixmap pixmap = getScreenshot(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false); PixmapIO.writePNG(fh, pixmap); pixmap.dispose(); } private static Pixmap getScreenshot(int x, int y, int w, int h, boolean flipY) { Gdx.gl.glPixelStorei(GL10.GL_PACK_ALIGNMENT, 1); final Pixmap pixmap = new Pixmap(w, h, Format.RGBA8888); ByteBuffer pixels = pixmap.getPixels(); Gdx.gl.glReadPixels(x, y, w, h, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, pixels); final int numBytes = w * h * 4; byte[] lines = new byte[numBytes]; if (flipY) { pixels.clear(); pixels.get(lines); } else { final int numBytesPerLine = w * 4; for (int i = 0; i &lt; h; i++) { pixels.position((h - i - 1) * numBytesPerLine); pixels.get(lines, i * numBytesPerLine, numBytesPerLine); } pixels.clear(); pixels.put(lines); } return pixmap; } } The problem is, when I execute program in write protected area. Program simply turns off. I'd prefer if it just didn't save the screenshot instead. How to do that?
has answer: http://stackoverflow.com/a/20934379
type: AnsweredQuestion
has title: LibGDX - saving screenshot in write protected folder
upvote count: 1
possible better answer: http://stackoverflow.com/a/20934379
type: Question
tagged with: libgdx

http://stackoverflow.com/comment/31365935
type: QuestionComment
has text: See [this](http://stackoverflow.com/questions/3655984/why-is-string-a-reference-type)
comment on: http://stackoverflow.com/q/20897600
score: 3
type: Comment

http://stackoverflow.com/comment/31328376
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20877399
has text: So your code already looks up matching an X, now all you need is a way to detect A and B in a similar fashion and a variable in as the count of A and B. Then add the print out to the print statements in the area of your code which is the termination if clause

http://stackoverflow.com/comment/31354529
type: Comment
has text: you were perfectly right: I shouldn't be using a for loop at all. I managed to make it work with Swing Timer but also with Util Timer. Thanks again
comment on: http://stackoverflow.com/a/20890585
score: 0
type: AnswerComment

http://stackoverflow.com/q/20997019
tagged with: java
has body: i am trying to create a pdf with the values in LIST> using FOP in java, but getting some exception like javax.xml.transform.TransformerConfigurationException: Could not complie style sheet. here is my code looks like: 1.JaXBChildList.java import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSeeAlso; @XmlRootElement(name="list") public class JaXBChildList&lt;List&gt; extends JaxbList&lt;JaXBChildList&gt;{ protected java.util.List&lt;String&gt; list; public JaXBChildList(){} public JaXBChildList(java.util.List&lt;String&gt; list){ this.list=list; } @XmlElement(name="i") public java.util.List&lt;String&gt; getList(){ return list; } } 2.JaxbList.java import java.util.List; import javax.xml.bind.annotation.XmlMixed; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSeeAlso; @XmlRootElement(name="records") @XmlSeeAlso({JaXBChildList.class}) public class JaxbList&lt;T&gt;{ protected List&lt;T&gt; records; public JaxbList(){} public JaxbList(List&lt;T&gt; list){ this.records=list; } @XmlMixed public List&lt;T&gt; getRecords(){ return records; } } 3.PDFHandler.java public class PDFHandler { public static final String EXTENSION = ".pdf"; public String PRESCRIPTION_URL = "template.xsl"; public String createPDFFile(ByteArrayOutputStream xmlSource, String templateFilePath) throws IOException { File file = File.createTempFile("" + System.currentTimeMillis(), EXTENSION); URL url = new File(templateFilePath + PRESCRIPTION_URL).toURI().toURL(); // creation of transform source StreamSource transformSource = new StreamSource(url.openStream()); // create an instance of fop factory FopFactory fopFactory = FopFactory.newInstance(); // a user agent is needed for transformation FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); // to store output ByteArrayOutputStream pdfoutStream = new ByteArrayOutputStream(); StreamSource source = new StreamSource(new ByteArrayInputStream(x…
type: Question
has comment: http://stackoverflow.com/comment/31552504
tagged with: apache-fop
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31553217
answer count: 0
has title: How to create PDF which takes the values from a List<List<String>> using FOP only

http://stackoverflow.com/comment/31318921
comment on: http://stackoverflow.com/q/20872034
type: Comment
type: QuestionComment
has text: You might want to double check that. There are 37 in alpha and 39 in dotties.
score: 0

http://stackoverflow.com/a/20907225
answers question: http://stackoverflow.com/q/20906713
score: 0
has body: Result of equals method depends very much on its implementation. Method equals of Object: public boolean equals(Object obj) { return (this == obj); } This means, that equals will return true, only if the two variables holds the references (therefore references to the same object). If it returns false, this must by caused by overriding the original method. I don't know, where is the bug, because I don't see your equals method, but I can give you an example, how to write one: public class MyClass { private int integer; private String string; private char character; public MyClass(int integer, String string, char character) { this.integer = integer; this.string = string; this.character = character; } @Override public boolean equals(Object obj) { if (obj == null) return false; if (obj == this) return true; if (!(obj instanceof MyClass)) return false; MyClass myClass = (MyClass) obj; if (integer == myClass.integer &amp;&amp; string.equals(myClass.string) &amp;&amp; character == myClass.character) return true; else return false; } } I hope this helps you to find out mistake...
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/20906713

http://stackoverflow.com/comment/31564162
score: 0
type: AnswerComment
type: Comment
has text: Don't rush to learn Calendar. Java 8 has a new time library coming that is supposed to be much better than Date or Calendar.
comment on: http://stackoverflow.com/a/21003043

http://stackoverflow.com/q/20850845
tagged with: awt
tagged with: drag-and-drop
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31281348
tagged with: mousemotionevent
has title: Why does my label not move until after I drag it when I call it to after my mouse wheel event?
answer count: 0
has comment: http://stackoverflow.com/comment/31282269
type: Question
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/31278231
has body: public void mouseWheelMoved(MouseWheelEvent arg0) { if(dragging) { drag.rotate(); drag.setLocation(getMousePosition()); getContentPane().repaint(); } } drag is the label I'm dragging and it doesn't set the location to the mouse position until after I drag it again.

http://stackoverflow.com/comment/31352344
comment on: http://stackoverflow.com/q/20890361
has text: a regular expression might do the trick.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31561458
comment on: http://stackoverflow.com/a/21001632
score: 0
type: AnswerComment
has text: I'm not sure I understand why concurrency would be an issue here. I don't need to to run simultaneously, do I? I want to execute one command, and then another. Right?
type: Comment

jstl
tags question: http://stackoverflow.com/q/21001212
tags question: http://stackoverflow.com/q/20968507
tags question: http://stackoverflow.com/q/20965988
tags question: http://stackoverflow.com/q/20898105
tags question: http://stackoverflow.com/q/20947271
tags question: http://stackoverflow.com/q/21005849
type: Tag
tags question: http://stackoverflow.com/q/20883328
tag name: jstl
tags question: http://stackoverflow.com/q/20943797
tags question: http://stackoverflow.com/q/20946362
tags question: http://stackoverflow.com/q/20853488

http://stackoverflow.com/a/20870908
type: Answer
accepted answer of: http://stackoverflow.com/q/20870879
has body: The meaning of "sets do not allow duplicate values" is that when you add a duplicate to a set, the duplicate is ignored, and the set remains unchanged. This does not lead to compile or runtime errors: duplicates are silently ignored. You can tell that a value is a duplicate by checking the result of add, like this: Set&lt;String&gt; testSet = new HashSet&lt;String&gt;(); boolean first = testSet.add("hello"); System.out.println(first); // Prints "true" boolean second = testSet.add("hello"); System.out.println(second); // Prints "false"
answers question: http://stackoverflow.com/q/20870879
score: 17
upvote count: 17
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/21000326
has comment: http://stackoverflow.com/comment/31559598
accepted answer of: http://stackoverflow.com/q/21000110
has body: Wherever you handle the exception, you have the option of looking into the getMostSpecificCause() or getRootCause() methods of UnexpectedRollbackException. Here is information about those methods.
answers question: http://stackoverflow.com/q/21000110
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 14
score: 14
has comment: http://stackoverflow.com/comment/31559630

http://stackoverflow.com/q/21009699
has comment: http://stackoverflow.com/comment/31577133
answer count: 0
downvote count: 0
tagged with: reflection
score: 1
tagged with: java
type: Question
duplicate of: http://stackoverflow.com/q/1069066
upvote count: 1
has title: Call stack from within Java method
favorite count: 0
linked to: http://stackoverflow.com/q/1069066
has body: Is it possible to add debugging code in a Java method which would determine which client method invoked that particular method using perhaps reflection, in very much the same way the call stack is available in any IDE? Additionally, would it be possible to, in addition to the immediate caller, also produce a recursive call stack all the way down to the bottom level caller (e.g. a main method)?
type: UnansweredQuestion

http://stackoverflow.com/a/20970753
answers question: http://stackoverflow.com/q/20970431
type: Answer
has body: Generally NullPointerException throw when when you try to use a reference that points to no location in memory (null).Calling a method on a null reference or trying to access a field of a null reference will trigger a NullPointerExecption. In your code you are try to calling method isEmpty() using null reference of you HashMap object. Always check null before checking any other condition or accessing method using object reference. For Example : HashMap sqldata = new HashMap(); if(sqldata!=null &amp;&amp; sqldata.isEmpty()) { sqldata = fileloader.dbhealthload(); }
score: 0

http://stackoverflow.com/comment/31591622
type: QuestionComment
has text: Which port number you are using in `https` url?
score: 0
comment on: http://stackoverflow.com/q/21017968
type: Comment

http://stackoverflow.com/q/20933302
has body: Quite new to the Java language, I was wondering whether it is correct and possible to do this: ArrayList&lt;PeopleDetails&gt; people_SMS = checkbox_SMS(adapter); Where checkbox_SMS(adapter) is a method that returns type ArrayList. Is this legitimate code, or will the people_SMS arraylist merely contain a pointer to the the returned arraylist? Will my code work, if I want to access the data from checkbox_SMS? Thanks for the help!!
favorite count: 0
has answer: http://stackoverflow.com/a/20933396
upvote count: 1
has comment: http://stackoverflow.com/comment/31433700
type: AnsweredQuestion
tagged with: syntax
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/20933396
has answer: http://stackoverflow.com/a/20933334
downvote count: 0
has comment: http://stackoverflow.com/comment/31433710
tagged with: arraylist
possible better answer: http://stackoverflow.com/a/20933333
has answer: http://stackoverflow.com/a/20933336
has title: Can an arraylist be initialized with a method returned arraylist?
has answer: http://stackoverflow.com/a/20933333
tagged with: android
answer count: 4

http://stackoverflow.com/comment/31311852
type: QuestionComment
comment on: http://stackoverflow.com/q/20863585
has text: @trashgod yeah its working fine in ubuntu(linux)...yes its specific to windows ..
score: 0
type: Comment

specifications
type: Tag
tags question: http://stackoverflow.com/q/20871690
tag name: specifications

http://stackoverflow.com/q/20950452
upvote count: 1
tagged with: swing
has body: EDIT: Huge code re-organisation, old question here: http://pastebin.com/Mbg4dYiY I have created a basic program that is designed to show the weather in a window using Swing. I am developing using IntelliJ and I have used the UI builder in that. I am attempting to fetch some information from the Weather Underground servers and then make a JLabel called weatherlabel display this information. However, the JLabel doesn't actually change in the window; it just stays as 'Weather Will Go Here'. How do I fix this? Here is my main.java: public class main { public static void main(String[] args) { System.out.println("Hello World!"); Display d = new Display(); d.getandsetWeather(); } } Here is my Display.java: public class Display { Display disp = this; public JPanel myPanel; public JLabel weatherfield; private JButton button1; public void init() { JFrame frame = new JFrame("Display"); frame.setContentPane(new Display().myPanel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setMinimumSize(new Dimension(480, 234)); frame.pack(); frame.setVisible(true); } public void getandsetWeather() { String editedline = null; init(); try { // Construct data String data = URLEncoder.encode("key1", "UTF-8") + "=" + URLEncoder.encode("value1", "UTF-8"); data += "&amp;" + URLEncoder.encode("key2", "UTF-8") + "=" + URLEncoder.encode("value2", "UTF-8"); // Send data URL url = new URL("http://api.wunderground.com/api/772a9f2cf6a12db3/geolookup/conditions/q/UK/Chester.json"); URLConnection conn = url.openConnection(); conn.setDoOutput(true); OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream()); wr.write(data); wr.flush(); // Get the response BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); String line; while ((line = rd.readLine()) != null) { if( line.contains("\"weather\":")) { System.out.println(line); editedline = line.replace("\"weather\":\"", ""); editedline = editedline.replace("\",", ""); System.out.println(editedline); wea…
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/20950859
type: Question
has comment: http://stackoverflow.com/comment/31465820
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31466071
has title: JLabel's text is not changing
favorite count: 0
has comment: http://stackoverflow.com/comment/31467255
has comment: http://stackoverflow.com/comment/31467289
has answer: http://stackoverflow.com/a/20950859
tagged with: jlabel

http://stackoverflow.com/q/20976365
has title: RXTX Java librairie bug
answer count: 0
type: UnansweredQuestion
tagged with: arduino
score: 2
has comment: http://stackoverflow.com/comment/31515259
tagged with: java
tagged with: rxtx
type: Question
upvote count: 2
downvote count: 0
favorite count: 0
has body: i am not quite good in english, so i will try to be clear for you. I am currently working on a multi-program project. I have written an Arduino Control Program, which allow me to manage a sensor network through commands. For example, I can add sensors by typing the command "add " etc ... I have also write a Java API for micro controller for sensor data collection (it works with every type of micro controllers), which is able to send command file to my micro controller, to get back the received data and store them into a file in a format of my choice (JSON, XML, PostScript, bytecode ...) and can also send it under http header form to an IP address ... I have the following problem : When I send a command from my Java program to my micro controller, the Java program is sometimes not able to receive the command execution response, what makes it crash : Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 Received line : I: Tab cleared. Received line : I: Setup terminated |MicroController.java-&gt;messageReceived|: recieved response : I: Setup terminated Send : add t1 2 3 Received line : I:|Main loop| command received :add t1 2 3 Received line : I:|Main loop| command add t1 2 3 in execution ... Received line : I:|Main loop| command add t1 2 3 executed. Received line : I:|Main loop| return code 0 sent. As you can see, the micro controller sent the return code "0", but the Java didn't received it. I have written my own send() and receive() method : /** * Send message. * * @param str String to send. * * @throws IOException IO error. * @throws InterruptedException */ public void sendMessage(String str) throws IOException, InterruptedException { System.out.println("Send : " + str); // Send the command. output.write(str.getBytes()); output.flush(); } /** * Handle input event on the serial port. * * @param oEvent Event receives. */ private synchronized void processReceivedEvent(SerialPortEvent oEvent) { if (oEven…

http://stackoverflow.com/comment/118063280
type: AnswerComment
has text: Great answer. I've posted a question just now, maybe you'd like to give your two cents? https://stackoverflow.com/questions/66789144/digging-deeper-into-system-currenttimemillis-how-precise-can-we-expect-it-to?noredirect=1#comment118063237_66789144
comment on: http://stackoverflow.com/a/20874295
type: Comment
score: 0

http://stackoverflow.com/comment/31425952
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20928923
has text: That makes it harder. What library are you using to open and play the prerecorded video?
score: 0

http://stackoverflow.com/comment/31465539
comment on: http://stackoverflow.com/a/20950251
type: Comment
type: AnswerComment
has text: people in IRC were complaining about me not initializing booleans (i used them to state, if i already cached a certain thing,which would then stay true after setting it to true)
score: 0

http://stackoverflow.com/q/20894513
type: Question
downvote count: 9
has comment: http://stackoverflow.com/comment/31360743
score: -7
has comment: http://stackoverflow.com/comment/31360819
answer count: 3
has comment: http://stackoverflow.com/comment/31360712
has answer: http://stackoverflow.com/a/20894523
favorite count: 0
has comment: http://stackoverflow.com/comment/31360902
has title: Why isn't my for loop working java?
has answer: http://stackoverflow.com/a/20894554
upvote count: 2
has comment: http://stackoverflow.com/comment/31360684
has answer: http://stackoverflow.com/a/20894533
possible better answer: http://stackoverflow.com/a/20894523
has body: This code doesn't work for some reason in Java: for(i =6; i&lt;9; i++) System.out.println(i); Why isn't this working? Thank you!
has comment: http://stackoverflow.com/comment/31360662
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31360691
has comment: http://stackoverflow.com/comment/31360669
tagged with: java
accepted answer: http://stackoverflow.com/a/20894554

http://stackoverflow.com/q/20996397
tagged with: android-intent
has answer: http://stackoverflow.com/a/20996501
score: 2
has title: Multiple Activities with NDEF_DISCOVERED
tagged with: java
has answer: http://stackoverflow.com/a/21000872
tagged with: ndef
type: Question
answer count: 2
has body: I have two activities in my app that have the same intent filter of "android.nfc.action.NDEF_DISCOVERED", is there any way of telling the activity programaticaly that I want to start a specific activity and not choose which activity to start upon discovery of ndef? To be more clear, one device is running Activity1 and the second device is running Activity2, whenever I beam from one device or another, the device is asking me which activity to start since they both have the same intent filter. here is my manifest: <action android:name="com.example.activity1" /> <category android:name="android.intent.category.DEFAULT" /> <action android:name="android.nfc.action.NDEF_DISCOVERED" /> <category android:name="android.intent.category.DEFAULT" /> <action android:name="com.example.activity2" /> <category android:name="android.intent.category.DEFAULT" /> <action android:name="android.nfc.action.NDEF_DISCOVERED" /> <category android:name="android.intent.category.DEFAULT" />
downvote count: 0
favorite count: 0
tagged with: nfc
upvote count: 2
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/31363073
score: 0
type: Comment
type: AnswerComment
has text: Not everything is public in javascript.
comment on: http://stackoverflow.com/a/20895892

http://stackoverflow.com/q/20861321
score: 0
tagged with: java
has body: This question is regarding pretty-printing with Java and XML. The data itself is stored in XML but I am using Java to manipulate the data. I have the following code 34 21 42 54 I want to insert another ChildElement in between the two existing ChildElement lines. I have no problem actually doing this, but I need to maintain that formatting. If I use transformer.setOutputProperty(OutputKeys.INDENT, "yes"); It will completely reformat the file. If I set that property to "no", it inserts the new , but not on its own line. It comes on the same line as the first . Personally I'd just make both of these values attributes, but I can't change the formatting of the file. Is there a way to insert a new on its own line, but without any other formatting?
type: Question
tagged with: format
tagged with: transformer-model
tagged with: dom
answer count: 1
has answer: http://stackoverflow.com/a/20861797
has comment: http://stackoverflow.com/comment/31297574
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/xml
has title: Custom XML Formatting with Java DOM

http://stackoverflow.com/q/20979844
tagged with: language-agnostic
favorite count: 0
tagged with: pattern-matching
has title: Transformation algorithms for numerical values similar to functionality of Soundex, Metaphone, etc
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/31522108
tagged with: numbers
tagged with: java
type: Question
has body: I'm working on implementing probablistic matching for person record searching. As part of this, I plan to have blocking performed before any scoring is done. Currently, there are a lot of good options for transforming strings so that they can be stored and then searched for, with similar strings matching each other (things like soundex, metaphone, etc). However, I've struggled to find something similar for purely numeric values. For example, it would be nice to be able to block on a social security number and not have numbers that are off or have transposed digits be removed from the results. 123456789 should have blocking results for 123456780 or 213456789. Now, there are certainly ways to simply compare two numerical values to determine how similar they are, but what could I do when there are million of numbers in the database? It's obviously impractical to compare them all (and that would certainly invalidate the point of blocking). What would be nice would be something where those three SSNs above could somehow be transformed into some other value that would be stored. Purely for example, imagine those three numbers ended up as AAABBCCC after this magical transformation. However, something like 987654321 would be ZZZYYYYXX and 123547698 would be AAABCCBC or something like that. So, my question is, is there a good transformation for numeric values like there exists for alphabetical values? Or, is there some other approach that might make sense (besides some highly complex or low performing SQL or logic)?
tagged with: algorithm
accepted answer: http://stackoverflow.com/a/20980449
upvote count: 2
has answer: http://stackoverflow.com/a/20980449
has comment: http://stackoverflow.com/comment/31521939
answer count: 1
downvote count: 0

http://stackoverflow.com/q/20871886
tagged with: eclipse
tagged with: servlets
linked to: http://stackoverflow.com/q/11731377
answer count: 3
score: 3
downvote count: 0
duplicate of: http://stackoverflow.com/q/11731377
has comment: http://stackoverflow.com/comment/31318420
tagged with: tomcat
has answer: http://stackoverflow.com/a/27304559
favorite count: 0
has comment: http://stackoverflow.com/comment/31318086
possible better answer: http://stackoverflow.com/a/27304559
tagged with: http-status-code-404
has answer: http://stackoverflow.com/a/20871913
has answer: http://stackoverflow.com/a/34389370
type: AnsweredQuestion
has body: I have a problem with my simple servlet that I am trying to run, Hello.java. I made it in eclipse, then placed the file it in the webapps/ServletTest/WEB-INF/classes folder and compiled it, creating the file Hello.class in the same folder. I then modified my web.xml file to map the servlet and tried to run it through the following address http://localhost:8080/ServletTest/Hello However, this did not work, giving the following error HTTP Status 404 - type Status report message description The requested resource is not available. Apache Tomcat/7.0.42 The mapping in the web.xml file looks like this: Hello Main.Hello Hello /Hello The code of the servlet: package Main; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet("/Hello") public class Hello extends HttpServlet { private static final long serialVersionUID = 1L; public Hello() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); response.setContentType("text/html"); String path = request.getContextPath(); String ip = request.getRemoteAddr(); out.print(" " + " Hello " + "Hello World"+ " " + "Your ip is: " + ip + " " + "Your path is: " + path + " "); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } }
has title: Getting HTTP Status 404 error when trying to run servlet
has comment: http://stackoverflow.com/comment/31318366
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/20871913
type: Question
has comment: http://stackoverflow.com/comment/31318345

http://stackoverflow.com/comment/31568993
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21005444
has text: Try java.lang.Double.compare()
score: 0

http://stackoverflow.com/a/20892492
score: 2
upvote count: 2
has body: The short answer is no. If you pause the current thread (which according to you is the EDT) then you pause the EDT... You can make requests that the UI be updated using methods like repaint, but this also assumes you are not blocking the EDT with things like loops and pauses, as the EDT will need time to process these requests. And no, I wouldn't follow the link's advice, as it violates the single thread of Swing by updating the components outside of the of EDT Depending on your needs you would either need to use a javax.swing.Timer or SwingWorker. Yes, you can use a Thread, you become responsible for ensuring that all updates to the UI are synced back to the EDT, which the other two suggest provide mechanisms for. Take a look at Concurrency in Swing for more details
accepted answer of: http://stackoverflow.com/q/20892336
answers question: http://stackoverflow.com/q/20892336
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/31441140
type: Comment
has text: the polygon. the origin is (0,0), which is at the top left corner of the graphics. to translate the center to the origin, translate each point by (-centerX,-centerY). since the center was at (centerX,centerY) it is now at (0,0). Rotating will know occur around the center, then to return it to its original position, translate by (centerX,centerY).
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20935965

http://stackoverflow.com/comment/31312995
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20869138
has text: I got it working. Thanks. I was confused by the classes and data types

http://stackoverflow.com/q/20967382
has answer: http://stackoverflow.com/a/20967504
has answer: http://stackoverflow.com/a/20967464
has answer: http://stackoverflow.com/a/20967592
has answer: http://stackoverflow.com/a/20967409
possible better answer: http://stackoverflow.com/a/20967504
has comment: http://stackoverflow.com/comment/31498482
answer count: 8
type: AnsweredQuestion
has body: lets say we have this class without any constructors and instances variables public class ConsoleWriter{ public void write(){ System.out.println("Console Writing..."); } } and you have another class App with 2 variables console and console1 public class App{ ConsoleWriter console; ConsoleWtiter console1=new ConsoleWriter(); } Now I understand that console1 is an object of ConsoleWriter while console is just a reference type to ConsoleWriter. When having such case (No constructors, No instance Variable) what is the difference ? or how would it be useful to create the Object console1 if we could just do it using the console. console.write();//would output Console Writing... console1.write();//would output Console Writing...
tagged with: java
has answer: http://stackoverflow.com/a/20967423
has comment: http://stackoverflow.com/comment/31498139
type: Question
score: 0
has answer: http://stackoverflow.com/a/20967429
favorite count: 0
has answer: http://stackoverflow.com/a/20967431
accepted answer: http://stackoverflow.com/a/20967409
upvote count: 4
downvote count: 4
has title: Difference between Object and Class
has answer: http://stackoverflow.com/a/20967419

http://stackoverflow.com/comment/31276102
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20849809
has text: all objects in java have a built in hashCode method. http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#hashCode()

http://stackoverflow.com/a/20965234
score: 0
type: AcceptedAnswer
type: Answer
has body: Here is a good explanation https://mail.mozilla.org/pipermail/es-discuss/2010-December/012334.html Basically if you were implementing a java library or API you would aim for strong encapsulation, so that users couldn't access things they aren't supposed to. Strong encapsulation means that no one can access secret internal variables because you have a proper inheritance heirachy and all that stuff is hidden. Your example is very weak encapsulation because the variable a is public. If your class was an API and a was actually credit_card_details you would be in big trouble. For starters you would set those variables as private and use getters and setters to access them. Overall though, you need something abstracted in order to encapsulate it. The only other thing I have heard encapsulation refer to from an OOP perspective is simply bundling real world objects into classes
answers question: http://stackoverflow.com/q/20965037
accepted answer of: http://stackoverflow.com/q/20965037

http://stackoverflow.com/a/37050090
type: Answer
answers question: http://stackoverflow.com/q/20915528
has body: You can register multiple different servlet with different ServletRegistrationBean like @Bean in Application class and you can register a servlet has multiple servlet mapping; @Bean public ServletRegistrationBean axisServletRegistrationBean() { ServletRegistrationBean registration = new ServletRegistrationBean(new AxisServlet(), "/services/*"); registration.addUrlMappings("*.jws"); return registration; } @Bean public ServletRegistrationBean adminServletRegistrationBean() { return new ServletRegistrationBean(new AdminServlet(), "/servlet/AdminServlet"); }
score: 22
upvote count: 22
downvote count: 0

http://stackoverflow.com/q/20916126
duplicate of: http://stackoverflow.com/q/12087419
has comment: http://stackoverflow.com/comment/31401508
has comment: http://stackoverflow.com/comment/139980603
has title: Java Calendar Object Date Manipulation
type: AnsweredQuestion
has body: I need to add X no of days to today. So far I have researched most of the questions in stackoverflow and I have tried the following code: GregorianCalendar today = new GregorianCalendar(); today.setTime(Calendar.getInstance().getTime()); today.add(Calendar.DAY_OF_YEAR,100);//I have also tried Calendar.DATE too SimpleDateFormat formatter=new SimpleDateFormat("yyyy-MM-DD"); String currentDate = formatter.format(today.getTime()); System.out.println(currentDate); When I see the Current Date, I see the month is displayed correctly, but the Date is incorrect. In the above example, I am seeing 2014-04-103 as the output. I also want the correct date. Please help. Thanks.
has answer: http://stackoverflow.com/a/20916138
accepted answer: http://stackoverflow.com/a/20916138
downvote count: 2
linked to: http://stackoverflow.com/q/12087419
type: Question
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/31401604
upvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/q/21011143
tagged with: java
has title: HttpPost image in Android
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31580106
has comment: http://stackoverflow.com/comment/31579722
has comment: http://stackoverflow.com/comment/31580600
score: -1
has comment: http://stackoverflow.com/comment/31580235
has body: I am trying to do an HTTP Post to a URL. I followed the code from this answer: http://stackoverflow.com/questions/2935946/sending-images-using-http-post All HttpComponent libraries has been successfully included to my project. However i am getting this error when testing the code on the phone: 01-09 10:27:53.773: E/AndroidRuntime(4473): FATAL EXCEPTION: main 01-09 10:27:53.773: E/AndroidRuntime(4473): java.lang.NoClassDefFoundError: org.apache.http.entity.ContentType 01-09 10:27:53.773: E/AndroidRuntime(4473): at org.apache.http.entity.mime.content.FileBody.&lt;init&gt;(FileBody.java:85) 01-09 10:27:53.773: E/AndroidRuntime(4473): at com.gelliesmedia.thumbqoo.services.HttpContentPost.sendPost(HttpContentPost.java:36) 01-09 10:27:53.773: E/AndroidRuntime(4473): at com.gelliesmedia.thumbqoo.ProductPublishActivity$4.onClick(ProductPublishActivity.java:224) 01-09 10:27:53.773: E/AndroidRuntime(4473): at android.view.View.performClick(View.java:4204) 01-09 10:27:53.773: E/AndroidRuntime(4473): at android.view.View$PerformClick.run(View.java:17355) 01-09 10:27:53.773: E/AndroidRuntime(4473): at android.os.Handler.handleCallback(Handler.java:725) 01-09 10:27:53.773: E/AndroidRuntime(4473): at android.os.Handler.dispatchMessage(Handler.java:92) 01-09 10:27:53.773: E/AndroidRuntime(4473): at android.os.Looper.loop(Looper.java:137) 01-09 10:27:53.773: E/AndroidRuntime(4473): at android.app.ActivityThread.main(ActivityThread.java:5041) 01-09 10:27:53.773: E/AndroidRuntime(4473): at java.lang.reflect.Method.invokeNative(Native Method) 01-09 10:27:53.773: E/AndroidRuntime(4473): at java.lang.reflect.Method.invoke(Method.java:511) 01-09 10:27:53.773: E/AndroidRuntime(4473): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 01-09 10:27:53.773: E/AndroidRuntime(4473): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 01-09 10:27:53.773: E/AndroidRuntime(4473): at dalvik.system.NativeStart.main(Native Method) This is my Code: @SuppressW…
answer count: 2
tagged with: http-post
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21011648
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31579807
tagged with: android
has answer: http://stackoverflow.com/a/21011342
tagged with: image-uploading
has comment: http://stackoverflow.com/comment/31580529
linked to: http://stackoverflow.com/q/2935946

http://stackoverflow.com/q/20938095
has body: I'm playing with lambdas in Java 8 and I came across warning local variables referenced from a lambda expression must be final or effectively final. I know that when I use variables inside anonymous class they must be final in outer class, but still - what is the difference between final and effectively final?
downvote count: 0
has answer: http://stackoverflow.com/a/41305318
has answer: http://stackoverflow.com/a/77028149
favorite count: 0
has comment: http://stackoverflow.com/comment/31575967
linked to: http://stackoverflow.com/q/4732544
has answer: http://stackoverflow.com/a/52776382
has answer: http://stackoverflow.com/a/20938132
has answer: http://stackoverflow.com/a/20938195
has answer: http://stackoverflow.com/a/50014052
answer count: 15
has comment: http://stackoverflow.com/comment/49555462
has answer: http://stackoverflow.com/a/44475074
has answer: http://stackoverflow.com/a/25650441
tagged with: inner-classes
tagged with: final
has title: Difference between final and effectively final
tagged with: lambda
tagged with: java-8
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20940888
linked to: http://stackoverflow.com/q/4279420
has answer: http://stackoverflow.com/a/20938364
has answer: http://stackoverflow.com/a/33726267
has comment: http://stackoverflow.com/comment/54155480
has answer: http://stackoverflow.com/a/20940888
has answer: http://stackoverflow.com/a/34137804
accepted answer: http://stackoverflow.com/a/20938132
tagged with: java
has answer: http://stackoverflow.com/a/62397646
score: 398
has answer: http://stackoverflow.com/a/53318765
upvote count: 398
has answer: http://stackoverflow.com/a/32123550

http://stackoverflow.com/comment/31383690
has text: You are trying to get only Pass or Fail out of a file containing a lot of those lines?
score: 1
comment on: http://stackoverflow.com/q/20907243
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31554362
has text: Have looked your another question. I'am not familiar with another project types (jar types). But if your child projects will be maven oriented - contain theirs own pom.xml refering to parent/pom.xml, all will be working with eclipse too. Also I not used any of eclipse's git plugins - just cloning to separate folder and importing to workspace.
comment on: http://stackoverflow.com/a/20987134
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/20956248
type: Question
has answer: http://stackoverflow.com/a/20956549
has answer: http://stackoverflow.com/a/20956328
score: 0
has answer: http://stackoverflow.com/a/20956436
has body: After make connection check by DomenK i've got next errors and my try catch block look like this: try { if (isNetworkAvailable(getApplicationContext())) updateJSONdata(); } catch (Exception ex) { Toast.makeText(getApplicationContext(), "shit happens", Toast.LENGTH_SHORT).show(); finish(); } 01-06 19:24:41.221: E/AndroidRuntime(2174): FATAL EXCEPTION: main 01-06 19:24:41.221: E/AndroidRuntime(2174): java.lang.NullPointerException 01-06 19:24:41.221: E/AndroidRuntime(2174): at com.flex.sklepik.ReadComments.updateList(ReadComments.java:253) 01-06 19:24:41.221: E/AndroidRuntime(2174): at com.flex.sklepik.ReadComments$LoadComments.onPostExecute(ReadComments.java:317) 01-06 19:24:41.221: E/AndroidRuntime(2174): at com.flex.sklepik.ReadComments$LoadComments.onPostExecute(ReadComments.java:1) 01-06 19:24:41.221: E/AndroidRuntime(2174): at android.os.AsyncTask.finish(AsyncTask.java:417) 01-06 19:24:41.221: E/AndroidRuntime(2174): at android.os.AsyncTask.access$300(AsyncTask.java:127) 01-06 19:24:41.221: E/AndroidRuntime(2174): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429) 01-06 19:24:41.221: E/AndroidRuntime(2174): at android.os.Handler.dispatchMessage(Handler.java:99) 01-06 19:24:41.221: E/AndroidRuntime(2174): at android.os.Looper.loop(Looper.java:130) 01-06 19:24:41.221: E/AndroidRuntime(2174): at android.app.ActivityThread.main(ActivityThread.java:3701) 01-06 19:24:41.221: E/AndroidRuntime(2174): at java.lang.reflect.Method.invokeNative(Native Method) 01-06 19:24:41.221: E/AndroidRuntime(2174): at java.lang.reflect.Method.invoke(Method.java:507) 01-06 19:24:41.221: E/AndroidRuntime(2174): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866) 01-06 19:24:41.221: E/AndroidRuntime(2174): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624) 01-06 19:24:41.221: E/AndroidRuntime(2174): at dalvik.system.NativeStart.main(Native Method) My app works very well but when internet connection is broke while Async is w…
has title: AsyncTask doInBackground returning a nullpointerexception when internet connection is failed
tagged with: android-asynctask
has answer: http://stackoverflow.com/a/20956637
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20956552
tagged with: android
tagged with: android-intent
tagged with: java

http://stackoverflow.com/comment/31567121
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20990216
has text: @supercat It looks like it is enough just to return something when you implement the interface. The type of you return is substituted.

http://stackoverflow.com/comment/31556320
has text: Thanks but I don't see how that question would help this case. It's a NullPointerException
comment on: http://stackoverflow.com/q/20998930
score: 0
type: Comment
type: QuestionComment

wrapper
tags question: http://stackoverflow.com/q/20858203
tag name: wrapper
type: Tag

http://stackoverflow.com/comment/31367712
score: 2
type: QuestionComment
has text: The XHTML that you are asking it to parse "helloworld" is not a true XHTML text. Try wrapping it in XHTML tags. It is the close that is failing.
comment on: http://stackoverflow.com/q/20898322
type: Comment

http://stackoverflow.com/comment/31447246
score: 0
type: AnswerComment
has text: Not necessarily, you could store the results in an array. See another snippet I've added. But in general because of the 2D aspect you are going to have a nested loop. Either that or hard code it somehow like you are suggesting.
type: Comment
comment on: http://stackoverflow.com/a/20939879

http://stackoverflow.com/q/20876046
has body: I was having an issue with an embedded applet I've been working on for a while now. The applet's jar is signed and all-permissions are granted, and it runs perfectly fine in the applet viewer. When loaded in the browser there is only a blank box with an error logo where my applet should be. When clicked it returns "java.lang.invocationtargetexception". I am using a basic HTML format to embed the applet. Here is the HTML Code I am using to display it: Back to the index Web Forum Forums Chatbox Coming Soon And here is the Java console dump thread list: Dump thread list ... Group main,ac=19,agc=2,pri=10 main,5,alive traceMsgQueueThread,5,alive,daemon Timer-0,5,alive AWT-Shutdown,5,alive AWT-Windows,6,alive,daemon Java Plug-In Pipe Worker Thread (Client-Side),5,alive,daemon AWT-EventQueue-0,6,alive SysExecutionTheadCreator,5,alive,daemon MemoryCache-DelayedCleanup,5,alive,daemon CacheMemoryCleanUpThread,5,alive,daemon Browser Side Object Cleanup Thread,5,alive JVM[id=1]-Heartbeat,5,alive,daemon Group Plugin Thread Group,ac=4,agc=0,pri=10 AWT-EventQueue-1,6,alive Image Fetcher 0,8,alive,daemon TimerQueue,5,alive,daemon SysExecutionThead,5,alive,daemon Group http://25.2.202.42/-threadGroup,ac=4,agc=0,pri=4 Applet 1 LiveConnect Worker Thread,4,alive AWT-EventQueue-2,4,alive TimerQueue,4,alive,daemon ConsoleTraceListener,4,alive,daemon Done. Here is the signed jar's manifest: Manifest-Version: 1.0 Name: .classpath SHA-256-Digest: IhqMeyTH+t/Wtxr+NP6B1f5GapLwQ67HJhYQ7UM+kA0= Name: .project SHA-256-Digest: Lw9C+yAb3p1vC6m2pwcjhv8TB1ET8xOYjM2sFlgIjIw= Permissions: all-permissions Codebase: http://25.2.202.42/ I see no reason the error would be resulting form my code itself, but here it is just incase: import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.applet.*; import java.io.*; @SuppressWarnings("serial") public class Topics extends Applet { String name; String topics; String paragraphs; //reading file for existing posts String fileread = "Topics.tx…
linked to: http://stackoverflow.com/q/5621338
has comment: http://stackoverflow.com/comment/31328424
has answer: http://stackoverflow.com/a/20877401
answer count: 1
tagged with: applet
has comment: http://stackoverflow.com/comment/31412976
tagged with: security
tagged with: http://stackoverflow.com/tag/html
has title: Web Forum Applet works in applet viewer but not in browser
linked to: http://stackoverflow.com/q/17874717
type: UnansweredQuestion
score: 0
tagged with: file
tagged with: java
type: Question

http://stackoverflow.com/comment/31309700
type: Comment
comment on: http://stackoverflow.com/a/20867470
type: AnswerComment
score: 0
has text: No, this is not what I asked. I don't want to pass a class. I want to get the name of the class of `*this`. i.e. I want subtype polymorphism here.

http://stackoverflow.com/comment/31500330
has text: So there is no way I can get the heap dump in this version ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20968468
type: Comment

http://stackoverflow.com/comment/31393475
has text: Yeah I couldn't before due to not enough reputation.
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20911545

http://stackoverflow.com/q/20974642
tagged with: maven
has body: Is there a possibility to compile in a maven project 2 modules concurrently, if they don't have mutual dependency? (Java) Example: I have a pom.xml (project) which has 3 modules - A, B and C. C is dependent on B. B and A are not dependent on anything. So, when drawing the dependency DAG, it seems that we have 2 roots: A and B. Can we run maven in such a concurrent way, that A and B will start concurrently, and C will be started after compilation of B?
has answer: http://stackoverflow.com/a/20974758
type: AnsweredQuestion
has title: maven java compilation: is there concurrent mode?
tagged with: java
duplicate of: http://stackoverflow.com/q/581465
type: Question
linked to: http://stackoverflow.com/q/581465
answer count: 1
accepted answer: http://stackoverflow.com/a/20974758
score: 0
has comment: http://stackoverflow.com/comment/31511743

http://stackoverflow.com/comment/31510180
type: QuestionComment
comment on: http://stackoverflow.com/q/20973786
has text: You should have a look at `JFreeChart` and `iText`. That's the route I'd go
score: 1
type: Comment

http://stackoverflow.com/comment/31363644
type: Comment
has text: @Makoto I see what you mean now. I'm following along with a book, so hopefully that will come up.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20896204

postorder
type: Tag
tag name: postorder
tags question: http://stackoverflow.com/q/20921287

http://stackoverflow.com/comment/31411921
comment on: http://stackoverflow.com/a/20921737
type: AnswerComment
type: Comment
score: 1
has text: Now I get it! Thank you! Works perfectly! :)

http://stackoverflow.com/comment/31412393
type: AnswerComment
has text: I have one more question, instead of using Set can't I use an ArrayList..and if not why so?
score: 0
comment on: http://stackoverflow.com/a/20921181
type: Comment

http://stackoverflow.com/comment/31473205
comment on: http://stackoverflow.com/q/20954228
type: Comment
type: QuestionComment
has text: [Read this link](http://stackoverflow.com/questions/7229226/should-i-avoid-the-use-of-setpreferredmaximumminimumsize-methods-in-java-swi)
score: 0

http://stackoverflow.com/q/20866466
has answer: http://stackoverflow.com/a/20876015
has comment: http://stackoverflow.com/comment/31307705
has answer: http://stackoverflow.com/a/20866815
type: UnansweredQuestion
has body: Till now we are using myeclipse to for development. Now we started development using eclipse keplar. My first problem is jars are not deployed in webapps lib directory which we solved by referring [link] Adding 3rd party jars to WEB-INF/lib automatically using Eclipse/Tomcat but every time if want to add third party jar's dependency then we have to add in build path and Deployment Assembly so please let me know if there is any workaround to add entry only in build path and this jar is automatically deployed in tomcat directory. Thanks in advance.
tagged with: myeclipse
tagged with: eclipse-kepler
linked to: http://stackoverflow.com/q/5467038
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31307704
linked to: http://stackoverflow.com/q/19179687
has comment: http://stackoverflow.com/comment/31307581
tagged with: eclipse
has answer: http://stackoverflow.com/a/20866580
score: 0
has title: jars are not automatically deploy in tomcat using eclipse keplar
answer count: 3

http://stackoverflow.com/comment/31283458
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20854108
has text: How would I apply generics for my simple case?

http://stackoverflow.com/q/20897662
has body: I want to implement encrypt and decrypt operation for some String values. I have encrypted properly but I don't understand how to decrypt this value like: jsonString Values ={"Response":"NJGOkF2EvOIpfKG14LHQZrVfj\/OEJvopi+OKU+q5G2ynDbVUnIckfMLGCCsxcY9+BmVg+KJXF1ls\nGf2rWg73iyowyq6THyDfBS8uZnSp9PfS3bJCFb6YWX4\/\/uxjDwtZ","statusFlag":"true"} When I decrypt, I am getting NumberFormatException. Here is my simple Crypto class import java.security.SecureRandom; import javax.crypto.Cipher; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; public class SimpleCrypto { public static String encrypt(String seed, String cleartext) throws Exception { byte[] rawKey = getRawKey(seed.getBytes()); byte[] result = encrypt(rawKey, cleartext.getBytes()); return toHex(result); } public static String decrypt(String seed, String encrypted) throws Exception { byte[] rawKey = getRawKey(seed.getBytes()); byte[] enc = toByte(encrypted); byte[] result = decrypt(rawKey, enc); return new String(result); } private static byte[] getRawKey(byte[] seed) throws Exception { KeyGenerator kgen = KeyGenerator.getInstance("AES"); SecureRandom sr = SecureRandom.getInstance("SHA1PRNG"); sr.setSeed(seed); kgen.init(128, sr); // 192 and 256 bits may not be available SecretKey skey = kgen.generateKey(); byte[] raw = skey.getEncoded(); return raw; } private static byte[] encrypt(byte[] raw, byte[] clear) throws Exception { SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.ENCRYPT_MODE, skeySpec); byte[] encrypted = cipher.doFinal(clear); return encrypted; } private static byte[] decrypt(byte[] raw, byte[] encrypted) throws Exception { SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.DECRYPT_MODE, skeySpec); byte[] decrypted = cipher.doFinal(encrypted); return decrypted; } public static String toHex(String txt) { return toH…
tagged with: aes
score: 2
has comment: http://stackoverflow.com/comment/31366107
has answer: http://stackoverflow.com/a/21075369
upvote count: 3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31763262
tagged with: encryption
has answer: http://stackoverflow.com/a/21111932
has comment: http://stackoverflow.com/comment/31739315
downvote count: 1
has answer: http://stackoverflow.com/a/21014878
has answer: http://stackoverflow.com/a/20897886
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/140131
has title: Unable to parse as integer in Android
answer count: 7
has answer: http://stackoverflow.com/a/20897817
tagged with: number-formatting
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/21013617
has answer: http://stackoverflow.com/a/21058934

http://stackoverflow.com/q/20862558
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20862988
tagged with: valueconverter
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31300442
tagged with: java
has answer: http://stackoverflow.com/a/20864755
has comment: http://stackoverflow.com/comment/31300384
type: Question
has answer: http://stackoverflow.com/a/20862583
linked to: http://stackoverflow.com/q/12559177
has comment: http://stackoverflow.com/comment/31300446
linked to: http://stackoverflow.com/q/38922754
has title: Add colon to 24 hour time in Java?
tagged with: date
has answer: http://stackoverflow.com/a/20864779
tagged with: datetime-format
has comment: http://stackoverflow.com/comment/31300506
upvote count: 1
answer count: 7
has body: I have a date in the format MM/DD/YYYY and time in the format HHMM (24 hour time w/o the colon). Both of these strings are in an array. I would like to store this as one string - maybe something like "MM-DD-YYYY HH:MM" - and then be able to convert it to a written date like "January 1, 2014 16:15" when I am showing it to the user. How can I do this? This is the code that I have: String date = "05/27/2014 23:01"; Date df = new SimpleDateFormat("MM/DD/YYYY HH:mm").parse(date); System.out.println(df); However this is what I get: "Sun Dec 29 23:01:00 EST 2013" The output I am looking for is: "December 29, 2013 23:01"
has answer: http://stackoverflow.com/a/20862986
has comment: http://stackoverflow.com/comment/31300423
has comment: http://stackoverflow.com/comment/31300483
favorite count: 0
has answer: http://stackoverflow.com/a/20863038
has answer: http://stackoverflow.com/a/67449256
tagged with: time

http://stackoverflow.com/a/20956030
type: Answer
answers question: http://stackoverflow.com/q/20955353
score: 0
has body: Try to learn How to debug errors, you can read the stacktrace and also run the application through debugger. Read from top to bottom, you will find what actually happened. 01-06 16:50:37.863: E/AndroidRuntime(490): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.knight.baseproject/com.knight.baseproject.com.knight.baseproject.MENU}: java.lang.ClassNotFoundException: com.knight.baseproject.com.knight.baseproject.MENU in loader dalvik.system.PathClassLoader[/data/app/com.knight.baseproject-2.apk] 01-06 16:50:37.863: E/AndroidRuntime(490): Caused by: java.lang.ClassNotFoundException: com.knight.baseproject.com.knight.baseproject.MENU in loader dalvik.system.PathClassLoader[/data/app/com.knight.baseproject-2.apk] if you read it properly, you would find that an exception occured "ClassNotFoundException" because it couldn't find the class. I think it's because you didn't add your Activity in your AndroidManifest.xml, whatever activity you use in application should be defined in the manifest file. It would be great if you could post your code &amp; manifest.

http://stackoverflow.com/comment/31354137
type: AnswerComment
has text: So if the method command.execute does not respond future.get(10, TimeUnit.SECONDS); throws TimeoutException (if the wait timed out) or ExecutionException (if the computation threw an exception). Is it ok?:)
comment on: http://stackoverflow.com/a/20890503
score: 0
type: Comment

http://stackoverflow.com/q/20853675
has comment: http://stackoverflow.com/comment/31282826
has answer: http://stackoverflow.com/a/20853728
has title: Fail to read embedded resources
has comment: http://stackoverflow.com/comment/31282774
tagged with: embedded-resource
possible better answer: http://stackoverflow.com/a/20853728
has comment: http://stackoverflow.com/comment/31282732
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31282846
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20853867
accepted answer: http://stackoverflow.com/a/20853867
has body: I want to embed a txt file into runnable jar and read it. I tried using this code Reader reader = new InputStreamReader(getClass().getResourceAsStream("/src/kan/master_ship.txt"),"UTF-8"); But it gives java.lang.NullPointerException at java.io.Reader.&lt;init&gt;(Unknown Source) at java.io.InputStreamReader.&lt;init&gt;(Unknown Source) at kan.util.Master.loadMasterShip(Master.java:37) at kan.util.Master.load(Master.java:26) at kan.Main.main(Main.java:22) And it was in the eclipse debug environment. Any help? After that I tried to export it as runnable jar, and it works. But I cannot switch the code for debug and export each time. It should be in this way!
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31282835

http://stackoverflow.com/a/20975297
has comment: http://stackoverflow.com/comment/31514116
has comment: http://stackoverflow.com/comment/31520683
score: 0
type: Answer
has body: You are trying to access the lazy collections outside of a transaction. You can either annotate the relevant method with @Transactional or use fetch joins: SELECT e FROM Event AS e LEFT JOIN FETCH e.attendingUsers ... Working inside a transaction is generally preferable, since you fetch the related entities only if you need to. EDIT: the Exception probably originates from the if clause in the 'unattend' method, where you access the lists: e.getAttendingUsers(). I would move it from the controller into a transactional service, like the EventService.
has comment: http://stackoverflow.com/comment/31513267
has comment: http://stackoverflow.com/comment/31514316
answers question: http://stackoverflow.com/q/20974860

http://stackoverflow.com/a/20983954
has body: The below code is what finally made it work for me. White space was causing a lot of my problems. List&lt;String&gt; listA = new ArrayList&lt;String&gt;(); listA.add("Please Select...\nDEP900\nDEP800\nDEP700\nDEP600\nDEP400\nDEP300\nDEP200\nDEP100\nDEP500\nDEP1000"); System.out.println(listA); List&lt;String&gt; listB = new ArrayList&lt;String&gt;(); List&lt;Element&gt; options = driver.getElements(AppObjects.Basic1_Dropdown); for(Element opt : options){ String actualtext = opt.getText(); listB.add(actualtext); System.out.println(listB); } Assert.assertEquals(listB, listA);
answers question: http://stackoverflow.com/q/20982781
score: 0
type: Answer

http://stackoverflow.com/comment/31589720
type: Comment
type: QuestionComment
has text: is clicker a activity?
comment on: http://stackoverflow.com/q/21017031
score: 0

http://stackoverflow.com/comment/31384344
type: Comment
type: QuestionComment
has text: On another topic, "But OpenSCAD lacks expressive power. There is no storage of shapes as variables -- everything has to be written as a function.". Well, few functional programming languages have variables, but they're still pretty powerful!
comment on: http://stackoverflow.com/q/20907386
score: 0

http://stackoverflow.com/comment/31458578
has text: That's my point: the builder is not thread-safe, and it's not a problem, because it's usually not shared between threads.
type: Comment
comment on: http://stackoverflow.com/a/20940894
score: 4
type: AnswerComment

http://stackoverflow.com/a/20908197
has comment: http://stackoverflow.com/comment/31386389
has body: Easy, simply use String.format: public static void main(String[] args) throws InterruptedException { final int i = 7; final String s = String.format("%32s", Integer.toBinaryString(i)).replace(' ', '0'); System.out.println(s); } The first bit - String.format("%32s", Integer.toBinaryString(i)) - formats the int as a binary String which is padded from the start to 32 characters. The second bit - replace(' ', '0') - replaces the leading spaces with zeros.
upvote count: 2
answers question: http://stackoverflow.com/q/20907872
has comment: http://stackoverflow.com/comment/31386507
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/q/20887317
has body: I need to display an error message and NOT change value of a spinner if user types a value outside of the bounds. If the spinner buttons are used there is no issue. But if user types a number lower than lower bound, the spinner automatically sets it to the lower bound value. Which may be good BUT I need to make sure user is aware. SpinnerNumberModel spin = new SpinnerNumberModel(10, 10, 100, 5); mySpin = new JSpinner(); mySpin.setModel(spin); If user types in 3 the spinner will get set to 10. But I need to confirm with user that this is what he wants. EDIT 1 I coded up TIM B's suggestion. I get the JOptionPane when I change value with spinner buttons. But it does not get triggered if I edit the field manually. import javax.swing.JOptionPane; import javax.swing.SpinnerNumberModel; public class MySpinnerNumberModel extends SpinnerNumberModel{ public MySpinnerNumberModel(int def, int start, int end, int increment){ this.setValue(def); this.setMinimum(start); this.setMaximum(end); this.setStepSize(increment); } public void setValue(Object value) { JOptionPane.showMessageDialog(null,"VALUE: "+value); super.setValue(value); if (value instanceof Integer) { int v = (Integer)value; //JOptionPane.showMessageDialog(null,"VALUE: "+v); // Check v here and act as appropriate } } public static void main(String[] args) { // TODO Auto-generated method stub } }
type: UnansweredQuestion
has title: How can I inform a user that the value he's entered has been constrained to the JSpinner lower bound?
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/20887453
has comment: http://stackoverflow.com/comment/31376784
tagged with: jspinner
tagged with: java
score: 0
answer count: 1

http://stackoverflow.com/comment/31568458
type: QuestionComment
has text: That's a great idea, please see my edit.
score: 0
comment on: http://stackoverflow.com/q/21004983
type: Comment

http://stackoverflow.com/a/20881003
accepted answer of: http://stackoverflow.com/q/20880666
type: Answer
answers question: http://stackoverflow.com/q/20880666
has body: char is a primitive data type while String is a class. If you need to store just 1 character, using a char is always better as it would consume lesser memory also using a String to store 1 character is just unrequired as every String also has a lot of methods that are kind of irrelevant for a single character. So, if it is just 1 character that you need to store, using a char is far better choice for the following reasons. String would need to create an object to store the char, while char is a primitive type and no such objects are created. Lesser memory and faster processing. Also, char type can be used with arithmetic operators like + and -. So, use char when you only need to store a character and don't need any String methods and use String when there is more than 1 character to deal with. Read here for more details
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/31283018
score: 0
type: Comment
type: QuestionComment
has text: This question is too localized.
comment on: http://stackoverflow.com/q/20853856

http://stackoverflow.com/comment/31327422
type: AnswerComment
has text: Thanks a lot for this simple solution.
type: Comment
comment on: http://stackoverflow.com/a/20874242
score: 0

http://stackoverflow.com/comment/58618926
type: Comment
has text: BAT - file will not send text back to the Google chrome. this is wrong and many people will waste time doing this way. please post how to run the jar straight from the json.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/32480134

http://stackoverflow.com/a/21014436
type: Answer
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/20998019
has body: Override the isResizable method of org.eclipse.jface.dialogs.Dialog: @Override protected boolean isResizable() { return true; }

http://stackoverflow.com/comment/83143348
type: Comment
has text: 4 years ago... I learned a lot.
comment on: http://stackoverflow.com/a/20869452
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31377357
has text: We have way to few code to tell you what the problem is. Give us at least `calculateAmmo`. You might be stuck in an infinite loop. Or the behavior tree has a dead end.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20903991
score: 1

http://stackoverflow.com/comment/31528431
type: AnswerComment
comment on: http://stackoverflow.com/a/20983051
type: Comment
has text: I've updated the answer. How is java started when you start it from the terminal?
score: 0

http://stackoverflow.com/q/20940567
has body: So I am obviously missing something completely obvious here. I have a button and an actionlistener hooked up to it. When I click the button, I want run an if statement that takes the contents of a TextArea and compares it to a String. Like So: String a = "hello"; JTextArea area = new JTextArea("type something"); JButton button = new JButton("Go"); button. [insert actionlistener crap] //here's the important part: if (area.getText() == "hello"){ //this will not be executed } It's really weird. I even went through the debugger and at that if statement, both of those items are "hello". But it skips over it! What am I doing wrong? EDIT: a lot of you are saying "use .equals". Can anyone tell me why?
has answer: http://stackoverflow.com/a/20940583
has answer: http://stackoverflow.com/a/20940605
has answer: http://stackoverflow.com/a/20940578
accepted answer: http://stackoverflow.com/a/20940586
duplicate of: http://stackoverflow.com/q/513832
has title: Why can't I compare text from a TextArea to a String?
type: AnsweredQuestion
tagged with: java
upvote count: 1
downvote count: 1
type: Question
tagged with: jbutton
tagged with: jtextarea
has answer: http://stackoverflow.com/a/20940577
tagged with: if-statement
has answer: http://stackoverflow.com/a/20940586
possible better answer: http://stackoverflow.com/a/20940577
score: 0
tagged with: string
favorite count: 0
linked to: http://stackoverflow.com/q/513832
answer count: 5

http://stackoverflow.com/comment/31462274
comment on: http://stackoverflow.com/a/20948568
score: 0
type: Comment
has text: 'http://localhost:8080/WeighPro/CommPortSample' When i m entering this URL it's showing me the output! From Main method I m actually passing a value to the servlet,from servlet the same value has to be passed to the index.jsp page using request.setAttribute. So from Main method can I invoke a servlet which do the dispatcher in the browser.
type: AnswerComment

http://stackoverflow.com/q/20860269
favorite count: 0
tagged with: ajax
has body: In a one page a have a link to download a file like \myapp\controller\file?id=45 In controller have InputStream stream = null; byte [] buffer =someService.getFile(somedata); stream = new ByteArrayInputStream(buffer); System.out.println("get file---"); response.addHeader("Content-Disposition","attachment; filename=report.pdf"); try { IOUtils.copy(stream, response.getOutputStream()); System.out.println("get file---OK"); } catch (Exception e) { e.printStackTrace(); } This work well, but in another page $.ajax({ type: 'POST', url: '${url}', data: {sdate: $('#date').val() }, success: function (data) { alert(data) }, error:function (xhr, ajaxOptions, thrownError) { console.log("in error"); } }); In console ever say get file--- get file---OK but the browser does nothing. I add in succes alert(data) to debug, it shows the binary content of PDF file like: %PDF-1.4 %���� 3 0 obj &lt;>stream x�͝O�$�q���)ޑ:��U]���E�d�A��1^h��ǃ\nS��#��������?���X+��RI��J����Y�r��F�? Now, how explorer understand is a file to download? For lack of permits, i can not save files server side
tagged with: spring
has answer: http://stackoverflow.com/a/20860355
upvote count: 2
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/20860355
type: Question
has title: I can not download file via ajax in spring mvc without save file in server
duplicate of: http://stackoverflow.com/q/13519058
has comment: http://stackoverflow.com/comment/111894738
score: 2
answer count: 1
downvote count: 0
tagged with: jquery

http://stackoverflow.com/q/20940488
has answer: http://stackoverflow.com/a/20940530
has answer: http://stackoverflow.com/a/20940531
tagged with: java
has title: How to subtract one date from an array of dates?
tagged with: date
type: Question
has comment: http://stackoverflow.com/comment/31451182
tagged with: arrays
accepted answer: http://stackoverflow.com/a/20942535
score: 0
has answer: http://stackoverflow.com/a/20940604
possible better answer: http://stackoverflow.com/a/20940530
has answer: http://stackoverflow.com/a/20942535
answer count: 4
tagged with: time
has body: So, I have an array of dates that I asked for from the user. I want to do a days elapsed function to delete certain entries by checking the days elapsed. This wouldn't be too bad with only one date but I can't figure out how to do this with an array of dates unfortunately. It is possible I am overlooking something basic as I am a beginner. int[] dates; int time; int long; Date now = new Date(); time = (int) (new Date().getTime() / 1000L); diff = dates - time; This last line of code is clearly incorrect and gave me an error. What do I do to correct this? Thanks for putting up with a noobie.
type: AnsweredQuestion

http://stackoverflow.com/comment/31360382
has text: Three decades of multithread development, and I've never asked this question, of myself or others. If you don't know, why not?
comment on: http://stackoverflow.com/q/20891386
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31408485
type: AnswerComment
comment on: http://stackoverflow.com/a/20920084
has text: Shouldn't you do `actualOccurences / possibleOccurences`?
type: Comment
score: 1

http://stackoverflow.com/q/20941549
type: Question
score: 0
has answer: http://stackoverflow.com/a/20941644
answer count: 1
has body: I need to streaming media and video from samba server to android, and I use JCIFS to get inputstream from samba file. But in MediaPlayer only can use fileinputstream.getFD() to play media. mp = new MediaPlayer(); FileInputStream fis = new FileInputStream(convertedFile); mp.setDataSource(fis.getFD()); Toast.makeText(this, "Success, Path has been set", Toast.LENGTH_SHORT).show(); mp.prepare(); mp.start(); I can't getFD() from inputstream so that I need to convert inputstream to fileinputstream... Please give me a suggest, or there hava others solution to streaming media from samba server ? This is my SmbFileInputStream, but it's not equals than fileinputstream SmbFileInputStream f = new SmbFileInputStream(new SmbFile(filePath,auth)); Thanks a lot.
type: UnansweredQuestion
tagged with: android
has title: Android SDK : Can I convert InputStream to FileInputStream?
tagged with: java

http://stackoverflow.com/comment/31513410
comment on: http://stackoverflow.com/a/20975278
score: 0
type: AnswerComment
has text: Great! That helps me a lot : )
type: Comment

http://stackoverflow.com/a/21022711
type: Answer
has comment: http://stackoverflow.com/comment/31615380
has comment: http://stackoverflow.com/comment/31609041
score: 0
has body: While the correct answer is the one by Clockwork-Muse (the cause of the problems is the fact that SimpleDateFormat isn't thread safe) I just wanted to deliver another method of creating a time-only Date object: public static Date getCurrentTimeOnly() { Calendar rightNow = Calendar.getInstance(TimeZone.getTimeZone("UTC")); int hour = rightNow.get(Calendar.HOUR_OF_DAY); int minute = rightNow.get(Calendar.MINUTE); int second = rightNow.get(Calendar.SECOND); int msecond = rightNow.get(Calendar.MILLISECOND); long millisSinceMidnight = (hour * 60 * 60 * 1000) + (minute * 60 * 1000) + (second * 1000) + (msecond); return new Date(millisSinceMidnight); } This method is somewhat more formally correct, i.e. it handles leap-seconds. It doesn't assume, like other methods, that all days since epoch has always had 24*60*60*1000 milliseconds in them. It doesn't however handle the case where the leap second is on the current day.
answers question: http://stackoverflow.com/q/21017502

http://stackoverflow.com/q/20985239
type: Question
tagged with: actionlistener
has title: Can I put an ActionListener on a TextArea?
tagged with: jtextarea
has comment: http://stackoverflow.com/comment/31532200
upvote count: 1
has body: Is there a way I can set a listener for if the TextArea is edited by the user? If that is not possible, can I add one to its focus?
downvote count: 2
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31532444
has comment: http://stackoverflow.com/comment/31532427
has comment: http://stackoverflow.com/comment/31532368
tagged with: swing
accepted answer: http://stackoverflow.com/a/20985270
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31532424
tagged with: java
has comment: http://stackoverflow.com/comment/31532293
score: -1
has answer: http://stackoverflow.com/a/20985270

http://stackoverflow.com/a/21010541
has comment: http://stackoverflow.com/comment/31620965
type: Answer
has comment: http://stackoverflow.com/comment/31579694
has comment: http://stackoverflow.com/comment/31579859
has comment: http://stackoverflow.com/comment/31579170
answers question: http://stackoverflow.com/q/21010192
score: 0
has body: yes you can! I also do it in my application in my springmvc interceptor and it is easy! You need to have a request instance from passed from upper level. (HttpServletRequest request) request.getRemoteAddr(); request.getRemoteUser() please exploit JavaEE, you could get from request instance method.
has comment: http://stackoverflow.com/comment/31579818

http://stackoverflow.com/comment/31363116
type: Comment
type: QuestionComment
has text: @EvanNudd maybe http://stackoverflow.com/questions/3392416/determining-location-of-jvm-executable-during-runtime can help a bit. No actual solution though. If you don't need a specific JVM, you may additionally try invoking `java` without a concrete path, hoping for `java` being in `PATH`.
score: 0
comment on: http://stackoverflow.com/q/20895014

http://stackoverflow.com/q/20985872
has comment: http://stackoverflow.com/comment/31533680
has comment: http://stackoverflow.com/comment/31534570
type: Question
has comment: http://stackoverflow.com/comment/31534958
has comment: http://stackoverflow.com/comment/31533437
tagged with: colors
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/20985952
has body: Quick Question. In the image link below you should be able to see a window and in it a JComboBox. Behind the combo box is a backdrop of light grey, but the color of the JPanel is Dark Gray. How do I make this backdrop transparent? In other words, how to I remove the light grey of the combo box?
tagged with: jcombobox
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31534509
upvote count: 1
tagged with: swing
has title: How to remove the backdrop of a JComboBox?
score: 1
tagged with: java

http://stackoverflow.com/q/20899689
has comment: http://stackoverflow.com/comment/31369498
linked to: http://stackoverflow.com/q/214741
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20899781
answer count: 2
has comment: http://stackoverflow.com/comment/31392348
downvote count: 0
tagged with: heapsort
tagged with: stack-overflow
favorite count: 0
has body: I repeatedly get a StackOverflow error at line marked with ** The stack overflows if I try to sort more than 3 numbers but works for arrays of 3 or less, therefore I do not think there is an infinite recursion. Can someone explain to me why line 246 seems to be the source of the stack overflow? Thanks public static void heapSort(double [] a,int node, int index, boolean upcheck){ if(node &lt; 0){ } else if(node &gt; a.length-index){ } else if(upcheck){ if(!testHeap(a,node,(2*node)+1) || !testHeap(a,node,(2*node)+2) ){ int min = 0; if(a[(2*node)+1] &gt; a[(2*node)+2]){ min = (2*node)+2; } else{ min = (2*node)+1; } switchHeap(a,node,min); ****************************heapSort(a,(node-1)/2,index,true);********************* } } else if(node == (a.length-index-1)/2){ if((2*node)+1 &lt;= a.length-index){ if(testHeap(a,node,(2*node)+1)){ } else{ heapSort(a,(node-1)/2,index,true); } if((2*node)+2 &lt;= a.length-index){ if(testHeap(a,node,(2*node)+2)){ } else{ heapSort(a,(node-1)/2,index,true); } } } switchHeap(a,0,a.length-index); index++; heapSort(a,0,index,false); } else{ if((2*node)+1 &lt;= a.length-index){ if(testHeap(a,node,(2*node)+1)){ } else{ heapSort(a,(node-1)/2,index,true); } heapSort(a,(2*node)+1,index,false); if((2*node)+2 &lt;= a.length-index){ if(testHeap(a,node,(2*node)+2)){ } else{ heapSort(a,(node-1)/2,index,true); } heapSort(a,(2*node)+2,index,false); } } } }//heapSort - method
has answer: http://stackoverflow.com/a/20900542
type: UnansweredQuestion
has title: Heapsort StackOverflow error
upvote count: 1

http://stackoverflow.com/a/20897228
has comment: http://stackoverflow.com/comment/31365438
downvote count: 0
answers question: http://stackoverflow.com/q/20897165
score: 4
has comment: http://stackoverflow.com/comment/31365412
has body: You have to do it one by one: for (Square[] arr: square) for (Square sq : square) sq.someMethod();
type: Answer
upvote count: 4

http://stackoverflow.com/comment/31411378
comment on: http://stackoverflow.com/q/20921589
has text: You don't tell us what you have tried. I feel that your going from one question to the next without understanding of java fundamentals.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/20877795
score: 4
has comment: http://stackoverflow.com/comment/31329305
has body: Escape $ to match $ literally. And backslash(\) should escaped when used in Java string literals. Replace \$+ with \$ unless you mean to match multiple $ like $$$$. "\\$\\d+\\s+(billion|million)" To match $6.2 billion, the regular expression should be modified: "\\$\\d+(\\.\\d+)?\\s+(billion|million)" (billion|million) could be written as [mb]illion as @Keppil suggest.
accepted answer of: http://stackoverflow.com/q/20877781
has comment: http://stackoverflow.com/comment/31329125
upvote count: 4
answers question: http://stackoverflow.com/q/20877781
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31329136
type: Answer

http://stackoverflow.com/a/20852510
has comment: http://stackoverflow.com/comment/31281134
has comment: http://stackoverflow.com/comment/31281014
has comment: http://stackoverflow.com/comment/31281093
has body: According to Java language specification, section 5.6.2, binary numeric promotion is performed on the operands of the numerical comparison operators &lt;, &lt;=, &gt;, and &gt;=. This means that int will be promoted to long before the comparison. When an operator applies binary numeric promotion to a pair of operands, each of which must denote a value that is convertible to a numeric type, the following rules apply, in order: If any operand is of a reference type, it is subjected to unboxing conversion (§5.1.8). Widening primitive conversion (§5.1.2) is applied to convert either or both operands as specified by the following rules: If either operand is of type double, the other is converted to double. Otherwise, if either operand is of type float, the other is converted to float. Otherwise, if either operand is of type long, the other is converted to long. Otherwise, both operands are converted to type int. After the type conversion, if any, value set conversion (§5.1.13) is applied to each operand. Binary numeric promotion is performed on the operands of certain operators: The multiplicative operators *, / and % (§15.17) The addition and subtraction operators for numeric types + and - (§15.18.2) The numerical comparison operators &lt;, &lt;=, >, and >= (§15.20.1) The numerical equality operators == and != (§15.21.1)
upvote count: 1
has comment: http://stackoverflow.com/comment/31280920
has comment: http://stackoverflow.com/comment/31281011
has comment: http://stackoverflow.com/comment/31281228
type: Answer
answers question: http://stackoverflow.com/q/20852412
has comment: http://stackoverflow.com/comment/31281075
has comment: http://stackoverflow.com/comment/31281293
downvote count: 0
score: 1

http://stackoverflow.com/a/21019994
score: 1
answers question: http://stackoverflow.com/q/21018649
downvote count: 0
has body: Please try below. It should work List&lt;WebElement&gt; elements = driver.findElement(By.LinkText("Gmail")) elements.get(0).click().
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/36541295

http://stackoverflow.com/a/21003184
answers question: http://stackoverflow.com/q/21003086
has body: One of the way is to get the URL of a class code source, eg URL r = JdbcTemplate.class.getProtectionDomain().getCodeSource().getLocation(); System.out.println(r); prints file:/D:/.repository/org/springframework/spring-jdbc/3.2.4.RELEASE/spring-jdbc-3.2.4.RELEASE.jar in my project
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21003086
type: Answer
upvote count: 3
score: 3

http://stackoverflow.com/comment/46202918
has text: Could you update with an example of the fix please.
type: QuestionComment
comment on: http://stackoverflow.com/q/20978847
score: 1
type: Comment

http://stackoverflow.com/a/31827945
score: 9
has body: Example for Classifier As a motivation for this element, consider for example a project that offers an artifact targeting JRE 1.8 but at the same time also an artifact that still supports JRE 1.7. The first artifact could be equipped with the classifier jdk18 and the second one with jdk14 such that clients can choose which one to use. Another common use case for classifiers is the need to attach secondary artifacts to the project's main artifact. If you browse the Maven central repository, you will notice that the classifiers sources and javadoc are used to deploy the project source code and API docs along with the packaged class files.
answers question: http://stackoverflow.com/q/20909634
type: Answer
upvote count: 10
downvote count: 1

http://stackoverflow.com/comment/31452615
has text: First, please show a complete traceback, not just the description from the exception. Second, please fix the indentation so this code is actually runnable.
comment on: http://stackoverflow.com/q/20942872
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31512194
score: 0
type: AnswerComment
has text: Thanks buddy. simple question I've asked.. :(
comment on: http://stackoverflow.com/a/20974966
type: Comment

http://stackoverflow.com/comment/31645052
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20948389
has text: This is the only answer to the "why" part of the question that offers something other than "it's the default". However, this answer is not complete because it doesn't address the "how" part of the question. Referencing the responses by others on XX:AutoBoxCacheMax and adding information on how to control the caching behavior on other implementations of the JVM (or indicating which JVM implementations have options to control this behavior) would make this a complete answer.

http://stackoverflow.com/comment/31543450
score: 0
type: Comment
type: AnswerComment
has text: @biti No. Where did you get that from? RMI marshaling is no different from Object Serialization.
comment on: http://stackoverflow.com/a/20966498

http://stackoverflow.com/comment/31455765
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20921253
type: Comment
has text: I have set servlet to be application entry point(instead of `home.jsp`) - `<welcome-file>` in `web.xml`. So, i set certain attributes to request inside servlet and forwards to `home.jsp`. Thank you for your replies.

http://stackoverflow.com/a/79376732
answers question: http://stackoverflow.com/q/20992496
upvote count: 1
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/139981494
has body: tl;dr ChronoUnit.MONTHS.between ( LocalDate.parse ( "1960-11-11" ) , LocalDate.parse ( "1986-04-02" ) ) java.time In modern Java, use the java.time classes for all your date-time work. For a date-only value, use java.time.LocalDate class. LocalDate first = LocalDate.parse ( "1960-11-11" ) ; LocalDate second = LocalDate.parse ( "1986-04-02" ) ; Calculate months elapsed as a Period. Period period = Period.between ( first , second ) ; long months = period.toTotalMonths() ; if ( months > 12 ) { … handle expiration … } Or calculate just the months elapsed using ChronoUnit.MONTHS enum object. long months = ChronoUnit.MONTHS.between ( first , second ) ; if ( months > 12 ) { … handle expiration … }

http://stackoverflow.com/comment/31481825
type: Comment
score: 0
has text: No. Right click the project name in Package explorer and click Properties. On the left side, select Java Build path. Now the fourth tab is "Order and Export"
type: AnswerComment
comment on: http://stackoverflow.com/a/20955621

http://stackoverflow.com/comment/31583300
has text: All these questions, looks like a design problem, just think on parameters that each method needs, and do the aproppriate changes to your code.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21012989
type: AnswerComment

http://stackoverflow.com/comment/31445542
score: 1
comment on: http://stackoverflow.com/q/20939206
has text: And where in the code is the said array?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20950358
type: Answer
has comment: http://stackoverflow.com/comment/31466359
has body: int y = x.getInt(x); This is actually wrong and doesn't make any sense. The JavaDoc of Field.getInt says the following: Parameters: obj - the object to extract the int value from Returns: the value of the field converted to type int A Field is "globally" defined for a class. If you want to access a value of a field of a certain instance of that class, then you need to supply that instance to the getField(Object) method. It even goes further and says: Throws: IllegalArgumentException - if the specified object is not an instance of the class or interface declaring the underlying field (or a subclass or implementor thereof), or if the field value cannot be converted to the type int by a widening conversion. NullPointerException - if the specified object is null and the field is an instance field. So you cannot provide null as it was suggested in the comments, unless the field is a static field. You can also not use the field itself (x) as the parameter, since it is not an instance of that class. In your specific case, when a field is defined within an interface, all fields become static final automatically. Thus you can provide null as the parameter, because there is no further information needed. But since this method of Field can also be used in other cases (non-static ones), there needs to be this parameter.
has comment: http://stackoverflow.com/comment/31466069
upvote count: 2
has comment: http://stackoverflow.com/comment/31466315
score: 2
accepted answer of: http://stackoverflow.com/q/20950217
answers question: http://stackoverflow.com/q/20950217
has comment: http://stackoverflow.com/comment/31466774
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31465867
has comment: http://stackoverflow.com/comment/31466586

http://stackoverflow.com/q/20872419
accepted answer: http://stackoverflow.com/a/20872488
type: Question
answer count: 2
has title: Texture not filling entire quad
downvote count: 0
favorite count: 0
tagged with: texture2d
has answer: http://stackoverflow.com/a/20872488
has answer: http://stackoverflow.com/a/32035029
has body: I have configured most of it to the letter of the slick tutorials but what I get is the png in the lower left corner filling only 3/4 of the quad the dimensions are 100x100 for the quad and the texture is to fill it entirely but for some reason I cant get wrapping to work(HELP!! if that is my mistake) Code for registry: public Form(String fileName, Frame frame) { try { texture = TextureLoader.getTexture( "PNG", ResourceLoader.getResourceAsStream("img/" + fileName + ".png")); } catch (IOException e) { e.printStackTrace(); } this.frame = frame; VectorFrame = a.constructVectorFrame(frame); } And the code for the rendering: GL11.glEnable(GL11.GL_TEXTURE_2D); Color.white.bind(); texture.bind(); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, 0); GL11.glVertex2d(point.x, point.y); GL11.glTexCoord2f(0, 1); GL11.glVertex2d(point.x, point.y + frame.maxY); GL11.glTexCoord2f(1, 1); GL11.glVertex2d(point.x + frame.maxX, point.y + frame.maxY); GL11.glTexCoord2f(1, 0); GL11.glVertex2d(point.x + frame.maxX, point.y); GL11.glEnd(); GL11.glDisable(GL11.GL_TEXTURE_2D); a.renderVectorFrame(point, VectorFrame);
upvote count: 1
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/32035029
score: 1
tagged with: java
tagged with: slick2d
tagged with: lwjgl

http://stackoverflow.com/a/20867377
downvote count: 0
has body: KeyListener will only raise a single event. That means, when ever keyPressed is called, it represents on a single key event. Instead, what you need to do, is on each time keyPressed is triggered, you need to set a flag, indicating what key was pressed. When keyReleased is triggered, you need to reset the flag. You then need a method that can process these flags and decisions about what do based on the state of these flags... Lastly avoid KeyListener, is focus issues which are just a pain to deal with. Instead, I'd recommend that you use Key Bindings instead For example... How can i make multiple Key Bindings work at the same time? Detecting multiple keypresses in java
answers question: http://stackoverflow.com/q/20867279
has comment: http://stackoverflow.com/comment/31310668
upvote count: 2
has comment: http://stackoverflow.com/comment/31309311
type: Answer
score: 2

http://stackoverflow.com/q/20966718
has comment: http://stackoverflow.com/comment/31496940
linked to: http://stackoverflow.com/q/9554636
has comment: http://stackoverflow.com/comment/31497037
tagged with: multiple-instances
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31496977
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31497174
has body: It is a project and I am an import store with many different products. The store consists of 4 different categories of products: Toys, Videogames, Apparel, and Books. Whenever I run the main program it only runs one of the four. I could just put the information from each into one of the products but I want them to keep the titles to differentiate each product. How would I do this?
answer count: 0
downvote count: 0
tagged with: jframe
has title: I have a set of 4 JFrames with checkboxes in them and I would like to know how to merge them all into one JFrame
tagged with: swing
type: Question
score: 1
tagged with: java
tagged with: jpanel
has comment: http://stackoverflow.com/comment/31497091

http://stackoverflow.com/a/20879412
answers question: http://stackoverflow.com/q/20879363
has body: You need to put an OnclickListener for your submit button in onCreate() method and call your other functions from there. protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.register); submit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub //Call your submitregistration function function here } }); }
type: Answer
score: 0

http://stackoverflow.com/comment/31557055
type: Comment
comment on: http://stackoverflow.com/a/20998978
has text: @Piyush Gupta: so many Layouts... why?! you should aim to **flatten** your hierarchy as musch as you can, for memory and performance optimization (mostly true for older devices, but also newer ones will enjoy a flat structure).
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31306015
type: QuestionComment
comment on: http://stackoverflow.com/q/20854651
has text: Thank u matts..I have two sample work flow. Manually i deployed first work flow(through activiti-explorer UI).This flow has a service task with its service class.Now i want deploy my second work from inside of this service class .
score: 0
type: Comment

http://stackoverflow.com/a/21921478
answers question: http://stackoverflow.com/q/20918400
type: Answer
upvote count: 1
has body: That error would seem to indicate that the Xuggler libraries cannot be located. Ensure that you have the xuggler jars in the red5/lib directory.
score: 1
downvote count: 0

instantiation
type: Tag
tag name: instantiation
tags question: http://stackoverflow.com/q/20859137

http://stackoverflow.com/q/20941717
has comment: http://stackoverflow.com/comment/31450570
has comment: http://stackoverflow.com/comment/31450449
type: AnsweredQuestion
has body: i have 4 classes (Core, GameMain, Spriter, Character) - GameMain extends core (core >> GameMain) - Character extends Spriter (Spriter >> Character) I get a NullPointerException if i call the - b.get...() - Methods without overriding them in Character (they are originally inside Spriter, i call them from GameMain through Character). i make objects of Character inside Core and put it in an ArrayList public abstract class Core { ArrayList&lt;Character&gt; mon = new ArrayList&lt;Character&gt;(); void gameloop(){ while(running){ //some code while(mon.size() &lt; 2){ mon.add(new Character(blk_1,5,1));// Character(Spriter, Long, Long){} } draw(g); } } } then inside GameMain i call a Method that is originally inside Spriter but i call it through Character. public class GameMain extends Core{ public void draw(Graphics2D g){ for(Character b : mon){ //mon is the ArrayList&lt;Character&gt; if(test.getCoordY() &lt;= b.getCoordY() - (b.getHeight()/2)){ //&lt;&lt;&lt;&lt; NullPointerException caused by these two Methods , test is a Spriter class g.drawImage(chChange(), Math.round(test.getX()), Math.round(test.getY()), test.getWidth(), (test.getHeight()), null); g.drawImage(b.getImage(), Math.round(b.getX()), Math.round(b.getY()), null); }else { g.drawImage(b.getImage(), Math.round(b.getX()), Math.round(b.getY()), null); g.drawImage(chChange(), Math.round(test.getX()), Math.round(test.getY()), null); } } } } Here is the Spriter's Method, unless i override it i will get the error. public class Spriter { Spriter(Image i){ this.i = i; scenes = new ArrayList(); } Spriter(){ scenes = new ArrayList(); start(); } public int getHeight(){ return i.getHeight(null); } public float getCoordY(){ float cy; cy = y + i.getHeight(null); //&lt;&lt;&lt;&lt; NullPointerException happens here, Image i; return cy; } public void setX(float x){ this.x = x; } public void setY(float y){ this.y = y; } // other similar Methods but no problem with them //-------------------------------------- Animation Part --…
has answer: http://stackoverflow.com/a/20942500
tagged with: java
has comment: http://stackoverflow.com/comment/31451100
has title: Calling a method through an extended class only works if the Method is overridden java
has comment: http://stackoverflow.com/comment/31451358
tagged with: methods
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/20942500
has comment: http://stackoverflow.com/comment/31450557
has comment: http://stackoverflow.com/comment/31451041
has comment: http://stackoverflow.com/comment/31450875
favorite count: 0
tagged with: class
score: 0
has comment: http://stackoverflow.com/comment/31451293
has answer: http://stackoverflow.com/a/20942296
has comment: http://stackoverflow.com/comment/31451228
has comment: http://stackoverflow.com/comment/31450826
tagged with: dynamically-generated
possible better answer: http://stackoverflow.com/a/20942296
tagged with: extends
upvote count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/31451276
has comment: http://stackoverflow.com/comment/31450450

http://stackoverflow.com/comment/31303251
score: 0
comment on: http://stackoverflow.com/q/20863937
type: Comment
type: QuestionComment
has text: @codeMagic result = 0. chrylis no

http://stackoverflow.com/comment/96988641
has text: To turn this into a "full" HTTP header, change the first line to `builder.append("HTTP/1.1 ").append(httpURLConnection.getResponseCode())` code, and put builder.append(`\n`) after the for loop, before the println. The `HTTP/1.1` might not match what was originally sent, but it will probably "work" if it needs to be given to anything expecting a http response.
type: Comment
comment on: http://stackoverflow.com/a/20976385
type: AnswerComment
score: 0

http://stackoverflow.com/a/20873845
has comment: http://stackoverflow.com/comment/31333072
has comment: http://stackoverflow.com/comment/31322236
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/20873359
score: 1
has comment: http://stackoverflow.com/comment/31362908
has body: If nick is the primary key of your entity (@Id), then use: return em.find(eng.db.User, nick) != null; Or if not: Query q = em.createQuery("SELECT TRUE FROM User u WHERE u.nick =:nick"); q.setParameter("nick", nick); return !q.getResultList().isEmpty(); By returning a simple boolean, you minimize the DB response.
has comment: http://stackoverflow.com/comment/31323720
upvote count: 1

http://stackoverflow.com/comment/31349104
comment on: http://stackoverflow.com/a/20888405
type: Comment
has text: Fuzzy logic! why didn't I think of that before :\ I'm just going to play around and see what works better.
score: 0
type: AnswerComment

http://stackoverflow.com/q/20879910
tagged with: java
tagged with: r-tree
type: Question
tagged with: jts
has title: STRtree implementation output contains random points
downvote count: 0
answer count: 1
has body: I'm using JTS with Netbeans to implement STRtrees . I'm trying to build an STRtree for a set of points( coordinates ) . Here is my code : package example; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Envelope; import com.vividsolutions.jts.geom.GeometryFactory; import com.vividsolutions.jts.geom.Point; import com.vividsolutions.jts.index.ArrayListVisitor; import com.vividsolutions.jts.index.strtree.STRtree; import java.util.List; public class Example { public static void main(String[] args) { //Getting input from the user as points GeometryFactory gf = new GeometryFactory(); Coordinate coord = new Coordinate( 1, 1 ); Point point=gf.createPoint( coord ); coord = new Coordinate( 3,2 ); Point point2=gf.createPoint( coord ); coord = new Coordinate( 2,4 ); Point point3=gf.createPoint( coord ); coord = new Coordinate( 4,1 ); Point point4=gf.createPoint( coord ); coord = new Coordinate( 5,2); Point point5=gf.createPoint( coord ); coord = new Coordinate( 4,5); Point point6=gf.createPoint( coord ); coord = new Coordinate( 3,6 ); Point point7=gf.createPoint( coord ); coord = new Coordinate( 1,6 ); Point point8=gf.createPoint( coord ); coord = new Coordinate( 6,2 ); Point point9=gf.createPoint( coord ); coord = new Coordinate( 7,1 ); Point point10=gf.createPoint( coord ); coord = new Coordinate( 6,4 ); Point point11=gf.createPoint( coord ); coord = new Coordinate( 9,2); Point point12=gf.createPoint( coord ); coord = new Coordinate( 3,8); Point point13=gf.createPoint( coord ); coord = new Coordinate( 1,7); Point point14=gf.createPoint( coord ); coord = new Coordinate( 3,7 ); Point point15=gf.createPoint( coord ); coord = new Coordinate( 5,7 ); Point point16=gf.createPoint( coord ); //Building the str object STRtree strTree=new STRtree(); //inserting the points into the tree strTree.insert(point.getEnvelopeInternal(), point); strTree.insert(point2.getEnvelopeInternal(), point2); strTree.insert(point3.getEnvelopeInternal(), point3); strTree.in…
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/20881491
score: 1

http://stackoverflow.com/q/20910451
accepted answer: http://stackoverflow.com/a/24316448
possible better answer: http://stackoverflow.com/a/24300275
has body: I am working to integrate the Stripe payment gateway in an Android app that I am developing. I have followed the steps listed on https://stripe.com/docs/mobile/android. When I try to create a new card I get errors. I run this in my activity saveButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Card card = new Card( // Get values from the form cardNumber.getText().toString(), getInteger(monthSpinner), getInteger(yearSpinner), cvc.getText().toString() ); } }); Which uses the Card model. Card model package com.stripe.android.model; import com.stripe.android.util.DateUtils; import com.stripe.android.util.TextUtils; public class Card extends com.stripe.model.StripeObject { String number; String cvc; Integer expMonth; Integer expYear; String name; String addressLine1; String addressLine2; String addressCity; String addressState; String addressZip; String addressCountry; String last4; String type; String fingerprint; String country; public String getNumber() { return number; } public void setNumber(String number) { this.number = number; } public String getCVC() { return cvc; } public void setCVC(String cvc) { this.cvc = cvc; } public Integer getExpMonth() { return expMonth; } public void setExpMonth(Integer expMonth) { this.expMonth = expMonth; } public Integer getExpYear() { return expYear; } public void setExpYear(Integer expYear) { this.expYear = expYear; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAddressLine1() { return addressLine1; } public void setAddressLine1(String addressLine1) { this.addressLine1 = addressLine1; } public String getAddressLine2() { return addressLine2; } public void setAddressLine2(String addressLine2) { this.addressLine2 = addressLine2; } public String getAddressCity() { return addressCity; } public void setAddressCity(String addressCity) { this.addressCity = addressCity; } public String getAddressZip() { return addressZip; } p…
has comment: http://stackoverflow.com/comment/31390452
has answer: http://stackoverflow.com/a/35909170
tagged with: stripe-payments
has answer: http://stackoverflow.com/a/30936980
has comment: http://stackoverflow.com/comment/44823652
upvote count: 7
has answer: http://stackoverflow.com/a/61969197
tagged with: android
has comment: http://stackoverflow.com/comment/32167464
has comment: http://stackoverflow.com/comment/58112660
favorite count: 0
has comment: http://stackoverflow.com/comment/31390339
has answer: http://stackoverflow.com/a/24300275
linked to: http://stackoverflow.com/q/7870265
type: AnsweredQuestion
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/30515495
has comment: http://stackoverflow.com/comment/40995676
type: Question
answer count: 8
has answer: http://stackoverflow.com/a/25771884
has answer: http://stackoverflow.com/a/26151882
has title: Stripe Integration in Android Studio
downvote count: 0
has answer: http://stackoverflow.com/a/24316448

http://stackoverflow.com/a/20903961
answers question: http://stackoverflow.com/q/20903589
score: 0
type: Answer
has body: You should add MySQL j Connectors jar to your classpath: Mysql connector

http://stackoverflow.com/q/20997248
score: 3
accepted answer: http://stackoverflow.com/a/20997294
upvote count: 3
tagged with: java
type: Question
downvote count: 0
has title: Keeps throwing Exception even if it doesn't meet the condition
has answer: http://stackoverflow.com/a/20997294
answer count: 1
tagged with: throw
favorite count: 0
tagged with: exception
has body: this might be a really noob question but I thought I'd take my chances here. So basically I have to make an assignment and it goes as following: I have to create a constructor but the variable "naam" can't be null or empty (""), the variable "geboortedatum" can't be in the future nor can it be the same date as today and the last variable "boeken" has the same requirements as the variable "naam" (being it can't be null nor ""). So this is what my constructor looks like, I can only edit this part because the other part is given by our teacher and can't be edited. if (this.naam == null || this.naam.equals("")) { throw new IllegalArgumentException("Fill in name"); } else { this.naam = naam; } Date vandaag = new Date(); if (this.geboorteDatum &gt;= vandaag.getTime()) { throw new IllegalArgumentException("Date must be in the past"); } else { this.geboorteDatum = geboortedatum; } if (this.boeken == null || Arrays.toString(boeken).equals("")) { throw new IllegalArgumentException("Can't be empty"); } else { this.boeken = boeken; } It keeps throwing my first exception, and I can't figure out why. This is probably a really stupid question but I can't seem to find out why. Any help would be much appreciated, thanks in advance
type: AnsweredQuestion

http://stackoverflow.com/comment/31326288
type: Comment
comment on: http://stackoverflow.com/q/20876121
type: QuestionComment
has text: For `Swing` programs, I wouldn't put so much in the `main` method, Take a look at some of the [`Swing tutorials`](http://docs.oracle.com/javase/tutorial/uiswing/) where you may pick up some better practices. May help you avoid this `static` problem in the future, also.
score: 0

http://stackoverflow.com/q/20998076
tagged with: scala
score: 1
accepted answer: http://stackoverflow.com/a/21000489
has answer: http://stackoverflow.com/a/20999717
upvote count: 1
has comment: http://stackoverflow.com/comment/31580428
type: Question
type: AnsweredQuestion
tagged with: java
has body: I have been trying to get the IDE project to recognize the clauses used by Squeryl. I have add the Squeryl*.jar to my project dependencies yet still I have to import the classes for clause "From" to be used. More specifically I had to extend objects with "import org.squeryl.dsl.boilerplate.FromSignatures" just to make "from" work. That was a weird still viable solution but commands "like/select" cant bee imported.. What is going on? I even tryed implementing the select method.. def select[R](r: =&gt;R): R object ExternalVendor extends FromSignatures{ def findAll = tx { from(vendors)(s =&gt; select(s)) map(s =&gt; s) } def select[R](r: =&gt;R): R //def select[QueryYield[_R]](r: =&gt;QueryYield[_R]): QueryYield[_R] } until it gave me problems with "R" saying select(s) not expected type "QueryYield[_R]" Please help.. Code: package object models { implicit val transactionFailures: Table[TransactionFailure] = LowkeySchema.transactionFailures implicit val vendors: Table[ExternalVendor] = LowkeySchema.vendors implicit val products: Table[Product] = LowkeySchema.products } trait Model[A] extends KeyedEntity[Long] { this: A =&gt; val id: Long = 0 def save(implicit table: Table[A]): Either[Throwable, String] = { tx { try { table.insert(this) Right("Domain object is saved successfully") } catch { case exception: Throwable =&gt; Left(exception) } } } } abstract class ExternalVendor(val name: String, val url: String) extends Model[ExternalVendor] object ExternalVendor extends FromSignatures{ def findAll = tx { from(vendors)(s =&gt; select(s)) map(s =&gt; s) } //def select[QueryYield[_R]](r: =&gt;QueryYield[_R]): QueryYield[_R] } abstract class Product(val description: String, val vendorName: String, val basePrice: Double, val plusPercent: Double) extends Model[Product] { def calculatePrice = basePrice + (basePrice * plusPercent / 100) } object Product extends FromSignatures{ def findByDescription(description: String): Option[Product] = tx { products.where(p =&gt; p.description l…
answer count: 2
tagged with: intellij-idea
downvote count: 0
has answer: http://stackoverflow.com/a/21000489
tagged with: squeryl
favorite count: 0
has title: Squeryl clauses (from, select, like, where) are not working in intellij
possible better answer: http://stackoverflow.com/a/20999717

http://stackoverflow.com/comment/31541201
score: 0
has text: Put that comment in your answer .
type: Comment
comment on: http://stackoverflow.com/a/20990544
type: AnswerComment

http://stackoverflow.com/comment/31480593
has text: @JarrodRoberson Can you clarify what belongs here versus codereview.stackexchange.com? Most of the questions I have seen on here include code snippets to illustrate the asker's initial approach.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20957314
score: 0

http://stackoverflow.com/comment/31540767
type: AnswerComment
has text: In the case of ajax call, i need to reset the session time out value in the HttpSession object know?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20990205

http://stackoverflow.com/comment/31301410
type: QuestionComment
has text: Try to get rid of the umlauts first..
score: 1
comment on: http://stackoverflow.com/q/20862869
type: Comment

http://stackoverflow.com/q/20860380
upvote count: 0
has comment: http://stackoverflow.com/comment/31295744
has comment: http://stackoverflow.com/comment/31295808
has comment: http://stackoverflow.com/comment/31295706
has comment: http://stackoverflow.com/comment/31295733
has comment: http://stackoverflow.com/comment/31295673
score: -6
favorite count: 0
downvote count: 6
has title: How to add data to a Java List?
type: UnansweredQuestion
tagged with: addition
tagged with: list
has comment: http://stackoverflow.com/comment/31295689
has answer: http://stackoverflow.com/a/20860512
tagged with: java
type: Question
has body: Please see the code below with which I am trying to create a List. Can anybody tell me why this code does not work? class materialsStore { List&lt;String&gt; lista = new ArrayList&lt;String&gt;(); public void add(String antikeimena){ lista.add(antikeimena); } public List&lt;String&gt; getList(){ return lista; } } public class finalState { public static void main(String[] args){ Scanner input = new Scanner(System.in); materialsStore materialObj = new materialsStore(); String stoixeia = input.nextLine(); for(int i=1;i&lt;=10;i++){ materialObj.add(stoixeia); } materialObj.saying(); } }
answer count: 2
has answer: http://stackoverflow.com/a/20860468

http://stackoverflow.com/comment/31585079
type: AnswerComment
score: 0
type: Comment
has text: With the latest edut, removing downvote as this now answers the question (ignoring that str is never defined in your answer and is the orig, not sorted string in the op):-)
comment on: http://stackoverflow.com/a/21014093

http://stackoverflow.com/a/20940396
has comment: http://stackoverflow.com/comment/31448377
type: Answer
has comment: http://stackoverflow.com/comment/31448112
has comment: http://stackoverflow.com/comment/31448244
has comment: http://stackoverflow.com/comment/31448475
has body: For a start, you reinitialise maxq1 to 0 every time, you need to move where it's initialised before the while loop. System.out.println(maxq1); also needs to be moved after the loop if you only want it to be displayed once, rather than on every iteration of the loop.
upvote count: 1
answers question: http://stackoverflow.com/q/20940330
score: 1
accepted answer of: http://stackoverflow.com/q/20940330
has comment: http://stackoverflow.com/comment/31448205
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31448422
has comment: http://stackoverflow.com/comment/31449633
has comment: http://stackoverflow.com/comment/31448079

http://stackoverflow.com/q/20860222
tagged with: jena
has title: Why do I have these warnings with Jena 2.11.0?
linked to: http://stackoverflow.com/q/27934796
downvote count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/34244218
linked to: http://stackoverflow.com/q/20365204
has comment: http://stackoverflow.com/comment/31295332
has comment: http://stackoverflow.com/comment/31369417
score: 1
has comment: http://stackoverflow.com/comment/31344671
tagged with: log4j
favorite count: 0
has answer: http://stackoverflow.com/a/20900467
has comment: http://stackoverflow.com/comment/31316057
type: Question
has answer: http://stackoverflow.com/a/30470022
upvote count: 1
possible better answer: http://stackoverflow.com/a/30470022
tagged with: java
answer count: 3
tagged with: warnings
accepted answer: http://stackoverflow.com/a/20900467
tagged with: eclipse
has body: I am using Eclipse and Java. I've setup the jena library and done my first RDF statement using this library, but I get a warning and I don't know exactly what it means. This is the code: import com.hp.hpl.jena.datatypes.xsd.XSDDatatype; import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.ModelFactory; import com.hp.hpl.jena.rdf.model.Property; import com.hp.hpl.jena.rdf.model.Resource; public class Main { public static void main(String[] args) { Model m = ModelFactory.createDefaultModel(); String NS = "http://www.example.org/rdf/"; Resource r = m.createResource(NS + "r"); Property p = m.createProperty(NS + "p"); r.addProperty(p, "hello world", XSDDatatype.XSDstring); m.write(System.out, "Turtle"); } } And this is the output: log4j:WARN No appenders could be found for logger (org.apache.jena.riot.stream.JenaIOEnvironment). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. &lt;http://www.example.org/rdf/r&gt; &lt;http://www.example.org/rdf/p&gt; "hello world"^^&lt;http://www.w3.org/2001/XMLSchema#string&gt; . So the code does compile and work but I don't know what to do about this warning. How can I get rid of it?
has comment: http://stackoverflow.com/comment/31319265
has comment: http://stackoverflow.com/comment/31344809

http://stackoverflow.com/comment/31582943
score: 0
type: AnswerComment
has text: The link that you gave represents the library for StaggeredGridView and there is also another file named StaggeredGridViewDemo that represents a simple example. I have added the StaggeredGridView library to the demo project.
type: Comment
comment on: http://stackoverflow.com/a/20995473

http://stackoverflow.com/q/20921618
has title: InitialContext thrrows exception when trying lookup
has answer: http://stackoverflow.com/a/20921767
accepted answer: http://stackoverflow.com/a/20921767
tagged with: lookup
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
tagged with: ejb
tagged with: jndi
upvote count: 2
answer count: 1
favorite count: 0
has body: I'm pretty new to EJB , and I'm trying to lookup a EJB from the InitialContext , Every thing was working fine , Until I changed the project name and now its giving me this exception: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial at javax.naming.spi.NamingManager.getInitialContext(Unknown Source) at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source) at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source) at javax.naming.InitialContext.lookup(Unknown Source) at client.TestingEnt.main(TestingEnt.java:23) Here is my code: public class TestingEnt { public static void main(String[] args){ InitialContext ctx=getInitialContext(); EmployeeManager stub=null; try { stub = (EmployeeManager) ctx.lookup(getLookupName()); } catch (NamingException e) { System.out.println("Lookup Failed"); e.printStackTrace(); } //Add new employee Employee emp1=new Employee(); emp1.setFirstName("David"); emp1.setLastName("Young"); emp1.setDept("Sales"); emp1.setSalary(10000); stub.addEmployee(emp1); System.out.println("Employee no'1 was added"); Employee emp2=new Employee(); emp2.setFirstName("Dana"); emp2.setLastName("Kore"); emp2.setDept("Finance"); emp2.setSalary(15000); stub.addEmployee(emp2); System.out.println("Employee no'2 was added"); System.out.println("______________________________"); private static String getLookupName() { String appName = ""; String moduleName = "EntitiesLab"; String distinctName = ""; String beanName = EmployeeManagerBean.class.getSimpleName(); System.out.println(beanName); final String interfaceName = EmployeeManager.class.getName(); System.out.println(interfaceName); String name = "ejb:" + appName + "/" + moduleName + "/" + distinctName + "/" + beanName + "!" + interfaceName; System.out.println(name); return name; } public static InitialContext getInitialContext(){ Properties properties = new Prop…

http://stackoverflow.com/q/20967693
has answer: http://stackoverflow.com/a/20967887
upvote count: 1
tagged with: eclipse
type: Question
has title: Jar executed in eclipse but not running in Unix
answer count: 3
downvote count: 0
tagged with: shell
score: 1
tagged with: unix
favorite count: 0
possible better answer: http://stackoverflow.com/a/20967747
has answer: http://stackoverflow.com/a/20967747
has answer: http://stackoverflow.com/a/20967819
has body: I have a Jar which is running in fine in eclipse and cmd prompt. When i tried executing the same in Unix , it is not executing. Note: Java version in Unix is 1.5 ; Java version in eclipse is 1.7 java -jar text.jar Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$100(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20967819
tagged with: java

http://stackoverflow.com/a/20875971
answers question: http://stackoverflow.com/q/20875099
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20875099
has comment: http://stackoverflow.com/comment/63333193
type: Answer
has comment: http://stackoverflow.com/comment/63381884
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/63413694
has comment: http://stackoverflow.com/comment/68163019
has body: First part: If you know the package name of your app, try this (put this following snippet in the onCreate method of your app): ActivityManager am= (ActivityManager) this.getSystemService(ACTIVITY_SERVICE); Then, boolean exit = false; while(!exit) { List&lt;RunningTaskInfo&gt; taskInfo = am.getRunningTasks(1); ComponentName componentInfo = taskInfo.get(0).topActivity; if(componentInfo.getPackageName().equals("Your package name")) { //Do your work here exit = true; } } When you start your app, this will be put into componentInfo. The taskInfo.get(0).topActivity will return the activity in the foreground. Hence you can know that your app has been started by comparing package using the second code snippet. Note:Put this second code snippet in an Asynctask so that the checking of whether the app has started can be done in the background. Second part: To get the priorities, I think you can do it by checking the list TaskInfo which will contain all the running apps.
upvote count: 3

http://stackoverflow.com/comment/31318420
type: QuestionComment
has text: Delimanolis is correct and stick to web.xml few days as you are new. That gives an strong understanding. :) A personal suggestion.
score: 2
comment on: http://stackoverflow.com/q/20871886
type: Comment

http://stackoverflow.com/comment/31294216
type: Comment
type: QuestionComment
has text: @AlexCohn: I am looking for a Qt way of doing this as this should be possible now that the QAndroidJniObject and QAndroidJniEnvironment class is available. I have not found any good examples where this is done. As I mentioned I have not used JNI before at all so this is all new to me.
comment on: http://stackoverflow.com/q/20851342
score: 0

http://stackoverflow.com/a/27325849
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20892002
has body: Your POJO could be simple like this: public class Groups { private List&lt;String&gt; groups; public List&lt;String&gt; getGroups() { return this.groups; } } It will work fine since you use the MapperFeature.USE_GETTERS_AS_SETTERS (enabled by default).

http://stackoverflow.com/q/20997450
has answer: http://stackoverflow.com/a/20997534
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/20997549
type: UnansweredQuestion
downvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/20997617
has body: I am getting a Runtime exception when doing a Casting as shown below Exception in thread "main" java.lang.ClassCastException: A cannot be cast to B at Testing.main(Testing.java:5) public class A { public void printA() { System.out.println("A"); } } public class B extends A{ public void printB() { System.out.println("B"); } } public class Testing { public static void main(String args[]) { B b = (B) new A(); b.printA(); } } But why this code runs fine as we are doing the same thing here HttpServletRequest request = (HttpServletRequest) req; public class LogFilter implements Filter { public void doFilter(ServletRequest req, ServletResponse res,FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) req; String ipAddress = request.getRemoteAddr(); chain.doFilter(req, res); }
has comment: http://stackoverflow.com/comment/31553223
type: Question
has answer: http://stackoverflow.com/a/20997590
has title: Runtime exception when doing a Casting
has comment: http://stackoverflow.com/comment/31553235
score: 0
has answer: http://stackoverflow.com/a/20997517
has answer: http://stackoverflow.com/a/20997674
answer count: 7
has answer: http://stackoverflow.com/a/20997486

http://stackoverflow.com/q/20890802
has answer: http://stackoverflow.com/a/20957793
has comment: http://stackoverflow.com/comment/31388297
has comment: http://stackoverflow.com/comment/31401297
downvote count: 0
has comment: http://stackoverflow.com/comment/31354497
answer count: 1
has comment: http://stackoverflow.com/comment/31388892
tagged with: permutation
has title: What is an efficient algorithm for determining the generating sets whose product contains all required permutations?
favorite count: 0
linked to: http://stackoverflow.com/q/5919298
has comment: http://stackoverflow.com/comment/31394610
type: UnansweredQuestion
tagged with: merge
has comment: http://stackoverflow.com/comment/31386195
score: 1
has comment: http://stackoverflow.com/comment/31385836
upvote count: 1
has comment: http://stackoverflow.com/comment/31383325
has comment: http://stackoverflow.com/comment/31353279
has comment: http://stackoverflow.com/comment/31353294
type: Question
has comment: http://stackoverflow.com/comment/31388918
tagged with: algorithm
has comment: http://stackoverflow.com/comment/31393179
has body: Consider a list of permutations (order-relevant combinations) of the form : (1 2 3) (1 2 4) (5 2 3) (5 2 4) I need to find the smallest number of generating sets for this permutation group. For example, given the permutations above, (1 2 3,4) (5 2 3,4) Is not an optimal solution. The optimal solution is (1,5 2 3,4). You will notice that this solution contains sets A={1, 5} B={2} and C={3,4} The original list of permutations is the ordered Cartesian product of these sets: A X B X C. I would like to partition the list of permutations into the fewest possible groups expressed as sets A, B, and C whose product contains all permutations in the list. The final answer is usually, but not always, a list of a list of sets, since it is not always possible to reduce the list of permutations down to a single list of generating sets. That is, it is usually the case that the product of sets A, B, and C account for some of the permutations in the list, but sets D, E, and F are required to account for other permutations in the list and so on. My crude attempt at solving this problem involved checking to see if I had a match on any of the two permutation slots in the list and recursively merging them. If so, I merged those two combinations, i.e. (1 2 3) (1 2 4) produce (1 2 3,4) Unfortunately, the merge order of such combinations is not associative. An ideal solution would merge these combinations in such a way that the final list of sets would subsume the largest possible number of permutations. To demonstrate the problem with associativity, take this example, which cannot reduce to fewer than two lists of generating sets: (1 2 4) (1 2 3) (1 2 5) (5 2 3) (5 2 4) Suppose you were to recursively merge these according to the following rule, “If any two columns match, I merge by preserving those columns as-is. I then merge the two sets in the third column to produce the new set. After the merger of these two rows, I throw out the two original rows, so they are not re-merged or double-c…
tagged with: java
tagged with: set-theory
has comment: http://stackoverflow.com/comment/31353840
has comment: http://stackoverflow.com/comment/31394185
has comment: http://stackoverflow.com/comment/31353860
has comment: http://stackoverflow.com/comment/31390368

http://stackoverflow.com/q/20897094
has title: Creation of Spring Rest Web Services using Spring MVC for handling large request and responses
has body: I have worked with SOAP type web-services with Axis 2 implementation where we could define contract in the form of WSDL, and that was coupled with XSD with web-services for handling the request parameters. Where as in my current project I am going to use Spring MVC for implementation, as I am new with Spring MVC, i am unable to figure out how can I handle large requests and responses where as i have done a lot of googling and from that i got following results. Can create WADL from Spring MVC by using some java coding and a plugin. But i didn't get any link for a contract. Please help me for this.
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/20899171
favorite count: 0
tagged with: rest
tagged with: web-services
tagged with: spring-mvc
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31368463
accepted answer: http://stackoverflow.com/a/20899171
upvote count: 1
type: Question

http://stackoverflow.com/q/20880666
tagged with: char
has comment: http://stackoverflow.com/comment/31334451
downvote count: 0
tagged with: string
possible better answer: http://stackoverflow.com/a/20880714
has title: Point of using char rather than String
favorite count: 0
has answer: http://stackoverflow.com/a/20880763
has answer: http://stackoverflow.com/a/20880772
has answer: http://stackoverflow.com/a/20881003
has comment: http://stackoverflow.com/comment/31334203
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20880769
score: 1
has answer: http://stackoverflow.com/a/20880846
tagged with: java
has body: What's the point of using char in Java? I know that char can only hold one character, while String can hold sentences, so what's the point of using char if it can hold only one character? String can also hold one character. I've heard that for example, short can use much less numbers than int, however its advantage is that it uses much less memory, is there something similar with char and String?
upvote count: 1
linked to: http://stackoverflow.com/q/10430043
has comment: http://stackoverflow.com/comment/31335276
type: Question
has comment: http://stackoverflow.com/comment/31334958
has comment: http://stackoverflow.com/comment/31334111
accepted answer: http://stackoverflow.com/a/20881003
answer count: 6
has comment: http://stackoverflow.com/comment/31334411
has answer: http://stackoverflow.com/a/20880714

http://stackoverflow.com/q/20917179
has title: (beginner) Cannot access variable from void
answer count: 4
tagged with: void
type: AnsweredQuestion
has body: I'm creating a bank account program to learn OOP. I made a void method called w_or_d (stands for withdrawal or deposit), but variables made inside my void are not carrying over to outside the void. It shows my variable (finalbalance) as 0. public class users { int balance; int finalbalance; public void w_or_d(int word, int amount) { if (word ==0) { int finalbalance = balance-amount; } else if (word == 1) { int finalbalance = balance+amount; } } System.out.println(finalbalance); }
has comment: http://stackoverflow.com/comment/31403441
tagged with: java
score: -4
accepted answer: http://stackoverflow.com/a/20917230
type: Question
has answer: http://stackoverflow.com/a/20917784
possible better answer: http://stackoverflow.com/a/20917234
has comment: http://stackoverflow.com/comment/31403473
has answer: http://stackoverflow.com/a/20917234
has answer: http://stackoverflow.com/a/20917203
downvote count: 4
upvote count: 0
tagged with: variables
has answer: http://stackoverflow.com/a/20917230
favorite count: 0

http://stackoverflow.com/q/20958712
has answer: http://stackoverflow.com/a/20958739
type: Question
tagged with: casting
score: 0
tagged with: object-oriented-analysis
has body: I have a method that returns a List. (getListMethod) Is there functional difference between? ArrayList myList = (ArrayList) getListMethod(); and ArrayList myList = new ArrayList(getListMethod());
answer count: 1
accepted answer: http://stackoverflow.com/a/20958739
has comment: http://stackoverflow.com/comment/31482497
has comment: http://stackoverflow.com/comment/31482363
has comment: http://stackoverflow.com/comment/31482254
has comment: http://stackoverflow.com/comment/31482111
type: AnsweredQuestion
has title: Casting a reference vs using new (ArrayList)
tagged with: java

http://stackoverflow.com/a/20868468
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20868396
type: Answer
has body: import java.sql.DriverManager; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class Main { public static void main(String[] args) throws SQLException, ClassNotFoundException { Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); Connection conn = DriverManager.getConnection("jdbc:sqlserver://HOSP_SQL1.ad.uams.edu;user=WebClinicalResearch;password=w3c1re$h;database=ClinicalResearch"); System.out.println("test"); Statement sta = conn.createStatement(); String Sql = "select * from testing_table"; ResultSet rs = sta.executeQuery(Sql); while (rs.next()) { System.out.println(rs.getString("txt_title")); } } } UPDATE : Look Here I have used this method to access remote data in mysql and works fine : String driver = "com.mysql.jdbc.Driver"; String dburl = "jdbc:mysql://sql4.freemysqlhosting.net:3306/DBNAME"; Very Good Link Here. http://technet.microsoft.com/en-us/library/ms378428.aspx Just Check it once.
answers question: http://stackoverflow.com/q/20868396

http://stackoverflow.com/comment/36689394
comment on: http://stackoverflow.com/a/21069916
has text: Off topic, but: Please don't submit minor edits. Leave retagging to people with 2k rep (or 10k if it's a big task) unless you are going to correct other problems in the post.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31529695
comment on: http://stackoverflow.com/a/20983909
type: AnswerComment
score: 0
type: Comment
has text: Nope they weren't the same length, I was overlooking that over and over again, my bad, thanks for the help tho!

http://stackoverflow.com/a/25864945
answers question: http://stackoverflow.com/q/20994989
has body: You can try this below code: //Get div element having scroll bar you want to do WebElement scrollArea = driver.findElement(By.xpath("//")); // Initialize Javascript executor JavascriptExecutor js = (JavascriptExecutor) driver; // Scroll inside web element vertically (e.g. 1000 pixel) js.executeScript("arguments[0].scrollTop = arguments[1];",scrollArea, 1000); Thread.sleep(1000);`
type: Answer
score: 0

http://stackoverflow.com/q/20942492
tagged with: android
has answer: http://stackoverflow.com/a/20944467
has comment: http://stackoverflow.com/comment/31451946
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31452257
has comment: http://stackoverflow.com/comment/31452222
type: Question
has body: I am trying to make an app that will show my current location and will track me from there with a line.I have been using Google maps Api v2 for android so i was trying to work with polylines to help me show my tracks but its not showing. Can anyone help me with that..Thankyou. Total code is provided. public class MainActivity extends FragmentActivity implements ConnectionCallbacks, OnConnectionFailedListener, LocationListener, OnMyLocationButtonClickListener, OnClickListener, android.location.LocationListener { private GoogleMap mMap; private LocationClient mLocationClient; private TextView mMessageView; private boolean setIt; // These settings are the same as the settings for the map. They will in fact give you updates // at the maximal rates currently possible. private static final LocationRequest REQUEST = LocationRequest.create() .setInterval(5000) // 5 seconds .setFastestInterval(16) // 16ms = 60fps .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.my_location_demo); mMessageView = (TextView) findViewById(R.id.message_text); Button b1=(Button)findViewById(R.id.start); Button b2=(Button)findViewById(R.id.stop); b1.setOnClickListener(this); b2.setOnClickListener(this); } @Override protected void onResume() { super.onResume(); setUpMapIfNeeded(); setUpLocationClientIfNeeded(); mLocationClient.connect(); } @Override public void onPause() { super.onPause(); if (mLocationClient != null) { mLocationClient.disconnect(); } } private void setUpMapIfNeeded() { // Do a null check to confirm that we have not already instantiated the map. if (mMap == null) { // Try to obtain the map from the SupportMapFragment. mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)) .getMap(); // Check if we were successful in obtaining the map. if (mMap != null) { mMap.setMyLocationEnabled(true); mMap.setOnMyLocationButtonClickListener(t…
tagged with: google-maps
tagged with: google-maps-api-2
upvote count: 1
linked to: http://stackoverflow.com/q/15641640
answer count: 1
downvote count: 0
has title: Showing my track with Google map api v2 in android
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/31387035
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20904872
has text: Yes, sorry. I wasn't clear enough with that explanation.
score: 0

http://stackoverflow.com/a/21040241
score: 2
downvote count: 0
upvote count: 2
has body: When a method is invoked the JVM has to figure out what piece of code to execute: sometimes this is done at runtime (e.g. when overriding methods); sometimes this is done at compile time (e.g. when overloading methods). Once the JVM resolves what bit of code it is executing the actual instance that you are referring to isn't really any more significant than any other parameter. The example code given sets up a scenario that may look like method overriding but isn't, so the method ends up getting bound at compile time. The private visibility modifier is not violated because the invocation doesn't touch any of Derived's code. Looking at the bytecode (which the Java code is compiled to via javac) is instructive - Say we slightly modify the original code to: public class PrivateOverride { private void f() { System.out.println("private f()"); } public static void main(String[] args) { PrivateOverride po = new Derived(); po.f(); Derived d = new Derived(); d.f(); } } class Derived extends PrivateOverride { public void f() { System.out.println("public f()"); } } The main method compiles to (edited for brevity): public static main([Ljava/lang/String;)V NEW Derived DUP INVOKESPECIAL Derived.&lt;init&gt;()V ASTORE 1 ALOAD 1 INVOKESPECIAL PrivateOverride.f()V NEW Derived DUP INVOKESPECIAL Derived.&lt;init&gt;()V ASTORE 2 ALOAD 2 INVOKEVIRTUAL Derived.f()V RETURN Notice that in each case the method is invoked on the compile time type. Notice also that the second call of f() uses the INVOKEVIRTUAL instruction. This is what tells the JVM to check the runtime type and decide what to call based on that.
type: Answer
answers question: http://stackoverflow.com/q/21016776

http://stackoverflow.com/a/20926024
answers question: http://stackoverflow.com/q/20925193
score: 5
has comment: http://stackoverflow.com/comment/31420747
type: AcceptedAnswer
downvote count: 0
has body: Toolkit.getDefaultToolkit().setDynamicLayout(false); This will affect all windows in the application, so if you only need this feature for a specific frame you may also want to add a WindowListener to the frame and then handle the windowActivated/windowDeactivated events to set this property.
type: Answer
accepted answer of: http://stackoverflow.com/q/20925193
upvote count: 5

http://stackoverflow.com/comment/31567379
has text: Do you have the same problems when using [`InitializingBean.afterPropertiesSet()`](http://docs.spring.io/spring/docs/4.0.0.RELEASE/javadoc-api/org/springframework/beans/factory/InitializingBean.html#afterPropertiesSet--) as entry point?
comment on: http://stackoverflow.com/q/21004040
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/31577472
type: QuestionComment
comment on: http://stackoverflow.com/q/21009925
type: Comment
score: 0
has text: No comment on "why", but this is a very inefficient `join`. You should use `StringBuilder` instead.

http://stackoverflow.com/comment/31298782
type: Comment
comment on: http://stackoverflow.com/q/20860945
score: 0
has text: cdr doesn't change the parent it returns the parent. cons creates a new cons cell - the building block of lists in scheme.
type: QuestionComment

http://stackoverflow.com/a/20989988
type: Answer
has body: If you need to perform tasks in background, like an animation, you should use Swingworker. This class allows you to perform a long task in the background (in another thread) and bring back changes to the UI in a managed manner that will be executed in the right thread. http://docs.oracle.com/javase/6/docs/api/javax/swing/SwingWorker.html Someone filled a nice tutorial here: How do I use SwingWorker in Java?
answers question: http://stackoverflow.com/q/20989860
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/a/21017852
has body: This can be achieved by the following way BeerAppServlet /index.jsp BeerAppServlet /test/index.jsp In instead of mapping it to <servlet-class> map it to
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21016543
type: Answer
upvote count: 3
score: 3
accepted answer of: http://stackoverflow.com/q/21016543

http://stackoverflow.com/q/20876291
has answer: http://stackoverflow.com/a/22621774
favorite count: 0
has comment: http://stackoverflow.com/comment/31330219
linked to: http://stackoverflow.com/q/5974731
type: AnsweredQuestion
has title: SQL Foreign Key before commit
downvote count: 0
tagged with: transactions
tagged with: java
tagged with: mysql
has body: In a game server code in Java, I split the client data into many tables, to ease adding new content in the future. Right now I have the following tables names auth inventory The name table contains the columns id and name. The auth table has columns id and password. The id column on the auth and inventory tables have foreign key constraints on the name's id column. When creating a new client, I insert into the name table, get the generated id and insert the rest of the data in the other tables in separate insert statements, but all in a single transaction. The problem is, when I insert into the auth table, it fails because of the foreign key check in name because I haven't commited it yet. Is there a better way to solve this without commiting on every insert?
possible better answer: http://stackoverflow.com/a/22621774
type: Question
has answer: http://stackoverflow.com/a/20876390
score: 4
tagged with: foreign-keys
answer count: 3
tagged with: sql
has answer: http://stackoverflow.com/a/20878093
accepted answer: http://stackoverflow.com/a/20878093
upvote count: 4
linked to: http://stackoverflow.com/q/11501648

http://stackoverflow.com/q/20877662
has answer: http://stackoverflow.com/a/20878166
accepted answer: http://stackoverflow.com/a/20878166
favorite count: 0
has comment: http://stackoverflow.com/comment/31329344
tagged with: maven
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
type: Question
has body: I'm having a problem where maven is not finding the slf4j classes when running JUnit tests: 22:20:05,412 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy] 22:20:05,412 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback-test.xml] at [file:/home/ram/src/2dd/java/dd2/target/test-classes/logback-test.xml] 22:20:05,526 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.RollingFileAppender] 22:20:05,527 |-ERROR in ch.qos.logback.core.joran.action.AppenderAction - Could not create an Appender of type [ch.qos.logback.core.RollingFileAppender]. ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.core.RollingFileAppender However, the slf4j jar files are being added to the classpath: [DEBUG] test classpath classpath: [DEBUG] /home/ram/src/2dd/java/dd2/target/test-classes [DEBUG] /home/ram/src/2dd/java/dd2/target/classes [DEBUG] /home/ram/.m2/repository/junit/junit/4.11/junit-4.11.jar [DEBUG] /home/ram/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar [DEBUG] /home/ram/.m2/repository/com/fallabs/kyotocabinet-java/1.24/kyotocabinet-java-1.24.jar [DEBUG] /home/ram/.m2/repository/ch/qos/logback/logback-classic/1.0.13/logback-classic-1.0.13.jar [DEBUG] /home/ram/.m2/repository/ch/qos/logback/logback-core/1.0.13/logback-core-1.0.13.jar [DEBUG] /home/ram/.m2/repository/org/slf4j/slf4j-api/1.7.5/slf4j-api-1.7.5.jar [DEBUG] provider classpath classpath: [DEBUG] /home/ram/.m2/repository/org/apache/maven/surefire/surefire-junit4/2.12.4/surefire-junit4-2.12.4.jar [DEBUG] /home/ram/.m2/repository/org/apache/maven/surefire/surefire-api/2.12.4/surefire-api-2.12.4.jar My logback-test.xml file closely follows the example at: http://logback.qos.ch/manual/appenders.html gen-test.log gen-test.%i.log 1 3 2MB %date %level [%thread] %logger{36} [%file:%line] - %msg%n <appender-ref ref="FILE" …
tagged with: slf4j
upvote count: 3
answer count: 1
has title: maven fails to find slf4j rollingfileappender

http://stackoverflow.com/a/20884377
type: Answer
answers question: http://stackoverflow.com/q/20884327
score: 1
accepted answer of: http://stackoverflow.com/q/20884327
has body: well you may use this code to detect usb using java: import java.io.*; import javax.swing.*; public class DetectWin extends JFrame { JPanel loginPnl = new JPanel(); JTextField Dfield = new JTextField("", 20); DetectWin() { super("AUTHORIZATION"); setSize(350, 100); setLocation(400, 300); setDefaultCloseOperation(EXIT_ON_CLOSE); add(loginPnl); setVisible(true); setResizable(false); loginPnl.add(Dfield); String[] letters = new String[]{ "A", "B", "C", "D", "E", "F", "G", "H", "I", "Z"}; File[] drives = new File[letters.length]; boolean[] isDrive = new boolean[letters.length]; for ( int i = 0; i &lt; letters.length; ++i ) { drives[i] = new File(letters[i]+":/"); isDrive[i] = drives[i].canRead(); } Dfield.setText("Waiting for devices...."); while(true) { for ( int i = 0; i &lt; letters.length; ++i ) { boolean pluggedIn = drives[i].canRead(); if ( pluggedIn != isDrive[i] ) { if ( pluggedIn ) Dfield.setText("Drive "+letters[i]+" has been plugged in"); else Dfield.setText("Drive "+letters[i]+" has been unplugged"); isDrive[i] = pluggedIn; } } try { Thread.sleep(100); } catch (InterruptedException e) { } } } public static void main(String args[]) { DetectWin AUTHORIZATION = new DetectWin(); } }
upvote count: 2
type: AcceptedAnswer
downvote count: 1
has comment: http://stackoverflow.com/comment/31341757

http://stackoverflow.com/comment/81393151
type: Comment
comment on: http://stackoverflow.com/a/20905166
score: 2
type: AnswerComment
has text: PDRectangle source has constants for this calculation: POINTS_PER_INCH = 72; POINTS_PER_MM = 1 / (10 * 2.54f) * POINTS_PER_INCH, also paper sizes like A4,A5, etc

http://stackoverflow.com/q/20872410
downvote count: 0
accepted answer: http://stackoverflow.com/a/20872875
answer count: 1
score: 8
favorite count: 0
upvote count: 8
has title: Gradle configuration for multi-module project with shared dependencies
has comment: http://stackoverflow.com/comment/31319653
has body: Make a first project with gradle, so i look at spring, gradle, hibernate projects how they organize gradle files, and start make my own. But, can't find mistake, why my configuration doesn't work. (sub-projects cant resolve dependency) So project tree: Root project 'foobar' +--- Project ':foobar-app' | +--- Project ':foobar-app:people' | | +--- Project ':foobar-app:people:people-api' | | +--- Project ':foobar-app:people:people-core' | | +--- Project ':foobar-app:people:people-data' | | \--- Project ':foobar-app:people:people-rest' | \--- Project ':foobar-app:realtor' +--- Project ':foobar-starter' \--- Project ':foobar-system' +--- Project ':foobar-system:foobar-system-jpa' +--- Project ':foobar-system:foobar-system-neo4j' +--- Project ':foobar-system:foobar-system-persistence' +--- Project ':foobar-system:foobar-system-repository' \--- Project ':foobar-system:foobar-system-tx' The problem, when i make foobar-system-jpa.gradle file with set of dependences, etc, it's not work - no dependecies can be reach for this module. But when in root 'foobar' build.gradle make a set of deps for 'foobar-system-jpa' subproject - it' work fine. Why? My root build.gradle: configurations.all { // check for updates every build resolutionStrategy.cacheChangingModulesFor 0, 'seconds' } configure(allprojects) { project -&gt; group = 'com.foobar' version = '0.0.1-SNAPSHOT' apply from: "${rootDir}/dependencies.gradle" apply plugin: 'maven' apply plugin: 'idea' ext.gradleScriptDir = "${rootProject.projectDir}/gradle" apply from: "${gradleScriptDir}/task.gradle" } configure(subprojects) { subproject -&gt; apply plugin: 'java' sourceCompatibility = 1.7 targetCompatibility = 1.7 apply from: "${rootDir}/dependencies.gradle" repositories { mavenCentral() maven { url "http://m2.neo4j.org/" } maven { url "http://repo.maven.apache.org/maven2" } } dependencies { testCompile (libs.junit) testCompile (libs.mockito) testCompile group: 'org.hamcrest', name: 'hamcrest-library', version: '1.3' } } my depe…
has comment: http://stackoverflow.com/comment/31319974
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20872875
tagged with: gradle
type: Question

http://stackoverflow.com/comment/31537978
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20988010
type: Comment
has text: I know that getFirst() is not in the interface,then why designing principles states like that ?

http://stackoverflow.com/comment/31490413
comment on: http://stackoverflow.com/q/20962762
score: 0
type: QuestionComment
type: Comment
has text: That line doesn't look like it'd throw that error. Please post more of your code.

http://stackoverflow.com/comment/31584227
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21013531
has text: disconnect() function of MQException class throws cached Exception which you are not handling in finally block. Not sure how your code is even compiling. My guess would be your disconnect() call is failing.

jcomponent
tags question: http://stackoverflow.com/q/20939438
tag name: jcomponent
tags question: http://stackoverflow.com/q/20923561
tags question: http://stackoverflow.com/q/21001454
type: Tag
tags question: http://stackoverflow.com/q/20940913

http://stackoverflow.com/q/20884257
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/31341548
type: UnansweredQuestion
has body: I am using Spring portlet MVC framework with Oracle WebLogic Portal. I have a page with a few portlets. For example page#1 (contains 2 portlets - portlet#1 and portlet#2) and another page - page#2 with two more portlets (portlet#3 and portlet#4) The first portlet on the first page (portlet#1) contains a link. I want to go to the page which belongs to the portlet#3 (is located on another page !!!). How can I do this ? To create a connection between two portlets within one page (which contain these portlets) is not a problem. But is it possible to move between different portlets which are localed on different pages ???
tagged with: spring-mvc
has title: How to create a reference from one portlet to another?
linked to: http://stackoverflow.com/q/24158862
tagged with: java
has answer: http://stackoverflow.com/a/24187612
type: Question
tagged with: spring-portlet-mvc

http://stackoverflow.com/a/20939358
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/20939129
has comment: http://stackoverflow.com/comment/31445743
has body: I understand that when I serialize, I need to all the Bar's to be serializable, else I need to mark them as transient. Your understanding is incorrect. Flagging a field as transient causes it to not be stored when an object is serialized. As such, you should only do this for fields whose values are fundamentally impossible to serialize (e.g, a network connection), or fields whose values can be discarded and recreated later (e.g, a cache, or a reference to an application global). Otherwise, the serialized representation of this object will be incomplete. While it is often the case that a non-serializable object will associated with a transient field, this is not always the case. Understand what "transient" means before you go throwing it around just to make your code run!
score: 3
downvote count: 0

http://stackoverflow.com/a/20891836
type: Answer
has comment: http://stackoverflow.com/comment/31355473
answers question: http://stackoverflow.com/q/20891176
score: 2
downvote count: 0
has body: If I run your program on my computer, I observe incorrect output about 1 in 10 times. (This is with the console emulator in Netbeans 7.) However, if I modify it to check the size of the set after all threads are complete, it always contains 1,000 unique integers. This is true even when there are errors in the output generated by the individual threads while it is running. (That is, in the lines printed by the threads, there are duplicates printed, but the true size of the set after execution is complete is actually 1,000) Therefore I conclude that the problem is having 1,000 threads all writing to the PrintStream that your platform provides for System.out is corrupting the output. On my platform I can see corrupted output during execution, but there are always 1,000 unique integers in the set at the end. public static void main(String[] args) throws InterruptedException { final AtomicInteger sequencer = new AtomicInteger(1); final Set&lt;Integer&gt; integers = new ConcurrentSkipListSet&lt;Integer&gt;(); final Runnable task = new Runnable() { @Override public void run() { int next = sequencer.getAndIncrement(); integers.add(next); System.out.println(next); } }; List&lt;Thread&gt; threads = new ArrayList&lt;Thread&gt;(1000); for (int i = 0; i &lt; 1000; i++) { Thread t = new Thread(task); t.start(); threads.add(t); } for (Thread t : threads) { t.join(); } System.out.println(integers.size()); }
has comment: http://stackoverflow.com/comment/31355823
upvote count: 2
has comment: http://stackoverflow.com/comment/31357455

http://stackoverflow.com/a/20956755
answers question: http://stackoverflow.com/q/20956561
type: Answer
score: 0
has body: Here is some code that does what I think you want it to: public class Rectangle { int x, y, width, length; //declares the class's fields public Rectangle(int x, int y, int width, int length) { this.x = x; //initializes the field x to the value of the local variable x this.y = y; //initializes the field y to the value of the local variable y this.width = width; //initializes the field width to the value of the local variable width this.length = length; //initializes the field length to the value of the local variable length System.out.println(this); //prints this object. should look similar to "Rectangle@1246889" } } Please take a basic java tutorial (e.g. Providing Constructors for Your Classes), it will make your life easier.

http://stackoverflow.com/q/20975237
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31513349
has answer: http://stackoverflow.com/a/20976007
has comment: http://stackoverflow.com/comment/31513292
score: 0
has body: I am using an FixedThreadPool in Java to process Images. The Problem what i have is, that first of all i am parsing an xml, with the information of this xml i am starting the threads in the pool (for downloading stuff). The Problem is now, i am filling the ThreadPool with information after every < tag > in the xml. So for the start i dont know how many times i will have to add threads to the pool. for example: xml: I am creating an ArrayList with the download Information, and than pass it to the threadpool. The Threadpool looks like this: public void addAnhang(ArrayList<Anhang> a, String intern_id){ this.generateFolder(intern_id); for(Anhang anh:a){ anh.setZielordner(props.getProperty("zielordner_anhang")+intern_id+File.separator); this.tasks.add(Executors.callable(new AnhangWorker(anh))); //this.pool.execute(new AnhangWorker(anh)); } try { this.pool.invokeAll(tasks); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("end of this cycle"); } So now my question. HOW do i know when all of my threads are finished? The xml parser is faster than the downloads, so i cant kill all threads after the xml is finished. But i dont know when the threadpool is done with downloading all files.
has title: using fixedthreadpool java how to check if finished
answer count: 1
has comment: http://stackoverflow.com/comment/31512875
has comment: http://stackoverflow.com/comment/31514153
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/31513991

http://stackoverflow.com/a/20903178
answers question: http://stackoverflow.com/q/20902968
type: Answer
upvote count: 1
score: 1
downvote count: 0
has body: In bt.root.left.printValue(); bt.root.right.printValue(); both bt.root.left bt.root.right are null, So you are getting NullPointerException.. public void insert(int value, Node root){ Node current = root; Node n = new Node(value); while(current != null){ if (value &gt; current.value) current = current.right; else if (value &lt; current.value) current = current.left; } current = n; // n.right=null and n.left=null. So, current.right and current.left=null. } In the second case, if (value &gt; current.value) if (current.right != null) current = current.right; else{ current.right = n; //right!=null break; } else if (value &lt; current.value) if (current.left != null) current = current.left; else{ current.left = n; // left!=null

http://stackoverflow.com/a/56805282
downvote count: 0
type: Answer
has body: You may not get the result without checking whether the result has entries. For that use while(rs.next()){ rs.getString("column name"); } and try it. It worked fine for me. Thanks
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/20900819

http://stackoverflow.com/comment/31538115
type: QuestionComment
has text: No details on the error? May be OOM
comment on: http://stackoverflow.com/q/20988304
score: 0
type: Comment

http://stackoverflow.com/q/21004626
has answer: http://stackoverflow.com/a/21004708
has comment: http://stackoverflow.com/comment/31567222
favorite count: 0
has comment: http://stackoverflow.com/comment/31567343
has comment: http://stackoverflow.com/comment/31567292
tagged with: nullpointerexception
has body: I am new at java and i have this exception in my code: Exception in thread "main" java.lang.NullPointerException at Course.addStudents(Course.java:31) at Third.main(Third.java:28) Course.java public boolean addStudents(Student newStudent){ for (Student student : students){ if (student.getID()== newStudent.getID()){ return false; } } if(numberOfStudents &lt; capacity){ students[numberOfStudents++] = newStudent; return true; } return false; } Third.java c1.addStudents(s1); I have tried the solve it but didnt achieve. I searched for it and I guess the problem is initializing. Is it true? if it is, I dont know how to handle with that, any idea??
has title: how to handle NullPointerException in this code?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31567407
has comment: http://stackoverflow.com/comment/31567083
has comment: http://stackoverflow.com/comment/31567212
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31567627
tagged with: java
has comment: http://stackoverflow.com/comment/31567139
has comment: http://stackoverflow.com/comment/31567451
has comment: http://stackoverflow.com/comment/31567164
has comment: http://stackoverflow.com/comment/31567118
has comment: http://stackoverflow.com/comment/31567245
score: 0
has comment: http://stackoverflow.com/comment/31567219
answer count: 2
has answer: http://stackoverflow.com/a/21004736

http://stackoverflow.com/comment/31515972
score: 3
has text: If all your classes have a dependency on `Part`, then that is what you should model in your diagram. If you think that is convoluted, change your design. You don't model your application based on how ugly it looks in a UML diagram.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20976933

http://stackoverflow.com/a/20919323
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31412471
accepted answer of: http://stackoverflow.com/q/20919273
type: Answer
answers question: http://stackoverflow.com/q/20919273
has body: In here: ContentValues cv = new ContentValues(); cv.put(KEY_AMOUNT, exp.Amt); cv.put(KEY_DESCRIP, exp.Desc); db.insert(KEY_TABLE_NAME, null, cv); exp.Desc is possibly null and cannot be bound. Bind arguments indexing starts at 1 so a problem binding at index 2 refers to the second bind arg. Also in here, your cursor contains two columns private static final String[] columns = { KEY_DESCRIP, KEY_AMOUNT }; Cursor cx = db.query(KEY_TABLE_NAME, columns, null, null, null, null, null); but you are requesting for three: int rowid=cx.getColumnIndex(KEY_ID); int amt=cx.getColumnIndex(KEY_AMOUNT); int desc=cx.getColumnIndex(KEY_DESCRIP); which will eventually cause another exception when trying to use column index -1.

http://stackoverflow.com/comment/31515262
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20976483
score: 0
has text: Actually it doesn't (necessarily) mean that there is a memory-leak. It could also be the case that the garbage collector just didn't run yet to clean up.

http://stackoverflow.com/q/20853666
possible better answer: http://stackoverflow.com/a/20855828
tagged with: http-redirect
tagged with: selenium
accepted answer: http://stackoverflow.com/a/20853737
has answer: http://stackoverflow.com/a/20855828
downvote count: 1
has comment: http://stackoverflow.com/comment/31295043
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
answer count: 2
tagged with: htmlunit
tagged with: javascript
has title: Final redirected URL using Selenium Htmlunit Java
has body: I have a question for you , which I think could possibly be solved using Selenium I have a set of URLs like for example the one below. http://www.sears.com/search=little tikes&amp;Little Tikes?filter=Brand&amp;keywordSearch=false&amp;vName=Toys+%26+Games&amp;catalogId=12605&amp;catPrediction=false&amp;previousSort=ORIGINAL_SORT_ORDER&amp;viewItems=50&amp;storeId=10153&amp;adCell=W3 if you paste the URL as it is in the browser it will end up redirecting to another URL , which you can verify in the address bar of the browser(Firefox for example). I need to get the redirected URL , regardless of if the redirect was from a javascript code or not is it possible to do this using the selenium framework ? I have already tried using HTMLUnit for this however I get the following javascript execution error. Please help! com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot call method "indexOf" of null (script in http://www.sears.com/search=little%20tikes&amp;Little%20Tikes?filter=Brand&amp;keywordSearch=false&amp;catalogId=12605&amp;adCell=W3&amp;catPrediction=false&amp;previousSort=ORIGINAL_SORT_ORDER&amp;viewItems=50&amp;storeId=10153&amp;levels=Toys+%26+Games from (6942, 33) to (6974, 14)#6966) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:669) ~[htmlunit-2.12.jar:2.12] at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:601) ~[htmlunit-core-js-2.12.jar:?] at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507) ~[htmlunit-core-js-2.12.jar:?] at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:555) ~[htmlunit-2.12.jar:2.12] at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:530) ~[htmlunit-2.12.jar:2.12] at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptIfPossible(HtmlPage.java:979) ~[htmlunit-2.12.jar:2.12] at com.gargoylesoftware.htmlunit.html.HtmlScript…
favorite count: 0
linked to: http://stackoverflow.com/q/20315330
has answer: http://stackoverflow.com/a/20853737
upvote count: 2
has comment: http://stackoverflow.com/comment/31295886

http://stackoverflow.com/comment/31403360
type: QuestionComment
type: Comment
has text: Did you set the stage as the Input Processor?
score: 1
comment on: http://stackoverflow.com/q/20916512

http://stackoverflow.com/a/20978186
score: 2
downvote count: 0
has body: Assuming Array is in fact ArrayList, and assuming you want to store the value that is at index d + 1 in the index d, you need temp.set(d, temp.get(d + 1)); temp.get(d) is not a variable to which you can assign a value. It's an expression returning a value. And you can't assign anything to a value.
upvote count: 2
has comment: http://stackoverflow.com/comment/31520087
type: Answer
has comment: http://stackoverflow.com/comment/31518569
answers question: http://stackoverflow.com/q/20978133

http://stackoverflow.com/a/52877782
type: Answer
answers question: http://stackoverflow.com/q/20888851
upvote count: 2
has body: Like other users have said, it depends on the JCE provider. Java SE generates a random IV for you if you specify none. Only Android1 and Javacard API use a blank IV, which is non-conforming to the Java Crypto spec, which states: If this cipher requires any algorithm parameters that cannot be derived from the given key, the underlying cipher implementation is supposed to generate the required parameters itself (using provider-specific default or random values) if it is being initialized for encryption or key wrapping, and raise an InvalidKeyException if it is being initialized for decryption or key unwrapping. The generated parameters can be retrieved using getParameters or getIV (if the parameter is an IV). If you do not specify the IV, in Java SE you get a random one, and will need to retrieve it with cipher.getIV() and store it, as it will be needed for decryption. But better yet, generate a random IV yourself and provide it via IvParameterSpec. Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); SecureRandom rnd = new SecureRandom(); byte[] iv = new byte[cipher.getBlockSize()]; rnd.nextBytes(iv); IvParameterSpec ivParams = new IvParameterSpec(iv); cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key, "AES"), ivParams); byte[] ciphertext = cipher.doFinal(input.getBytes()); 1 That could be because Android is Java-esque, like the Eminem-esque ad. Just guessing, that's all.
score: 2
downvote count: 0

http://stackoverflow.com/a/20945462
score: 0
has comment: http://stackoverflow.com/comment/31457727
type: Answer
answers question: http://stackoverflow.com/q/20945346
has body: Remove the title bar in manifest under the activity android:theme="@android:style/Theme.NoTitleBar.Fullscreen" &gt; Change the action bar name. Android manifest under the activity android:label="@string/app_name" change to android:label=" "
has comment: http://stackoverflow.com/comment/31457046

http://stackoverflow.com/q/20959053
answer count: 3
tagged with: user-interface
tagged with: jframe
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20959440
tagged with: java
has answer: http://stackoverflow.com/a/20959160
linked to: http://stackoverflow.com/q/14627223
has answer: http://stackoverflow.com/a/20966581
tagged with: swing
type: Question
has body: I am trying to make a program with buttons, that when you click them, change the background color of the frame import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class ColorFrame { public static void main(String[] args){ JFrame frame = new JFrame(); JPanel panel = new JPanel(); frame.setSize(300, 200); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final JButton redButton = new JButton ("Red"); final JButton greenButton = new JButton ("Green"); final JButton blueButton = new JButton ("Blue"); class Listener extends JPanel implements ActionListener{ public void actionPerformed(ActionEvent event) { Color color; if (event.getSource() == redButton){ color = Color.red; } else if (event.getSource() == greenButton){ color = Color.green; } else { color = Color.blue; } setBackground(color); System.out.println(color); repaint(); } } redButton.addActionListener(new Listener()); greenButton.addActionListener(new Listener()); blueButton.addActionListener(new Listener()); panel.add(new JButton ("Red")); panel.add(new JButton ("Green")); panel.add(new JButton ("Blue")); frame.add(panel); } } Yet when I click the buttons, nothing seems to happen and I think it might have something to do with the listeners not being activated for reason
has title: JFrame buttons that change background color of window
score: 0

http://stackoverflow.com/comment/31462912
type: QuestionComment
has text: In this post is not answered and make the call to the url and get the json object and that is also the question that I have, thanks.
comment on: http://stackoverflow.com/q/20948545
score: 0
type: Comment

http://stackoverflow.com/q/20951028
has title: getHeight() on a TextView initialised in code
upvote count: 1
answer count: 1
tagged with: textview
has answer: http://stackoverflow.com/a/20951138
accepted answer: http://stackoverflow.com/a/20951138
has comment: http://stackoverflow.com/comment/31467833
favorite count: 0
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31467163
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31467021
type: Question
linked to: http://stackoverflow.com/q/7298731
tagged with: android-widget
has body: I have initialised a TextView in code (that is, not initialised it from the layout) TextView v = new TextView(getApplicationContext()); Then I set the text v.setText("Foo"); Then I try to get the height of this TextView int i = v.getHeight(); This is giving 0. Please advise

http://stackoverflow.com/comment/31473836
type: Comment
has text: i've added the code example at the end to my code, and then i get a new error on the exact same rows. "cannot make a static reference to the non-static method getHorn() from the type Polylinje" but i cannot make getHorn static, the rest of the code will fail then.
comment on: http://stackoverflow.com/a/20953813
type: AnswerComment
score: 0

http://stackoverflow.com/a/20932792
has body: A JTextArea does not support rich (styled) text. While JTextPane and JEditorPane support simple styled text (e.g. HTML &amp; RTF). They do not support more complex formats like Word documents or PDF. This will require a custom component that supports those document types. There is no component provided with the JSE (core Java) that can render them.
score: 2
has comment: http://stackoverflow.com/comment/31433526
has comment: http://stackoverflow.com/comment/31433644
accepted answer of: http://stackoverflow.com/q/20932764
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20932764
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/31433554
type: Answer

http://stackoverflow.com/q/20918887
tagged with: big-o
upvote count: 0
tagged with: java
has title: Java/Jsp programming quiz with respect to Big-O notation
type: Question
has answer: http://stackoverflow.com/a/20918958
tagged with: algorithm
score: -1
has comment: http://stackoverflow.com/comment/31407704
has answer: http://stackoverflow.com/a/20930135
answer count: 2
has comment: http://stackoverflow.com/comment/31406387
downvote count: 1
has comment: http://stackoverflow.com/comment/31406425
has comment: http://stackoverflow.com/comment/31406359
favorite count: 0
has comment: http://stackoverflow.com/comment/31406373
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31406364
has body: Question: Given: a list of integers (duplicates are allowed); and integer N. Remove the duplicates from the list and find the N-th largest element in the modified list. Implement at least two different solutions to find N-th largest element with O(N*log(N)) average time complexity in Big-O notation, where N is the number of elements in the list. According to my understanding i can use Merge Sort, Heap Sort, Quick sort on the provided integer list with duplicates to find the N-th largest element with O(N*log(N)) average time complexity in Big-O notation. Is that correct ? Also, what about duplicates in the list do i just add an extra line of code in the above mentioned algorithm to remove duplicates will that not affect the O(N*log(N)) average time complexity because Merge Sort, Heap Sort, Quick sort will only sort the list not delete duplicates. I am not looking for any code but just tips and ideas about how to proceed with the question ? I am using Java also is there any predefined classed/methods in java that i can use to accomplish the task rather than me coding Merge Sort, Heap Sort, Quick sort on my own. My aim is to complete the task keeping in mind O(N*log(N)) average time complexity.

http://stackoverflow.com/comment/31529131
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20983608
score: 2
has text: What do you mean by "metadata"?

http://stackoverflow.com/comment/31568709
has text: Is it a library project or a regular Android project?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21005205
score: 0

apache-stringutils
tag name: apache-stringutils
tags question: http://stackoverflow.com/q/21010951
type: Tag
tags question: http://stackoverflow.com/q/20953293

http://stackoverflow.com/q/20924447
tagged with: android
has answer: http://stackoverflow.com/a/20924608
has body: I want to be able set the sounds that I have on the sound board as ringtones and notification tones. I've looked up this on this website and I can't seem to find a solution. Any ideas?? Thanks for looking. :-) My code is package com.sherlock; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import android.app.Activity; import android.content.ContentValues; import android.content.Intent; import android.content.res.AssetFileDescriptor; import android.content.res.Resources; import android.media.MediaPlayer; import android.media.RingtoneManager; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.provider.MediaStore; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.Toast; import com.sherlocksoundboard.R; public class Content extends Activity { int savetype = RingtoneManager.TYPE_RINGTONE; int selectedSoundId; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.content); final MediaPlayer player = new MediaPlayer(); final Resources res = getResources(); //just keep them in the same order, e.g. button01 is tied to backtoyou final int[] buttonIds = { R.id.button1, R.id.Button01, R.id.Button02, R.id.Button03, R.id.Button04,R.id.Button05,R.id.Button06,}; final int[] soundIds = { R.raw.sherlock, R.raw.deargod, R.raw.donttalk, R.raw.lookat, R.raw.stop,R.raw.text,R.raw.john, }; View.OnClickListener listener = new View.OnClickListener() { public void onClick(View v) { //find the index that matches the button's ID, and then reset //the MediaPlayer instance, set the data source to the corresponding //sound effect, prepare it, and start it playing. for(int i = 0; i &lt; buttonIds.length; i++) { if(v.getId() == buttonIds[i]) { selectedSo…
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31416801
score: 0
has comment: http://stackoverflow.com/comment/31416825
answer count: 1
has comment: http://stackoverflow.com/comment/31416924
has title: Sound Board Ringtone/notification tones
has comment: http://stackoverflow.com/comment/31416949
type: UnansweredQuestion

http://stackoverflow.com/q/20861696
has comment: http://stackoverflow.com/comment/31298497
tagged with: stream
has answer: http://stackoverflow.com/a/20861749
type: AnsweredQuestion
has title: When using ObjectOutputStream/ObjectInputStream to transfer a custom object the variables are reset
has comment: http://stackoverflow.com/comment/31298414
tagged with: java
possible better answer: http://stackoverflow.com/a/20861756
has answer: http://stackoverflow.com/a/20861756
tagged with: objectinputstream
type: Question
has comment: http://stackoverflow.com/comment/31298531
answer count: 2
tagged with: network-programming
accepted answer: http://stackoverflow.com/a/20861749
score: 0
has comment: http://stackoverflow.com/comment/31298433
tagged with: objectoutputstream
has body: I have created a server-client chat room style application and I'm trying to transfer a custom object which I have created containing the message and the username of the person using client/server application. To do this I have created a separate class called message which contains two static variables, one called username and one called messageText: public class message implements Serializable{ static String username = ""; static String messageText = ""; public message(String message, String user){ System.out.println("Setting username and messageText"); username = user; messageText = message; } public message(Object recievedObject){ username = ((message) recievedObject).getUsername(); messageText = ((message) recievedObject).getMessageText(); } } I send an object of this class from my server to a client as follows: message sendMessage = new message(enteredText, "SERVER"); output.writeObject(sendMessage); It is accepted by the client as follows: message recievedMessage = (message) input.readObject(); cw.say(recievedMessage.getMessageText(), recievedMessage.getUsername()); However both methods above getMessageText() and getUsername() will return whatever the variable was initialized with on the receiving end, and return the correct values on the sending side. A few hours of trying to fix this problem has provided no solution, so any help that you guys can give me is very, very appreciated! Thanks.

tablemodel
type: Tag
tag name: tablemodel
tags question: http://stackoverflow.com/q/20967823
tags question: http://stackoverflow.com/q/20987875

http://stackoverflow.com/a/24123205
score: 2
upvote count: 2
has body: There may be a maximum number of parameter markers depending on the JDBC implementation. For instance the PostgreSQL driver represents the number of parameters as a 2-byte integer, which in Java is at most 32768.
answers question: http://stackoverflow.com/q/20883964
downvote count: 0
type: Answer

http://stackoverflow.com/comment/31551208
has text: If you paste http://localhost:8080/WebApp/SaveReading.htm into a browser, do you see the request hit in the Tomcat logs?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/20992525
type: Comment

http://stackoverflow.com/a/20952503
has body: You can make method calls from within an assert, so the syntax I'd prefer is something like: private static boolean testSomePropertyTrue(Collection&lt;T&gt; collection) { boolean test = true; for (T obj : collection){ test = test &amp;&amp; obj.someProperty(); } return test; } ... assert testSomePropertyTrue(collection); This leaves no ambiguity about code being optimized out by the JIT, and when assertions are enabled will perform the same invariant checks. As written, your second example will always create the TreeMap, regardless of whether assertions are enabled. Wrapping the entire thing in an function and evaluating it as a single assert will completely eliminate that code path at run-time. Like another answer to this question suggests, the assertions will leave behind bytecode regardless of whether they're enabled, but using the style shown above will deterministically prevent those codepaths from executing unless assertions are enabled.
downvote count: 0
score: 3
has comment: http://stackoverflow.com/comment/33281481
upvote count: 3
accepted answer of: http://stackoverflow.com/q/20941270
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20941270
type: Answer

http://stackoverflow.com/a/20878737
upvote count: 3
answers question: http://stackoverflow.com/q/20878710
has body: Does the compiler really calculate the result first as integer and then in a second step casts it to double? Yes, Runtime first calculates the RHS result and then converts the result to double. Now in your case as RHS contains int / int so the result is in int and you don't get 3.3. So if RHS contains double / int or int / double, the type promotion occurs and RHS operands are promoted to double before calculating the result and hence you get 3.3
score: 3
downvote count: 0
type: Answer

http://stackoverflow.com/comment/31478247
comment on: http://stackoverflow.com/a/20956896
type: AnswerComment
score: 0
type: Comment
has text: I only want to insert 1 record, no matter how many rows are inserted, so how can I get it to do that?

http://stackoverflow.com/q/20899477
answer count: 1
has title: How to use Window Manager in Android
favorite count: 0
accepted answer: http://stackoverflow.com/a/20899808
tagged with: android
type: AnsweredQuestion
tagged with: java
tagged with: screen
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/20899808
upvote count: 0
score: -1
has body: I want to prevent screen locking while my app is running. I have used Power Manager which consumes more battery life. I want to use Window Manager for this. How to use Window Manager for all the activities?

http://stackoverflow.com/comment/31324852
comment on: http://stackoverflow.com/q/20875189
has text: Please tell us more about your question. As is this is not very clear.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20881527
tagged with: android
duplicate of: http://stackoverflow.com/q/6343166
has answer: http://stackoverflow.com/a/20881576
score: -1
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20881576
tagged with: java
accepted answer: http://stackoverflow.com/a/20881599
downvote count: 1
type: Question
has title: Error in app on Android 4.0 or higher
has body: The app starts without a problem but at the last step it closes with: Unfortunately, "YOURAPP" has stopped. Log Cat gives me the following output, but I don't understand where the real problem is: 01-02 10:39:05.634: W/NetworkManagementSocketTagger(90): setKernelCountSet(10005, 0) failed with errno -2 01-02 10:39:05.644: W/InputManagerService(90): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@41ac4678 (uid=10005 pid=203) 01-02 10:39:22.314: D/AndroidRuntime(565): Shutting down VM 01-02 10:39:22.314: W/dalvikvm(565): threadid=1: thread exiting with uncaught exception (group=0x409961f8) 01-02 10:39:22.394: E/AndroidRuntime(565): FATAL EXCEPTION: main 01-02 10:39:22.394: E/AndroidRuntime(565): java.lang.IllegalStateException: Could not execute method of the activity 01-02 10:39:22.394: E/AndroidRuntime(565): at android.view.View$1.onClick(View.java:3039) 01-02 10:39:22.394: E/AndroidRuntime(565): at android.view.View.performClick(View.java:3480) 01-02 10:39:22.394: E/AndroidRuntime(565): at android.view.View$PerformClick.run(View.java:13983) 01-02 10:39:22.394: E/AndroidRuntime(565): at android.os.Handler.handleCallback(Handler.java:605) 01-02 10:39:22.394: E/AndroidRuntime(565): at android.os.Handler.dispatchMessage(Handler.java:92) 01-02 10:39:22.394: E/AndroidRuntime(565): at android.os.Looper.loop(Looper.java:137) 01-02 10:39:22.394: E/AndroidRuntime(565): at android.app.ActivityThread.main(ActivityThread.java:4340) 01-02 10:39:22.394: E/AndroidRuntime(565): at java.lang.reflect.Method.invokeNative(Native Method) 01-02 10:39:22.394: E/AndroidRuntime(565): at java.lang.reflect.Method.invoke(Method.java:511) 01-02 10:39:22.394: E/AndroidRuntime(565): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 01-02 10:39:22.394: E/AndroidRuntime(565): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 01-02 10:39:22.394: E/AndroidRuntime(565): at dalvik.system.NativeStart.main(Native M…
answer count: 3
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/20881599
has answer: http://stackoverflow.com/a/20881612

http://stackoverflow.com/q/20899234
answer count: 1
type: UnansweredQuestion
has body: I am working on an application which is using MongoDb as backend. I am using Java MongoClient for communication with MongoDb. As MongoClinet is thread safe this instance is used by multiple threads for writing data to mongo. My sample code is BasicDBObject document = new BasicDBObject(); try{ document.append("address", address); document.append("name", name); document.append("voterId", voterId); unProcessedPeopleCollection.insert(document); } catch (Exception e){ logger.error("Error occured while unProcessedPeopleCollection in Mongo"); logger.error(e); } I don't want mongoclient to insert immediately into database. I want it to group multiple calls into single call like after 100 or 1000 insert calls it will actually push the data in mongo. This will help me to reduce Round Trip Time for every call. Is there any option for this provided by MongoClient library or how can I handle it at programming level.
tagged with: java
has title: MongoDb grouping insert calls?
type: Question
tagged with: mongodb
score: 0
has answer: http://stackoverflow.com/a/20899322

http://stackoverflow.com/q/20943532
score: 0
has comment: http://stackoverflow.com/comment/31508176
type: UnansweredQuestion
answer count: 0
has body: I have developed a file download program, which is implemented by Java Servlet. The link sent to the user is in the following format: http://examples.com/file?id=6565_1_1_1_201110 When user clicks this link, it will send a request to a servlet program to find the file name and then download the file. In the servlet I use the following code to retrieve the id value: String param = ""; synchronized (this) { param = request.getParameter("id"); } Now the problem is, some users can get the correct value, which is 6565_1_1_1_201110. However, some users have obtained the wrong value, like 656543_1_1_1_20111067, etc, which is not fixed. I do not know where are those additional number from? Any idea on this? Thanks.
type: Question
tagged with: java
has title: request.getParameter not working
has comment: http://stackoverflow.com/comment/31453776
has comment: http://stackoverflow.com/comment/31458363
tagged with: servlets

http://stackoverflow.com/comment/33512722
comment on: http://stackoverflow.com/a/20948606
score: 0
type: AnswerComment
has text: I have marked that question for later answering (favorite). I'll look into it later.
type: Comment

http://stackoverflow.com/comment/31594574
comment on: http://stackoverflow.com/a/21018825
type: AnswerComment
score: 0
type: Comment
has text: Apache's `ChunkedInputStream` seems to be a perfect choice. Did you try it?

http://stackoverflow.com/a/21004432
accepted answer of: http://stackoverflow.com/q/21004375
answers question: http://stackoverflow.com/q/21004375
upvote count: 3
type: AcceptedAnswer
type: Answer
has body: I think you're looking for this String str = " \n \n "; System.out.println(str); Which outputs
downvote count: 0
score: 3

http://stackoverflow.com/comment/31308119
type: AnswerComment
has text: Crash again at dialogo.show() with illegalstatexception the specified child already has a parent you must call removeView().. i update mu question with full code
type: Comment
comment on: http://stackoverflow.com/a/20866627
score: 0

http://stackoverflow.com/comment/31289450
has text: Thanks, i'll use this in future but my question still stands.
score: 0
comment on: http://stackoverflow.com/q/20857252
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31587904
comment on: http://stackoverflow.com/q/21015379
score: 0
type: Comment
has text: just replace the relevant string part like this tmpTest.replace("goof", "");
type: QuestionComment

http://stackoverflow.com/a/20897817
has comment: http://stackoverflow.com/comment/32545656
upvote count: 3
has comment: http://stackoverflow.com/comment/31367135
has comment: http://stackoverflow.com/comment/31584631
type: Answer
has body: I assume you are decrypting the whole JSON string and I think you only need to decrypt this string : NJGOkF2EvOIpfKG14LHQZrVfj\/OEJvopi+OKU+q5G2ynDbVUnIckfMLGCCsxcY9+BmVg+KJXF1ls\nGf2rWg73iyowyq6THyDfBS8uZnSp9PfS3bJCFb6YWX4\/\/uxjDwtZ So you should parse the JSON and get Response string from JSON and then decrypt it. UPDATE : You can parse you json string like this : String value = "YOUR_JSON_STRING"; try { JSONObject mJsonObject = new JSONObject(value); String response = mJsonObject.getString("Response"); //Decrypt response string } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } Now you have your encrypted string in response variable. Now you can decrypt response string.
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/31836007
has comment: http://stackoverflow.com/comment/31366422
answers question: http://stackoverflow.com/q/20897662

http://stackoverflow.com/q/20950111
tagged with: java
has answer: http://stackoverflow.com/a/20950476
has body: In order to eliminate dependencies and to facilitate parallel execution between features, I want to run each feature in its own browser instance. I currently have this setup. Would appreciate directions. @CucumberOptions(..., features = "/features/"...) public class RunCukes { public static WebDriver driver = new FirefoxDriver(); } My features ... Feature: Feature-1 Scenario: A Scenario Give I login as "&lt;user&gt;" ... Feature: Feature-2 Scenario: A Scenario Give I login as "&lt;user&gt;" Step definitons... @Given("^I login as \"([^\"]*)\"$") public void I_login_as(String user) throws Throwable { try { driver.get("url"); } catch (Exception e) { //do something ( e.g.take screenshot ) and close browser } } ...
tagged with: cucumber
score: 2
downvote count: 0
type: UnansweredQuestion
favorite count: 0
has title: How to run each cucumber feature in a new browser instance?
tagged with: cucumber-jvm
has comment: http://stackoverflow.com/comment/108750967
type: Question
upvote count: 2
answer count: 1

http://stackoverflow.com/comment/31492227
has text: Yes use an array and compare values while you run it trough the loop Google sorting.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20963994

http://stackoverflow.com/comment/31444117
comment on: http://stackoverflow.com/q/20938500
score: 0
type: QuestionComment
type: Comment
has text: @BenjaminGruenbaum Not on `ArrayList` you don't :P

http://stackoverflow.com/q/20898257
tagged with: jsp
tagged with: struts2
score: 0
has answer: http://stackoverflow.com/a/20898652
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/20898313
tagged with: css
answer count: 4
has body: as simple as it seems i have no idea how to put two buttons in line with each other especially since they have different functions.i have 1 form that logs in user with a log in button and a sign up button that lets user register. they are in two different form any idea on how to align the log in button to the sign up button here is an image of my log in ang here is my code for log in jsp..can i align them with out using js or something else as much as possible i want to align them just by jsp..is there a way to do this <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib prefix="s" uri="/struts-tags"%> Login <s:form action="login"> <s:textfield label="email" key="email" name="email" size="20" /> <s:password label="password" key="password" size="20" /> <s:submit value="LogIn"/> </s:form> <!--form method="post" ACTION="pagination.jsp"> </form--> <s:form action="register.jsp"> <s:submit value="SignUp" type="submit" float="right"/> </s:form> EDIT updating code from comments in here: <s:form action="login" style="float:right"> <s:textfield label="email" key="email" name="email" /> <s:password label="password" key="password" /> <s:submit value="LogIn"/> </s:form> <!--form method="post" ACTION="pagination.jsp"> </form--> <s:form action="register.jsp" style="float:right"> <s:submit value="SignUp" type="submit"/> </s:form> UPDATE: is it possible to make it look like this ![enter image description here][2]
has answer: http://stackoverflow.com/a/20916634
type: AnsweredQuestion
has title: two button in struts inline with each other
has answer: http://stackoverflow.com/a/45839719
tagged with: java
possible better answer: http://stackoverflow.com/a/20898313
type: Question
accepted answer: http://stackoverflow.com/a/20898652

http://stackoverflow.com/a/20941347
has comment: http://stackoverflow.com/comment/31450719
score: 0
has comment: http://stackoverflow.com/comment/31450636
has comment: http://stackoverflow.com/comment/31450714
type: Answer
has body: Can any of you tell me whether the following lines would be a drag on performance on a production build (with "assert" disabled, as is the default)? Your assertion loops will be run irrespective of whether asserts are on or off (i.e. they are part of the bytecode regardless -- assertions are enabled when running code). However, I wouldn't worry about performance regarding the first snippet; the JIT will likely realize that the loop isn't doing anything and take care of it early on. For a bonus, what if I were something more complicated, including short-lived objects that are only used for the assertions? Something like your second snippet is harder to be sure about - the best thing to do would probably be to time it yourself, although in most circumstances I would imagine that it wouldn't have a noticeable effect either. Perhaps you could have a "debug" flag and use it as such: static boolean debug = true; if (debug) { // loop here }
upvote count: 1
has comment: http://stackoverflow.com/comment/69117632
has comment: http://stackoverflow.com/comment/31452071
downvote count: 1
answers question: http://stackoverflow.com/q/20941270

http://stackoverflow.com/comment/31502835
comment on: http://stackoverflow.com/a/20969660
type: Comment
score: 0
has text: Thank you for the valuable guidance
type: AnswerComment

http://stackoverflow.com/comment/31347186
has text: Yes, that's true. It assumes that c is in the correct range, as stated in the answer.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20887636
type: Comment

openldap
tags question: http://stackoverflow.com/q/20983547
tag name: openldap
tags question: http://stackoverflow.com/q/20934344
tags question: http://stackoverflow.com/q/20946063
tags question: http://stackoverflow.com/q/20877645
tags question: http://stackoverflow.com/q/20867103
type: Tag

http://stackoverflow.com/a/20887738
downvote count: 0
has comment: http://stackoverflow.com/comment/31347118
type: Answer
answers question: http://stackoverflow.com/q/20887721
upvote count: 5
has comment: http://stackoverflow.com/comment/31347146
has comment: http://stackoverflow.com/comment/31347140
has body: Timer Timer = new Timer(); Timer is not reserved, but should be changed to timer to match the Java Naming Conventions. Your code is in the wrong place; put it inside a method. Finally, don't use the Util timer, use the Swing timer. Documentation here.
score: 5

http://stackoverflow.com/comment/31527827
type: QuestionComment
has text: is prolly a good idea but I can't pull it off, I overrid the original, but it basically becomes a loop since I do setValue it calls a method which calculates and then again uses setValue and so on and so on until it becomes a stackoverflow.
comment on: http://stackoverflow.com/q/20982624
score: 0
type: Comment

http://stackoverflow.com/q/20890023
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20911420
tagged with: java
possible better answer: http://stackoverflow.com/a/20911420
answer count: 2
accepted answer: http://stackoverflow.com/a/20890090
tagged with: arrays
tagged with: string
has comment: http://stackoverflow.com/comment/31351682
has comment: http://stackoverflow.com/comment/31351944
score: 0
has body: i am new. Hope someone can help me.I want to compare a string from user input with a course title variable which is also a string type.The "course title" variable it's part of the state of a number of objects that are inserted in an array of objects. Here is the code: if (selection.equals("yes")){ System.out.print(""); System.out.print("Enter the day of exam you want to search: "); int search= ScannerUtility.readInt(); int i = 0; line 43 while( i&lt;a.length &amp;&amp; search.equals(a[i].getCourseTitle()) ){ i++; { here the console error: line 43: error: int cannot be dereferenced while( i&lt;a.length &amp;&amp; search.equals(a[i].getCourseTitle() ) ){ //Here is all the classes I am italian, thus sorry if i don't translate properly.BTW here is the ManagementExams Class: import java.util.*; public class ManagementExams{ public static void main(String[] args){ Scanner sc= new Scanner(System.in); System.out.println("MANAGEMENT EXAMS"); System.out.print("Indicate how many exams do you want to insert: "); int dim = ScannerUtility.readInt(); int nexams = 1; Exam [] a = new Exam[dim]; for(int i=0; i&lt;a.length; i++){ System.out.print("Insert the name of the exam " + nexams +":"); String coursetitle = sc.nextLine(); System.out.print("Insert the day of the exam: "); int day = ScannerUtility.readInt(); System.out.print("Insert the month of the exam: "); String month = sc.nextLine(); System.out.print("Insert the year of the exam: "); int year = ScannerUtility.readInt(); System.out.print("Insert the hour of the exam: "); int hourexam = ScannerUtility.readInt(); Exam b = new Exam(coursetitle,day,month,year,hourexam); a[i] = b; nexams++; } System.out.print("The number of exams inserted are': " + (nexams-1)+ "\n\n"); System.out.println("Print Exams: \n"); for(int i=0; i&lt;a.length; i++) System.out.println(a[i]); System.out.print("Do you want to change the day of certain exams?: "); String selection = sc.nextLine(); if (selection.equals("yes")){ System.out.print(""); System.out.p…
has answer: http://stackoverflow.com/a/20890090
has title: Compare string within an array of objects
type: Question

http://stackoverflow.com/comment/31432975
comment on: http://stackoverflow.com/q/20932847
type: Comment
type: QuestionComment
has text: I have added jav8-jsr223-win-amd64-0.6.jar in lib and i am able to use these statements in my app but the app crashes when i execute.eval().. is there any solution to it?
score: 0

http://stackoverflow.com/a/20944326
has comment: http://stackoverflow.com/comment/31456075
upvote count: 4
has comment: http://stackoverflow.com/comment/31463424
has comment: http://stackoverflow.com/comment/31458296
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20942464
answers question: http://stackoverflow.com/q/20942464
has comment: http://stackoverflow.com/comment/31688094
has comment: http://stackoverflow.com/comment/31461733
has body: I've been using this method and it worked for me. public static String addTracksToPlaylist(final long id, List&lt;MediaData&gt; tracks, final Context context) { int count = getPlaylistSize(id, context); ContentValues[] values = new ContentValues[tracks.size()]; for (int i = 0; i &lt; tracks.size(); i++) { values[i] = new ContentValues(); values[i].put(MediaStore.Audio.Playlists.Members.PLAY_ORDER, i + count + 1); values[i].put(MediaStore.Audio.Playlists.Members.AUDIO_ID, tracks.get(i).getId()); } Uri uri = MediaStore.Audio.Playlists.Members.getContentUri("external", id); ContentResolver resolver = context.getContentResolver(); int num = resolver.bulkInsert(uri, values); resolver.notifyChange(Uri.parse("content://media"), null); return String.format(context.getString(R.string.ADDED_TO_PLAYLIST), num, context.getString(R.string.CURRENT)); } Retrieving tracks from playlist: public static Cursor getTrackListFromPlaylist(Context context, long plid) { String[] MEDIA_COLUMNS = new String[] { MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media.ARTIST_ID, MediaStore.Audio.Media.TITLE, MediaStore.Audio.Playlists.Members.AUDIO_ID, MediaStore.Audio.Media.DURATION, MediaStore.Audio.Media.DATA, MINUTES + "||':'||" + SECONDS + " as " + FORMATTED_DURATION, MediaStore.Audio.Media.ALBUM_ID, MediaStore.Audio.Media.ALBUM, MediaStore.Audio.Media._ID }; return query(context, MediaStore.Audio.Playlists.Members.getContentUri("external", plid), MEDIA_COLUMNS, null, null, MediaStore.Audio.Playlists.Members.DEFAULT_SORT_ORDER); }
score: 4
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31457540
has comment: http://stackoverflow.com/comment/31463686
type: Answer

http://stackoverflow.com/a/20987757
has body: You're going to have a lot of pain doing this. What you're describing is essentially the context switching an operating system (or the JVM, in Java's case) is supposed to abstract away from needing to work with directly. Instead, you should have one thread for processing business logic, and a wholly separate thread for managing and updating the display. These two threads then communicate through a controller which either runs in its own thread or in the same thread as the business logic thread, depending on the complexity of your data transfer. This concept is called the Model-View-Controller pattern, and many, many articles have been written on how to best implement it. By separating these behaviors you can have your business logic run continuously without needing to be interrupted, and your view thread can be very simple, essentially looking like the following: while(true) { long initTime = curTime(); // this will refresh the GUI and also show any new data from the controller refresh(); sleep(curTime()-initTime); } Now of course the meat of your question, I think, is this magic sleep() method I call above. I pass it the amount of time spent updating so it can subtract that from the total desired sleep time, however the question of how to ensure the time spent actually sleeping is highly precise is more complicated. You say System.nanoTime() is imprecise in your environment, and unfortunately that may very well be a dealbreaker for you. System.nanoTime() is going to be providing the most granular elapsed-time data your OS/processor is publishing, and so if this method isn't providing the data you need, your machine / JVM may not be able to provide the granularity you need. Major game/simulation developers face this same problem, and have long since resolved it by eliminating the requirement of exact frame update times because it is simply too complicated to attempt to line up processing time with real-world time in any reliable manner (suppose, for instance, the OS…
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20986885
upvote count: 2
answers question: http://stackoverflow.com/q/20986885
type: Answer
has comment: http://stackoverflow.com/comment/31556498
has comment: http://stackoverflow.com/comment/31559665
score: 2

http://stackoverflow.com/q/20898878
has answer: http://stackoverflow.com/a/20899201
has body: I am very confused about calculation of time. I would like to set up 2 variables: Current time (for example 8:00:00) Current Time multiple by what? to get 8:00:05)(Lets say FutureTime). and Finally to check that if the current time is not greater than FutureTime will do in a process for example : if(currentTime &lt;= FutureTime) { do something } quiz program Can anyone recommend me how to do that?
has answer: http://stackoverflow.com/a/20898911
has comment: http://stackoverflow.com/comment/31368078
score: 0
tagged with: android
possible better answer: http://stackoverflow.com/a/20899201
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20898911
tagged with: java
type: Question
has title: Calculate time in Android
answer count: 2

http://stackoverflow.com/a/20996561
answers question: http://stackoverflow.com/q/20996428
score: 0
type: Answer
has body: Just add &lt;model&gt; string after &lt;?xml version="1.0" encoding="UTF-8"?&gt; and &lt;/model&gt; to the end of file. I guess it's not necessary to parse the whole document to add root element.

http://stackoverflow.com/a/20945994
has body: There are sources, you can look at them and implement fisherfaces class by youself. You can find the sources you need in file: modules\contrib\src\facerec.cpp (here is class Fisherfaces)
type: Answer
score: 0
answers question: http://stackoverflow.com/q/20937596

http://stackoverflow.com/q/20931464
upvote count: 2
tagged with: methods
has body: i am using slick2D to create a simple java game. Unfortunately my java skills are simpler than simple. This game will be a memory game, since i thought it would be simple to make. One of the problems i have is that i have a NormalMode class, and a Square class. I created a Square object in my normal mode class to call methods from Square. So, i tried to call a method of it that had "graphics g" as a perimeter, and as a result i get a null pointer exception error (Or something else i'm unaware of). Square Class: (The last method in this class is unfinished at the moment) package data.src; import java.util.Random; import org.newdawn.slick.Graphics; import org.newdawn.slick.Image; import org.newdawn.slick.SlickException; import org.newdawn.slick.state.StateBasedGame; public class Square { private StateBasedGame game; boolean correct; boolean clickable; boolean clicked; boolean started; int squares; int squareX; int squareY; public Image squareIncorrect; public Image squareCorrect; public Square() { } public boolean checkCorrect(){ return correct; } public boolean checkClickable(){ return clickable; } public boolean checkClicked(){ return clicked; } public void squareStart(int x ,int y, Graphics g){ if(correct == true){ g.drawImage(squareCorrect, x, y); } else if(correct == false){ g.drawImage(squareIncorrect, x, y); } g.drawString("Remember the blue squares!", x, y); try { wait(3000); } catch (InterruptedException e) { e.printStackTrace(); } started = true; while(started == true){ try { squareCorrect = new Image("res/squareCorrect"); } catch (SlickException e) { e.printStackTrace(); } } } public void createRandom(){ Random rand = new Random(); int sRand = rand.nextInt(1); if(sRand == 0){ correct = false; clickable = true; clicked = false; } else if(sRand == 1){ correct = true; clickable = true; clicked = false; squares++; } } public void youWin(int x, int y, Graphics g){ if(squares == 0){ g.drawString("You win!", x, y); game.enterState(0); } } } Normal Mode Class: pack…
type: Question
tagged with: object
tagged with: java
tagged with: slick2d
has comment: http://stackoverflow.com/comment/31430483
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31430586
has answer: http://stackoverflow.com/a/20932748
favorite count: 0
has comment: http://stackoverflow.com/comment/31430409
tagged with: nullpointerexception
accepted answer: http://stackoverflow.com/a/20932748
score: 2
type: AnsweredQuestion
has title: Calling a method with Graphics g as perimeter

http://stackoverflow.com/a/20989156
type: Answer
answers question: http://stackoverflow.com/q/20989009
score: 0
has body: the standard kind of imports that you have used only import the classes - so everything within a class must be referenced using the class name. just use: Approach.sharedMethod() and now the compiler will be able to know which method to use all depending on which Approach class you have imported at the top. Just to clarify: import approach1.Approach; public class Tester { public static void main(String[] args) { Approach.sharedMethod("TEXT"); } } is different from import approach2.Approach; public class Tester { public static void main(String[] args) { Approach.sharedMethod("TEXT"); } } You should only specify the class name and leave it to the package import statement at the top to determine which package to find the class/methods from. You only need to explicitly mention the package in the main program body if there is a conflict in names or if you have not imported anything.

http://stackoverflow.com/a/20919318
upvote count: 3
has comment: http://stackoverflow.com/comment/31410947
has body: SOLVED: struts.xml: <result name="success" type="json"> action result,tspNameIdMap.* </result-type> I added action to my code and it solved the problem. Refer to this link from where I solved: http://blog.mattsch.com/2011/04/14/things-discovered-in-struts-2/ Since Struts 2.2.3 the root object is always considered to be the model if the action is model >driven. This means that when creating the JSON request only the model will get serialized. In >some cases one might use model driven for receiving requests and send something else in the >response. Then the root object has to be changed. This can be done by setting the root >parameter as shown above.
score: 3
has comment: http://stackoverflow.com/comment/31408837
answers question: http://stackoverflow.com/q/20918867
has comment: http://stackoverflow.com/comment/31408753
accepted answer of: http://stackoverflow.com/q/20918867
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31408638
has comment: http://stackoverflow.com/comment/31407961
type: Answer

http://stackoverflow.com/comment/31413187
score: 0
comment on: http://stackoverflow.com/q/20922621
type: QuestionComment
type: Comment
has text: can you post `MainActivity` please?

http://stackoverflow.com/comment/31435951
type: QuestionComment
has text: @NPE "Unlike the binary search which guarantees a halving of the interval's size with each stage, a misled interpolation may reduce/increase the mid index by only one, thus resulting in a worst-case efficiency of O(n)." This algorithm seems too dependent on the data, and on the interpolation choosing algorithm. Seems worst-case can be as bad as linear. No?
comment on: http://stackoverflow.com/q/20934412
score: 0
type: Comment

http://stackoverflow.com/a/20998897
upvote count: 8
answers question: http://stackoverflow.com/q/20998673
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/54551012
score: 8
has comment: http://stackoverflow.com/comment/54552521
type: Answer
has body: You can use a StackLayout to achieve what you want: private static boolean buttonOnTop = true; public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("StackOverflow"); shell.setLayout(new FillLayout()); Button switchButton = new Button(shell, SWT.NONE); switchButton.setText("Switch"); final StackLayout layout = new StackLayout(); final Composite content = new Composite(shell, SWT.NONE); content.setLayout(layout); final Button button = new Button(content, SWT.PUSH); button.setText("Button"); final Label label = new Label(content, SWT.NONE); label.setText("Label"); layout.topControl = button; switchButton.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event arg0) { layout.topControl = (buttonOnTop) ? label : button; content.layout(); buttonOnTop = !buttonOnTop; } }); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } By setting StackLayout#topControl you can "move" your Control to the top.
downvote count: 0
has comment: http://stackoverflow.com/comment/54552473
accepted answer of: http://stackoverflow.com/q/20998673
has comment: http://stackoverflow.com/comment/54550927

http://stackoverflow.com/q/20945829
upvote count: 1
linked to: http://stackoverflow.com/q/1965249
has answer: http://stackoverflow.com/a/20954708
tagged with: enums
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/c
has title: Automating the addition of Java-enum-like capabilities for an enum
type: Question
has answer: http://stackoverflow.com/a/20967175
answer count: 2
downvote count: 0
favorite count: 0
tagged with: c++
has body: In Java, enums come with several capabilities missing from C/C++ enums. I would like to be able to define enums with, say, some macro ENUM(Color, Red, Green, Blue) or ENUM(Color, {Red, Green, Blue} ) or what-not, and have an enum defined with these capabilities implemented somehow. Specifically, I would like to be able to do the following: for (Color p : Color::values()) { } and Color color(Red); cout &lt;&lt; "My face shone a bright " &lt;&lt; color; and Color color = valueOf&lt;Color&gt;("Green"); /* ... */ cout &lt;&lt; "It ain't easy being " &lt;&lt; color; Notes: Bonus points if the solution lets me specify the (integral) value for each enum value (e.g. Red is 2, Green is 5, Blue is 19). Bonus points if the solution lets me specify the 'inherited type', a-la enum Color : unsigned char { Red, Green, Blue}; Suggestions using Boost are welcome, although I would rather stick to just the standard library. I'm not 'married' to macros. This question relates to this one, but is not the same. That question is concerned mainly with allowing multiple data fields, while I don't care about that and am satisfied with a proper single-type enum.
type: UnansweredQuestion

http://stackoverflow.com/comment/31379384
comment on: http://stackoverflow.com/q/20902662
has text: exactly, you are right, thats correct
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31572836
type: QuestionComment
comment on: http://stackoverflow.com/q/21005416
has text: It certainly compiles, but I won't have a chance to test it until I fix everything else that's broken in the code. I was just curious if that would be the right way to go about it.
score: 0
type: Comment

http://stackoverflow.com/q/20867021
has answer: http://stackoverflow.com/a/20867890
tagged with: android
answer count: 4
tagged with: http://stackoverflow.com/tag/xml
tagged with: android-edittext
type: UnansweredQuestion
has title: dialog and edittext listener: crash at setEnabled
upvote count: 1
has answer: http://stackoverflow.com/a/20867069
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/20867055
downvote count: 0
tagged with: button
score: 1
has answer: http://stackoverflow.com/a/20867057
has body: Hello I am going crazy to understand where is the problem in this dialog. I am trying to create one dialog with inside an edittext.. If the edittext is empty the positive button must be disabled else enabled. I wrote this code. public class Example extends AlertDialog { AlertDialog.Builder builder; EditText mEditText; Context mContext; Button button; String text; protected Example(Context context) { super(context); // TODO Auto-generated constructor stub builder = new AlertDialog.Builder(context); this.mContext = context; mEditText = new EditText(mContext); builder.setView(mEditText); builder.setPositiveButton("Okay", null); builder.setNegativeButton("No", null); mEditText.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { AlertDialog dialog = builder.create(); text = mEditText.getText().toString(); if(text.trim().length()&gt;0) { button = dialog.getButton(AlertDialog.BUTTON_POSITIVE); if(button != null) button.setEnabled(true); else button = dialog.getButton(AlertDialog.BUTTON_POSITIVE); button.setEnabled(false); } else button = dialog.getButton(AlertDialog.BUTTON_POSITIVE); button.setEnabled(false); } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { } }); builder.setTitle("Example Dialog"); builder.create(); builder.show(); } } When i execute this code and write something in edittext i get NullPointerException at the else inside the if at this line button.setEnabled(false); Where is the problem?
favorite count: 0

http://stackoverflow.com/q/20943047
has comment: http://stackoverflow.com/comment/31453050
upvote count: 6
tagged with: java
tagged with: hibernate
tagged with: mysql
type: Question
has body: I am having mySql query and need to transfer it in to hibernate query. I have transferred simple queries into hibernate. But its difficult for me to convert "UPDATE" query. Below is the MySql query, StringBuilder query = new StringBuilder(); query.append("UPDATE bus_transport.trip_calendar a ,"); query.append("bus_transport.trip_resource_allocator b,"); query.append("bus_transport.vehicle_calendar c ,"); query.append("bus_transport.driver_calendar d "); query.append("SET c.vehicle_status_code='Available',"); query.append("a.route_code='" + jsonObjInside.getString("rCode") + "',"); query.append("a.trip_from_date_time='" + finalStartDateTime + "',"); query.append("a.trip_to_date_time='" + finalEndDateTime + "',"); query.append("b.emp_id='" + jsonObjInside.getString("driverId") + "' ,"); query.append("b.vehicle_id='" + jsonObjInside.getString("vehId") + "',"); query.append("c.vehicle_id='" + jsonObjInside.getString("vehId")+ "' ,"); query.append("d.emp_id='" + jsonObjInside.getString("driverId") + "'"); query.append("where a.trip_id='" + jsonObjInside.getString("tripId")+ "'"); query.append(" and b.trip_id='" + jsonObjInside.getString("tripId") + "'"); query.append("and c.trip_id='" + jsonObjInside.getString("tripId")+ "'"); query.append("and d.trip_id='" + jsonObjInside.getString("tripId")+ "' "); int var = stmt.executeUpdate(query); Please help me to convert into Hibernate Update query. Thanks in advance.
has answer: http://stackoverflow.com/a/20943270
has title: How to update multiple tables in hibernate?
tagged with: sql
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
score: 6

http://stackoverflow.com/comment/31455707
has text: Please post your code to show how you "try to do the same in Java using Spring LDAP".
comment on: http://stackoverflow.com/q/20936138
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31455513
has text: Just saying it's because it's "implemented very badly" isn't a very good answer...
comment on: http://stackoverflow.com/a/20944617
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31536685
comment on: http://stackoverflow.com/a/20987754
score: 0
type: AnswerComment
has text: sotitios i havent use any view resolver i will put the code for it aswell.
type: Comment

atmosphere
tags question: http://stackoverflow.com/q/20867791
tags question: http://stackoverflow.com/q/20949043
tag name: atmosphere
type: Tag

http://stackoverflow.com/comment/31487075
type: QuestionComment
score: 2
has text: No, but you will need to get it into a BufferedImage first
comment on: http://stackoverflow.com/q/20961065
type: Comment

jboss5.x
tag name: jboss5.x
tags question: http://stackoverflow.com/q/20990292
type: Tag

http://stackoverflow.com/q/20919001
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31406536
has title: Execute batch file through java, passing file path as arguments which contains space
tagged with: batch-file
type: Question
has answer: http://stackoverflow.com/a/20919281
tagged with: windows
has comment: http://stackoverflow.com/comment/31406509
score: 0
has body: I am trying update the classpath, in batch file by providing library location. I am calling bat file through java, by passing library location as a arguments, my code executes perfectly if there is no space in library path location, If library path contains space, bat file throws exception, could not find or load a main class below is my code public class TestBat { public static void main(String[] args) throws IOException { ProcessBuilder pb = new ProcessBuilder("cmd", "/c", "start", "C:\\Users\\graymatter\\Desktop\\MyBatch.bat", "D:\\Testing\\Main Plan"); pb.start(); } } This code executes perfect, If path has "D:\Testing\MainPlan", insted of "D:\Testing\Main Plan" Here is my bat file @echo off setlocal EnableDelayedExpansion set DIR1=%1 echo %DIR1% set CLASSPATH=. FOR %%F IN ("%DIR1%"\lib\*.jar) DO (set CLASSPATH=!CLASSPATH!;%%F) java -cp %CLASSPATH% com.pentaho.support.TestBat %* So as per my knowledge am getting this error because of that space in path, I tried a lot, by using escape sequence, but no use. Even referred @ Spaces in file path in java Thanks
answer count: 1
linked to: http://stackoverflow.com/q/12191302

http://stackoverflow.com/a/20924865
has body: this is just a test, later I'll need this HashMap in the calling class for making a graph(fermate are the liefs). Can I retrieve it in another way? marcin_j has answered about the get() part. Calling get() blocks the ui thread making it asynchronous no more. Yes there is a way. You can use a interface as a callback to the activity. Check the answer by blackbelt How do I return a boolean from AsyncTask? Instead of boolean its HashMap in your case. You can also make your Asynctask an inner class of activity
downvote count: 0
has comment: http://stackoverflow.com/comment/31418334
has comment: http://stackoverflow.com/comment/31417908
has comment: http://stackoverflow.com/comment/31417947
has comment: http://stackoverflow.com/comment/31418025
type: Answer
score: 1
answers question: http://stackoverflow.com/q/20924758
has comment: http://stackoverflow.com/comment/31418516
upvote count: 1
has comment: http://stackoverflow.com/comment/31417984
has comment: http://stackoverflow.com/comment/31418288

http://stackoverflow.com/comment/31355213
score: 0
type: Comment
has text: The code in call method is executed asynchronusly but the rule for the Future is that you can pass it to another method and check result in future.
comment on: http://stackoverflow.com/a/20890503
type: AnswerComment

akka
type: Tag
tags question: http://stackoverflow.com/q/20931280
tags question: http://stackoverflow.com/q/20983441
tags question: http://stackoverflow.com/q/21000843
tag name: akka
tags question: http://stackoverflow.com/q/21014448
tags question: http://stackoverflow.com/q/20945139
tags question: http://stackoverflow.com/q/20938075

http://stackoverflow.com/a/20875170
accepted answer of: http://stackoverflow.com/q/20875110
has comment: http://stackoverflow.com/comment/31324706
answers question: http://stackoverflow.com/q/20875110
has comment: http://stackoverflow.com/comment/31324729
has body: If your app must run on Windows, do the following: 1) create .bat file with the following content: @java -Dfile.encoding=UTF8 -Xms512m -Xmx1024m -cp "%~dp0\lib\*" mypackage.MyClass %* 2) copy all jars (dependencies and main jar) to "lib" subfolder. 3) run .bat file. Trivia: -Dfile.encoding=UTF8 guarantees the same encoding for file read/write operations and for string/bytearray conversions, independently on the OS settings. -Xms512m - defines minimum memory allocated for java application. -Xmx1024m - defines maximum memory allocated for java application (it should not exceed physical memory of the target machine, otherwise the program would not start). mypackage.MyClass should be substituted with a qualified name of the class containing main function.
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31324657
type: Answer

http://stackoverflow.com/comment/31767756
type: Comment
type: QuestionComment
has text: http://stevedaskam.wordpress.com/2011/03/28/using-jpa-to-insert-and-retrieve-blobs-and-clobs/ , http://tamanmohamed.blogspot.it/2011/05/jpa-insert-and-retrieve-clob-and-blob.html and http://www.developerscrappad.com/278/java/java-ee/ejb3-x-jpa-how-to-store-an-image-file-or-a-binary-as-blob-in-database/
comment on: http://stackoverflow.com/q/20873505
score: 0

http://stackoverflow.com/q/20875507
tagged with: iteration
favorite count: 0
type: UnansweredQuestion
has title: Best algorithm to find an element in an ordered list
score: -1
has body: There is list A which contains numbers in ascending order. Similarly a list B which also contains numbers in ascending order. The result should be list C which contains numbers from A which are not in B. My Solution: I iterated through A and checked for the number in B using .contains() and added the required elements in C. I was told using .contains() is higher order of complexity O(n). Does anyone have a better solution?
has answer: http://stackoverflow.com/a/20876324
tagged with: java
downvote count: 2
upvote count: 1
type: Question
tagged with: algorithm
has comment: http://stackoverflow.com/comment/31325294
has answer: http://stackoverflow.com/a/20875540
answer count: 2

http://stackoverflow.com/q/21007770
type: UnansweredQuestion
tagged with: java
downvote count: 2
type: Question
has title: Geocoder not returning location name
score: -2
has answer: http://stackoverflow.com/a/21008237
tagged with: google-maps
upvote count: 0
answer count: 1
favorite count: 0
tagged with: android
has body: My code works just fine but the only time Geocoder returns the actual location's name is when it is something big and popular like an airport. If I try to get location's name of some building in my city, it will return the building's number. I don't understand why this happens. Can I send an address to google maps and have it return the building's name?

http://stackoverflow.com/a/20933190
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31494306
has comment: http://stackoverflow.com/comment/31494100
type: Answer
has comment: http://stackoverflow.com/comment/31492714
score: 2
answers question: http://stackoverflow.com/q/20931958
has body: Make sure to add the mysql.jar to your project. Also as noted the comment, don't swallow your exception. If you do this, you have no idea what the error or. It could be ClassNotFoundException or an SQLException which are completely different things. Once you add the ex.printStackTrace() to your catch block, if you get a ClassNotFoundException, you probably forgot to import he mysql.jar into you project. If you get an SQLExcpetion, something is either wrong with your SQL syntax or your connection syntax EDIT to include jar Download the .zip from this link Unzip it From your IDE, you need to add the .jar that's in that file, to your Libraries From Eclipse Right-click on you project Select - Buil Path => Configure Path Click on the tab Libraries, at the top Cick on Add External Jar locate the mysqul-connector.java...jar inside the file you downloaded and select it From Netbeans From your project in the project explorer, Right-click Libraries folder icon Select Add Jar/Folder Locate the .jar from the file you downloaded, and select it. If you want to create a new Library, there are other steps you should take, but just adding the .jar is sufficent. UPDATE I think the MySQL.jar comes shipped with the Netbeans IDE. Try to right-click on the Libraries folder icon Select Add library See if MySQL JDBC Driver is in there. If it is, just select it and Add Library
upvote count: 2
accepted answer of: http://stackoverflow.com/q/20931958
has comment: http://stackoverflow.com/comment/31492689
has comment: http://stackoverflow.com/comment/31494441
has comment: http://stackoverflow.com/comment/31494181

http://stackoverflow.com/q/20967508
type: Question
tagged with: logcat
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/20967539
has title: Eclipse LogCat error associated with custom font
tagged with: custom-font
answer count: 2
downvote count: 0
favorite count: 0
has body: When I launch my app I get the message "Unfortunately [app name] has stopped" on my emulator. According to my LogCat, the problem is caused by an error on line 19. Line 19 in MainActivity.java is part of my custom text view code. If I completely delete my custom text view code in MainActivity.java and the associated TextView in activity_main.xml I do not get the error. Therefore, I have pinpointed that this custom text view seems to be the root of the problem. I have tried the following troubleshooting: ensuring the .ttf font file is written in lower case ensuring the .ttf font file is actually a .tff file storing the .ttf font file under assets storing the .ttf font file under fonts subfolder in assets I have actually been on this simple issue for days. I have read numerous threads that address what seems to be my same problem, but no simple fix seems to work. Cheers in advance for your help Font file is located under assets/fonts/quicksandlight.ttf MainActivity.java package [package name not displayed]; import android.content.Intent; import android.os.Bundle; import android.app.Activity; import com.jdubbing.scissored.R; import android.widget.TextView; import android.graphics.Typeface; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.splash); TextView txt = (TextView) findViewById(R.id.customfont); Typeface font = Typeface.createFromAsset(getAssets(), "fonts/quicksandlight.ttf"); txt.setTypeface(font); Thread logoTimer = new Thread() { public void run(){ try{ int logoTimer = 0; while(logoTimer &lt; 5000){ sleep(100); logoTimer = logoTimer +100; }; startActivity(new Intent("com.jdubbing.CLEARSCREEN")); } catch (InterruptedException e) { e.printStackTrace(); } finally{ finish(); } } }; logoTimer.start(); } } activity_main.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xml…
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20967539
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/20967598
upvote count: 1
has answer: http://stackoverflow.com/a/20967598

http://stackoverflow.com/a/20908569
score: 1
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31387880
has body: protected means "package and inheritance access" so classes in the same package can access this method. EDIT: answer to your edit: it's because designers of this class wanted this method to be available ONLY to classes within the same package and no other classes (thus you cannot extend it because their made it final)
type: Answer
answers question: http://stackoverflow.com/q/20908520

http://stackoverflow.com/q/20975859
has body: Are there any conventions as to whether private methods should generally be placed above or below public methods? E.g. say caller() was refactored into two methods - where would be the more standard place out of aboveCaller() or belowCaller()? private void aboveCaller() { /*...here?...*/ } public void caller() { aboveCaller(); belowCaller(); } private void belowCaller() { /*...or here?...*/ } Although this is in Java, it is a general programming question and not really aimed at a specific language. (Apologies if it has been asked before - tried searching on here but didn't come up with anything).
has answer: http://stackoverflow.com/a/20976052
score: 6
tagged with: conventions
downvote count: 1
tagged with: coding-style
type: AnsweredQuestion
has title: Should private methods be placed above or below public methods?
tagged with: refactoring
tagged with: java
has answer: http://stackoverflow.com/a/20976062
tagged with: methods
upvote count: 7
has answer: http://stackoverflow.com/a/20975932
type: Question
possible better answer: http://stackoverflow.com/a/20976062
has comment: http://stackoverflow.com/comment/31513866
has comment: http://stackoverflow.com/comment/31513862
answer count: 3
accepted answer: http://stackoverflow.com/a/20975932
favorite count: 0

http://stackoverflow.com/comment/31590599
comment on: http://stackoverflow.com/a/21016823
score: 0
type: Comment
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/44874/discussion-between-thedarkside-ofthemoon-and-a-paul)
type: AnswerComment

http://stackoverflow.com/comment/31424495
type: QuestionComment
type: Comment
has text: @mKorbel Can you elaborate? Very new to Swing or well anything beyond the basics. This is kind of a learn and explore project.
comment on: http://stackoverflow.com/q/20928163
score: 0

http://stackoverflow.com/comment/31360552
has text: Just tested (System.currentTimeMillis() + 1 * 60 * 1000) and it worked properly. So what might be the problem?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20894018

http://stackoverflow.com/q/20972404
tagged with: android
tagged with: in-app-purchase
has comment: http://stackoverflow.com/comment/31507407
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31507954
has comment: http://stackoverflow.com/comment/31507489
type: Question
has comment: http://stackoverflow.com/comment/31508014
tagged with: java
has body: I am implementing the inapp purchase using version 3. I have setup successfully. But my problem is that when we buy item the UI does not updated any how. Here is my code try { mHelper=new IabHelper(this, base64EncodedPublicKey); mHelper.enableDebugLogging(true); mHelper.startSetup(onIabSetupFinishedListener); } catch (Exception e) { ShowDailog.Show(this, e.getMessage(), "ok"); } abHelper.OnIabSetupFinishedListener onIabSetupFinishedListener=new OnIabSetupFinishedListener() { @Override public void onIabSetupFinished(IabResult result) { if(result.isFailure()) { complain("Problem setting up in-app billing: " + result); return; } //complain("success " + result); //mHelper.queryInventoryAsync(queryInventoryFinishedListener); } }; IabHelper.QueryInventoryFinishedListener queryInventoryFinishedListener=new QueryInventoryFinishedListener() { @Override public void onQueryInventoryFinished(IabResult result, Inventory inventory) { if (result.isFailure()) { complain("Failed to query inventory: " + result); return; } if(inventory.hasPurchase(ITEM_SKU)); { mHelper.consumeAsync(inventory.getPurchase(ITEM_SKU), onConsumeFinishedListener); } } }; IabHelper.OnConsumeFinishedListener onConsumeFinishedListener=new OnConsumeFinishedListener() { @Override public void onConsumeFinished(Purchase purchase, IabResult result) { if (result.isSuccess()) { updateUI } }}; IabHelper.OnIabPurchaseFinishedListener onPurchaseFinishedListener=new OnIabPurchaseFinishedListener() { @Override public void onIabPurchaseFinished(IabResult result, Purchase purchase) { if (result.isFailure()) { if(result.getResponse() == 7) { complain("You have successfully restored"); } return; } } }; Please provide me any help where i am wrong.
tagged with: in-app-billing
has comment: http://stackoverflow.com/comment/31507830
has comment: http://stackoverflow.com/comment/31508126
score: 0
has comment: http://stackoverflow.com/comment/31507910
has title: in-app purchase UI did not updated

http://stackoverflow.com/comment/31542943
type: QuestionComment
has text: So, your problems are 1. How make 2k packet 2. how to full fill the last packet when its size is less than 2K 3. how to send the packet after that?
comment on: http://stackoverflow.com/q/20990103
score: 0
type: Comment

http://stackoverflow.com/a/20932482
has body: Interfaces can never be directly instantiated. extracur student1=new extracur(); // not possible And you should capitalize interface names. You need instead: Extracur student1 = new Extracur() { // implement your methods }; Explanation: The code does not instantiate the interface, but an anonymous inner class which implements the interface. You should also understand that the compiler throws an error at compile time while you are trying to catch an error at runtime (too late in this case).
has comment: http://stackoverflow.com/comment/31432181
has comment: http://stackoverflow.com/comment/31432203
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/20932464
answers question: http://stackoverflow.com/q/20932464

http://stackoverflow.com/comment/31626767
has text: may be this work `AnchorPane page = (AnchorPane) fxmlLoader.load(url.openStream()); detailPane.getChildren().clear();///name of pane where you want to put the fxml detailPane.getChildren().add(page);`
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20983955

http://stackoverflow.com/q/20861790
has answer: http://stackoverflow.com/a/20861817
upvote count: 0
score: -7
answer count: 3
tagged with: menu
favorite count: 0
tagged with: compiler-errors
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31298685
has comment: http://stackoverflow.com/comment/31298697
has body: package tic.tac.toe.menu; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.StackPane; import javafx.stage.Stage; public class TicTacToeMenu extends Application { @Override public void start(Stage primaryStage) { Button start = new Button(); start.setText("How to Play?"); start.setOnAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent event) { System.out.println("\n"+"The goal of tic-tac-toe is to get 3 of your pieces in a row vertically, horizontally, or diagonally "); System.out.println("To play this game click inside a square to put down your piece, you choose to be 'x' or 'o' at the start"); } }); StackPane root = new StackPane(); root.getChildren().add(start); Scene scene = new Scene(root, 350, 250); primaryStage.setTitle("Tic-Tac-Toe"); primaryStage.setScene(scene); primaryStage.show();} public void exit(Stage primaryStage) { Button exit = new Button(); exit.setText("Quit?"); exit.setOnAction(new EventHandler&lt;ActionEvent&gt;() { public void handle(ActionEvent event) { System.exit(0); })} // this line I get the error StackPane root=new StackPane(); root.getChildren().add(exit); Scene scene = new Scene(root, 350, 250); primaryStage.setScene(scene); primaryStage.show(); } } I am new to Java and I am trying to make a menu but on line 40 I get an error that says illegal start of type and am confused what that means. I think I am doing the syntax wrong but not sure what to fix.
tagged with: syntax
has title: Java Illegal start type ) expected
has answer: http://stackoverflow.com/a/20861823
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/31298666
has comment: http://stackoverflow.com/comment/31298713
downvote count: 7
has answer: http://stackoverflow.com/a/20861827
type: Question

http://stackoverflow.com/comment/31528672
type: Comment
score: 1
comment on: http://stackoverflow.com/a/20966783
type: AnswerComment
has text: Behold, O(1) solution. Do you have 1000 constants or something?

http://stackoverflow.com/q/20984081
has answer: http://stackoverflow.com/a/20984221
has title: Hibernate Configuration with Spring MVC for testing
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
score: 1
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/20986782
tagged with: mysql
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/20986407
has body: I'm trying to set up testing with an H2 in-memory database for my Spring MVC application. Right now, all my configuration for Hibernate is in a Java file PersistenceConfig.java and it holds the SessionFactory with all the Hibernate configuration. However, my testing context is in XML because it was easier that way - is there any way to make this work? Right now, when I run my tests, all I get is errors because it can't connect to MySQL, which it shouldn't even be trying to do. &lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt; &lt;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:jdbc="http://www.springframework.org/schema/jdbc" 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-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.0.xsd"&gt; &lt;!-- annotation support --&gt; &lt;context:annotation-config/&gt; &lt;!-- support for transaction --&gt; &lt;tx:annotation-driven transaction-manager="transactionManager"/&gt; &lt;context:component-scan base-package="com.package.configuration" /&gt; &lt;context:component-scan base-package="com.package.models" /&gt; &lt;!-- H2 datasource --&gt; &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt; &lt;property name="driverClassName" value="org.h2.Driver"/&gt; &lt;property name="url" value="jdbc:h2:mem:test;MODE=MySQL;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=TRUE"/&gt; &lt;property name="username" value="sa"/&gt; &lt;property name="password" value=""/&gt; &lt;/bean&gt; …
answer count: 3

http://stackoverflow.com/comment/31295756
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20854122
has text: You have to issue a CREATE TABLE statement to created the IMPORTED_CSV table before you can select from it. Also, to get more information about what's going wrong on the Derby side: http://wiki.apache.org/db-derby/UnwindExceptionChain And learn to find your derby.log file on disk and read it, it will have more information, particularly if you run with -Dderby.language.logStatementText=true.

http://stackoverflow.com/comment/31542140
type: Comment
score: 0
comment on: http://stackoverflow.com/q/20991172
type: QuestionComment
has text: why is there a final?

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/20941374
tags question: http://stackoverflow.com/q/20961279
type: Tag
tags question: http://stackoverflow.com/q/20985517

http://stackoverflow.com/comment/31578707
type: Comment
has text: I did, I put a `Log` in this loop and watched on my device as the UI was blocked, the Loop was continuing. This is it. (the code above).
type: AnswerComment
comment on: http://stackoverflow.com/a/21010595
score: 0

http://stackoverflow.com/a/20998838
has body: If you didnt write the CSVReader class by yourself then this constructor will skip the first line of the file: CSVReader reader = new CSVReader(new FileReader(file), ',', '\'', 1);
has comment: http://stackoverflow.com/comment/31557530
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31556748
answers question: http://stackoverflow.com/q/20998787
upvote count: 2

http://stackoverflow.com/q/20852389
type: Question
downvote count: 0
answer count: 1
favorite count: 0
has title: VMWare : The stack size specified is too small, Specify at least 228k
has body: I am using Spring Tools Suit 3.2.0.RELEASE.When I try to start the VMware server, I get the following error Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. The stack size specified is too small, Specify at least 228k I searched in Google. Got this answer. I changed the STS.ini to following -clean -vm /usr/lib/jvm/java-7-oracle/bin/java -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar --launcher.library plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20120913-144807 -product org.springsource.sts.ide --launcher.defaultAction openFile -vmargs -Dosgi.requiredJavaVersion=1.6 -Xms1024m -Xmx2048m -XX:PermSize=1024m -XX:MaxPermSize=2048m -Xss8m And I restarted STS, and OS also. But still I am getting same error. Is there anywhere else I need to change? I am using Ubuntu 12.04
tagged with: ubuntu-12.04
type: UnansweredQuestion
upvote count: 1
linked to: http://stackoverflow.com/q/18772373
score: 1
has answer: http://stackoverflow.com/a/21328638
tagged with: java
tagged with: spring-tool-suite
tagged with: eclipse

http://stackoverflow.com/q/20946618
has comment: http://stackoverflow.com/comment/31459554
tagged with: java
has comment: http://stackoverflow.com/comment/31467668
type: Question
score: 0
tagged with: jsoup
has answer: http://stackoverflow.com/a/20948520
answer count: 1
has body: I am reading a text file that contains HTML code from Google search results. Then I parse it and I try to extract the links with this code: FileReader in = new FileReader("A.txt"); BufferedReader p = new BufferedReader(in); while(p.readLine() != null) { String html = p.readLine(); Document doc = Jsoup.parse(html); Elements Link = doc.select("a[href"); for(Element element :Link) { if(element != null) { System.out.println(element); } } } But I got many non-link strings. How can I show the links, not anything else?
linked to: http://stackoverflow.com/q/3727662
tagged with: http://stackoverflow.com/tag/html
tagged with: parsing
has comment: http://stackoverflow.com/comment/31459234
type: UnansweredQuestion
has title: How to extract links from Google HTML result page?

http://stackoverflow.com/a/20996794
accepted answer of: http://stackoverflow.com/q/20996710
type: Answer
score: 1
upvote count: 1
has body: When a variable is static, this means that you'll have one url for all instances, and not per object. You don't want each construction of an object to change url. However, if you still want to do this, you can access it like SoapClient.url. (In your code, url will always hold the value of the last constructed object).
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20996710

http://stackoverflow.com/comment/31568140
has text: Well "fails" means what? What errors are you getting? I know you are getting a number of exceptions but aren't telling us.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20988575

binary-tree
tag name: binary-tree
tags question: http://stackoverflow.com/q/20957023
type: Tag
tags question: http://stackoverflow.com/q/20921287
tags question: http://stackoverflow.com/q/20890929
tags question: http://stackoverflow.com/q/20879602

http://stackoverflow.com/q/21006601
has body: Lets say I have a graph and a starting node. Each note has a weight. The problem is to find all paths from the starting node where the sum of weights of the nodes are, say, five. A simple approach is to do a depth first search, and, on discovering the sum of the current path is five, you could simply copy the solution into a list of solutions. This simply solution would require you to search the entire tree until there are no more possibilities. What if you only needed one solution? Or two? Or the best out of 100? Wouldn't this approach waste potentially a large amount of memory storing all solutions? I imagine you could write some sort of Iterator, where .next() simply continues the search until it finds a new path. This way you waste no storage or computation time. I figured I'd ask if such a known pattern, or solution, or algorithm exists before trying to reinvent the wheel. Additionally: My actual problem is a special Iterator which finds all trees matching a certain condition, but I assumed the answer to the more general path problem would lead me closer to the solution to my problem. Any information on this would also be very much appreciated.
tagged with: java
has answer: http://stackoverflow.com/a/21007016
type: Question
tagged with: iterator
has comment: http://stackoverflow.com/comment/31571159
tagged with: algorithm
has title: Finding all paths though a graph. Is it possible (how?) to create an iterator of results, and would it be more efficient?
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21006898
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/5204444
tagged with: tree

http://stackoverflow.com/a/20993987
has comment: http://stackoverflow.com/comment/31547174
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
has body: Log4J, by default, will look for a log4j.xml file first, and only if it can't find it - will look for log4j.properties. You can override this by setting the log4j.configuration system property to point at the exact configuration file you're interested in.
answers question: http://stackoverflow.com/q/20992730
has comment: http://stackoverflow.com/comment/31547121
accepted answer of: http://stackoverflow.com/q/20992730

http://stackoverflow.com/comment/31367708
has text: Did you by accident register two listeners to the combo box?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20898619

http://stackoverflow.com/a/20932488
has comment: http://stackoverflow.com/comment/31433622
accepted answer of: http://stackoverflow.com/q/20932470
has comment: http://stackoverflow.com/comment/31432476
downvote count: 1
score: 2
upvote count: 3
has comment: http://stackoverflow.com/comment/31432625
has comment: http://stackoverflow.com/comment/31432389
has body: double parsed = Double.parseDouble(priceList.get(j).replace(',', '.')); Or you could also use a DecimalFormat with the appropriate locale or symbols.
answers question: http://stackoverflow.com/q/20932470
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31432582
has comment: http://stackoverflow.com/comment/31434114
has comment: http://stackoverflow.com/comment/31432525
type: Answer

http://stackoverflow.com/q/20897588
accepted answer: http://stackoverflow.com/a/20897623
has body: Ok so I'm trying to make a command line calculator where it detects if your trying to add/subtract/multiply/divide using the String.contains method. Multiplication and division work just fine, but when I try to add or subtract, it spits out a bunch of errors. Can someone please tell me what I'm doing wrong? import java.util.Scanner; public class CalculatorCode { public static void main(String[] args) { while(true){ Scanner input = new Scanner(System.in); String userinput = input.nextLine(); if(userinput.contains("x")){ String[] multiply = userinput.split("x"); String multiply1 = multiply[0]; String multiply2 = multiply[1]; double a = Double.parseDouble(multiply1); double b = Double.parseDouble(multiply2); double multoutput = a * b; System.out.println(a + "x" + b + "=" + multoutput); } if(userinput.contains("/")){ String[] divide = userinput.split("/"); String divide1 = divide[0]; String divide2 = divide[1]; double c = Double.parseDouble(divide1); double d = Double.parseDouble(divide2); double divideoutput = c/d; System.out.println(c + "/" + d + "=" + divideoutput); } if(userinput.contains("-")){ String[] subtract = userinput.split("-"); String subtract1 = subtract[1]; String subtract2 = subtract[2]; double e = Double.parseDouble(subtract1); double f = Double.parseDouble(subtract2); double suboutput = e - f; System.out.println(e + "-" + f + "=" + suboutput); } if(userinput.contains("+")){ String[] add = userinput.split("+"); String add1 = add[1]; String add2 = add[2]; double g = Double.parseDouble(add1); double h = Double.parseDouble(add2); double addoutput = g - h; System.out.println(g + "-" + h + "=" + addoutput); } } } } Errors for addition: Exception in thread "main" java.util.regex.PatternSyntaxException: Dangling meta character '+' near index 0 + ^ at java.util.regex.Pattern.error(Pattern.java:1713) at java.util.regex.Pattern.sequence(Pattern.java:1878) at java.util.regex.Pattern.expr(Pattern.java:1752) at java.util.regex.Pattern.compile(Pattern.java:1460) at j…
has answer: http://stackoverflow.com/a/20897694
has comment: http://stackoverflow.com/comment/31365891
score: -1
type: AnsweredQuestion
has title: Why doesn't addition/subtraction symbol string splitting not work?
tagged with: java
downvote count: 2
linked to: http://stackoverflow.com/q/9169249
upvote count: 1
has answer: http://stackoverflow.com/a/20897654
has comment: http://stackoverflow.com/comment/31365939
has comment: http://stackoverflow.com/comment/31366011
type: Question
has answer: http://stackoverflow.com/a/20897760
has answer: http://stackoverflow.com/a/20897811
has answer: http://stackoverflow.com/a/20897623
tagged with: arrays
possible better answer: http://stackoverflow.com/a/20897654
has answer: http://stackoverflow.com/a/20897717
has comment: http://stackoverflow.com/comment/31365878
answer count: 7
tagged with: calculator
has comment: http://stackoverflow.com/comment/32698756
favorite count: 0
has answer: http://stackoverflow.com/a/20897675

http://stackoverflow.com/comment/31339952
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20883969
score: 3
has text: You can use HTML in Swing components. See [this tutorial](http://docs.oracle.com/javase/tutorial/uiswing/components/html.html) for more details.

http://stackoverflow.com/comment/31436192
has text: You should explain much more about the actual device (even the hardware), how it is configured and seen on the Linux system, etc...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20932344

http://stackoverflow.com/q/20940398
type: UnansweredQuestion
has body: I have to make a list of pilots with their number of flying hours and make a slective sort ascending and descending. I made the ascending selective sort of hours but i don't know how to make the program to show the ascending order of names based on hours. This is what I did. Can you help me? int arr[]={50,150,100,250,200,24,376,541,56,164}; int arrLength = arr.length; for(int i=0;i&lt;arrLength-1;i++){ int min=i; for (int k=i+1;k&lt;arrLength;k++){ if(arr[k]&lt;arr[min]){ min = k; } } if (i != min) { int temp=arr[i]; arr[i]=arr[min]; arr[min]=temp; } } for (int j=0;j&lt;arrLength;j++) { System.out.println(arr[j]+" ");} } }
has answer: http://stackoverflow.com/a/20940433
tagged with: java
has answer: http://stackoverflow.com/a/20940423
type: Question
upvote count: 1
score: -2
answer count: 3
downvote count: 3
has comment: http://stackoverflow.com/comment/31447919
has answer: http://stackoverflow.com/a/20940421
has title: Selective Sort in Java
favorite count: 0

http://stackoverflow.com/comment/65606245
score: 0
has text: Please, show me example ?
type: Comment
comment on: http://stackoverflow.com/a/20966672
type: AnswerComment

http://stackoverflow.com/comment/31320303
has text: Unfortunately that didn't do it, I'm still getting the same issue...
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20872626
type: Comment

http://stackoverflow.com/a/20969811
has comment: http://stackoverflow.com/comment/31599530
has comment: http://stackoverflow.com/comment/31599137
has comment: http://stackoverflow.com/comment/31509828
upvote count: 1
has comment: http://stackoverflow.com/comment/31508311
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31603658
has comment: http://stackoverflow.com/comment/31591710
has comment: http://stackoverflow.com/comment/31598036
type: Answer
answers question: http://stackoverflow.com/q/20968797
has comment: http://stackoverflow.com/comment/31599872
accepted answer of: http://stackoverflow.com/q/20968797
downvote count: 0
score: 1
has body: Could it help you, if you use one or more additional field(s), where you update/increment the wanted value eg. total_rm or total_diff Then you do not need total(), but you can access the value directly with SELECT total_rm FROM testtable WHERE time_abs=14 AND x1='vessel2') Of course you should create an index over time_abs.
has comment: http://stackoverflow.com/comment/31509433
has comment: http://stackoverflow.com/comment/31597694
has comment: http://stackoverflow.com/comment/31604989

http://stackoverflow.com/q/20978874
has body: The Code listed below works just fine, but it's function is to look into an XML file and if the field is 'us' to move it to another directory; what I would like to know about using the .choice() function: 1) How do I specify a specific file to be routed? (Adding the filename to the end of the path did not work) 2) How do I specify a filetype to be routed? (Ex: route all .txt files to "blah") 3) Are there other options besides using .choice that will help me to do this? CamelContext context = new DefaultCamelContext(); context.addRoutes(new RouteBuilder() { public void configure() throws Exception { from("file:C:\\camels\\inner?delete=true") .choice() .when(xpath("/author/country = 'us'")) .to("file:C:\\testing"); } }); context.start(); Thread.sleep(10000); context.stop();
tagged with: apache-camel
tagged with: routes
answer count: 2
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/20979966
has title: Apache-Camel Choice on Filetype
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20979922
has answer: http://stackoverflow.com/a/20979922
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/20979966
score: 1
tagged with: java

http://stackoverflow.com/comment/31572902
score: 0
type: QuestionComment
type: Comment
has text: @SLaks You are correct. Using string manipulation to produce (or, even worse, edit) JSON strings is a VERY bad idea in general.
comment on: http://stackoverflow.com/q/21006718

http://stackoverflow.com/comment/31470560
type: AnswerComment
has text: If you call finalize on purpose (and use otherObject.a = this) and then make it unreachable again, the gc wont collect it and it will create a memory leak. wrong?
type: Comment
comment on: http://stackoverflow.com/a/20952282
score: 0

http://stackoverflow.com/q/20978111
type: Question
has answer: http://stackoverflow.com/a/20978268
tagged with: java
has body: UDP Implement: @Override protected Void doInBackground(Void... params) { try { this.clientSocket = new DatagramSocket(); this.IPAddress = InetAddress.getByName("10.0.0.2"); this.sendData = new byte[1024]; } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } public void mouse(int x, int y) { try { String sentence = "{" + x + "," + y + "}"; this.sendData = sentence.getBytes(); DatagramPacket sendPacket = new DatagramPacket(this.sendData, this.sendData.length, this.IPAddress, 9871); this.clientSocket.send(sendPacket); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } @Override public boolean onTouchEvent(MotionEvent event) { Log.v("tests", "test"); if(event.getAction() == MotionEvent.ACTION_DOWN ){ oldX = (int) event.getX(); oldY = (int) event.getY(); } else if(event.getAction() == MotionEvent.ACTION_MOVE ){ newX = (int) event.getX(); newY = (int) event.getY(); xDiff = newX - oldX; yDiff = newY - oldY; Log.v("xdiff", ""+xDiff); Log.v("ydiff", ""+yDiff); oldX = newX; oldY = newY; a.mouse(xDiff, yDiff); } else if(event.getAction() == MotionEvent.ACTION_UP){ } return true; } python udp serv: import socket PORT = 9871 IP = socket.gethostbyname(socket.gethostname()) sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # UDP sock.bind((IP, PORT)) print "Server %s" % IP while True: data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes if data: print "received message:", data else: print "dead" LogCat: 01-07 17:18:51.509: E/InputEventReceiver(583): Exception dispatching input event. 01-07 17:18:51.517: D/AndroidRuntime(583): Shutting down VM 01-07 17:18:51.517: W/dalvikvm(583): threadid=1: thread exiting with uncaught exception (group=0x40a13300) 01-07 17:18:51.567: E/AndroidRuntime(583): FATAL EXCEPTION: ma…
upvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
score: -1
has title: Android working on api 10 but not 16
downvote count: 1
tagged with: android-emulator

http://stackoverflow.com/q/20886375
has comment: http://stackoverflow.com/comment/31344513
has body: I'm using the iText library with Java and I have an issue, let me explain: I have a Word file converted into a PDF and i want to add a table at the end of the document, this works perfectly except when the Word file hasn’t active the feature "No Color" at the tab "Page Layout", the table adds it as "invisible". I've already tried to change the property Font from the Chunk object that created the content, but it does not work, the table continues showing as "invisible". How I can solve this The following code is the one that I use to create the table: Font font = new Font(1,fontSize, Font.BOLD); font.setColor(0,0,0); Chunk name = new Chunk(v_emp.getNombre(),font); Chunk tipo = new Chunk(v_emp.getDireccion(),font); Paragraph paragraph = new Paragraph(); paragraph.add(tipo); paragraph.add(new Chunk("\n")); paragraph.add(name); PdfPCell cell1 = new PdfPCell(paragraph); cell1.setPadding(2); table.addCell(cell1);
tagged with: ms-word
favorite count: 0
score: -1
type: Question
has comment: http://stackoverflow.com/comment/31347631
downvote count: 2
tagged with: java
tagged with: itext
upvote count: 1
has title: Content invisible using Itext in Java
answer count: 1
has answer: http://stackoverflow.com/a/20887310
type: UnansweredQuestion
tagged with: invisible
tagged with: http://stackoverflow.com/tag/pdf

http://stackoverflow.com/q/20924970
tagged with: variables
linked to: http://stackoverflow.com/q/2921945
favorite count: 0
has answer: http://stackoverflow.com/a/20927246
has body: I'm trying to learn Java and OOP by creating a monopoly banker program. However, I would like some object variables to be saved after I exit the program, so that after playing half of a monopoly game I can exit my program and then restart it with all the player balances saved. I'm guessing this requires some sort of database? Here is a section of my code; I am trying to save the "balance" variable for all of my objects (players) after I exit my program. public class Monopoly { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here //creates the users (name classes) players player1 = new players(); players player2 = new players(); players player3 = new players(); players player4 = new players(); while (true) { player1.balance=player1.finalbalance; player2.balance=player2.finalbalance; player3.balance=player3.finalbalance; player4.balance=player4.finalbalance;
has comment: http://stackoverflow.com/comment/31417699
upvote count: 6
answer count: 4
has answer: http://stackoverflow.com/a/20927404
type: UnansweredQuestion
score: 6
has answer: http://stackoverflow.com/a/20925531
tagged with: exit
has title: How to save object variables after closing my program?
tagged with: java
tagged with: database
has answer: http://stackoverflow.com/a/20925045
type: Question
has comment: http://stackoverflow.com/comment/31417713
downvote count: 0

http://stackoverflow.com/q/20943378
has title: Why the result of this java program is '44'?
type: Question
has answer: http://stackoverflow.com/a/20943413
accepted answer: http://stackoverflow.com/a/20943478
upvote count: 5
answer count: 6
possible better answer: http://stackoverflow.com/a/20943492
has answer: http://stackoverflow.com/a/20943492
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/20943433
score: 5
has answer: http://stackoverflow.com/a/20943478
type: AnsweredQuestion
has body: I thought the result could be '43' because the type of q was 'poly 1'. However, the result was '44'. I couldn't understand that. please give me the answer. class poly1 { int a; public poly1(){ a = 3; } public void print_a(){ System.out.print(a); } } public class poly2 extends poly1{ public poly2(){ a = 4; } public void print_a(){ System.out.print(a); } public static void main(String[] args){ poly2 p = new poly2(); p.print_a(); poly1 q = new poly2(); q.print_a(); } }
tagged with: java
has answer: http://stackoverflow.com/a/20943527
has answer: http://stackoverflow.com/a/20943566

http://stackoverflow.com/comment/31474174
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20953875
has text: `I am running it on a phone don't have stracktrace` Yes you do. put the phone in debug mode, and plug it in. Or, run on an emulator. anyway, you can, and you must, post a stacktrace.

http://stackoverflow.com/comment/31531527
type: AnswerComment
type: Comment
has text: i will just update the answer if i receive the reply!
comment on: http://stackoverflow.com/a/20984883
score: 0

http://stackoverflow.com/comment/31530536
score: 2
has text: Correct. You need the filePattern attribute so that the rollover mechanism knows how to rename the old log files (and potentially zip them).
comment on: http://stackoverflow.com/a/20979723
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/107780479
type: Comment
has text: How can we be sure that the last write to the array will be visible, if the increment happens before?
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/20890642

http://stackoverflow.com/a/67170503
type: Answer
answers question: http://stackoverflow.com/q/20940769
score: 0
has body: Its quite simple. Do the following - Add the following maven dependency to your pom.xml com.yahoofinance-api YahooFinanceAPI 3.15.0 and then in the java class, you wish to use, type the following to get stock data YahooFinance.get("GOOG")

http://stackoverflow.com/q/20883656
tagged with: servlets
upvote count: 2
tagged with: front-controller
has body: For the current project I'm working on, I've decided to use the front controller pattern. I've always been under the impression that a front controller should (ultimately) be responsible for everything that happens in a web app. Would listeners violate this pattern? public class MyDatabase implements ServletContextListener { public void contextInitialized(ServletContextEvent event) { ... String driver = context.getInitParameter("driver"); } } This, of course, seems a lot simpler than: public class FrontController extends HttpServlet { public void service (....) { MyDatabase db = new MyDatabase(context.getInitParameter("driver")); } } This is a very simplified example; there would be more parameters in practice. So, which snippet would be considered more faithful to the front controller pattern – passing the config from FrontController down, or supplying the config directly to the classes? As I am new to Java, I am trying to learn servlets without using a framework (for the time being).
answer count: 1
downvote count: 0
favorite count: 0
tagged with: listener
has comment: http://stackoverflow.com/comment/31339423
score: 2
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/20883820
type: Question
has title: Java Servlets - Front Controller Questions (Listeners & Context)
has answer: http://stackoverflow.com/a/20883820

http://stackoverflow.com/q/20930601
has answer: http://stackoverflow.com/a/20947904
possible better answer: http://stackoverflow.com/a/20954024
has title: Unable to properly deploy Play2 app in CloudBees
type: AnsweredQuestion
tagged with: playframework-2.0
type: Question
has body: I am trying to deploy a Play 2 application in the cloud in CloudBees. I followed the instructions given in the CloudBees documentation. The database(mysql) gets created and the application gets deployed. Looking at the configuration, all seems fine Application : pareeje/playconfig Title : pareeje/playconfig Created : Sun Jan 05 11:05:06 IST 2014 Status : active URL : playconfig.pareeje.cloudbees.net clusterSize : 1 container : java_free containerType : play2 hibernateTimeout: 21600 maxMemory : 256 proxyBuffering : false securityMode : PUBLIC serverPool : stax-global (Stax Global Pool) But when I try to run the application, it fails stating 502 Bad Gateway, and the Logs display - Application is not running. I do not know where I am going wrong. Is there any link, which explains the process step by step with a real example. That may help me to proceed. Thanks.
tagged with: cloudbees
tagged with: java
has answer: http://stackoverflow.com/a/20954024
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/20947904

http://stackoverflow.com/a/20950309
type: Answer
upvote count: 3
score: 3
has body: Obviously your map contains a Key which maps to a null. Some Implementations of the Map interface allow the null key and/or the null value. from the javadoc Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key. More formally, if this map contains a mapping from a key k to a value v such that (key==null ? k==null : key.equals(k)), then this method returns v; otherwise it returns null. (There can be at most one such mapping.) A return value of null does not necessarily indicate that the map contains no mapping for the key; it's also possible that the map explicitly maps the key to null. The containsKey operation may be used to distinguish these two cases.
answers question: http://stackoverflow.com/q/20950182
downvote count: 0

http://stackoverflow.com/comment/35536175
comment on: http://stackoverflow.com/a/21017299
score: 0
type: Comment
has text: I'm running with `test-kitchen` that I installed on April-21-2014. Any advice on how to deal with this same error - `Error executing action `install` on resource 'java_ark[jdk]`
type: AnswerComment

http://stackoverflow.com/q/21010061
has comment: http://stackoverflow.com/comment/31578206
linked to: http://stackoverflow.com/q/2548262
has comment: http://stackoverflow.com/comment/31578111
accepted answer: http://stackoverflow.com/a/21010290
score: 0
tagged with: java
answer count: 3
has title: I get the error "AWT-EventQueue-0" java.lang.NullPointerException and i do not understand why in my context
has body: I am making a game and have a class to print out everything on the screen. I get an error on this line: g.drawImage(chImage, imageP.x*scale, imageP.y*scale, null); is it because i have null at the end of it? I have looked up this error and tried to figure it and i understand that something is null in that line but i can not figure out what is null or how to fix that. If you need me to post the other classes i can. From my google searches so far i think that it might have something to do with the way that my variables are initialized. package Game; import java.awt.Graphics; import java.awt.Point; import java.awt.Rectangle; import java.awt.image.BufferedImage; import java.util.ArrayList; import javax.swing.JPanel; public class Printer extends JPanel{ private Map map; private Character ch; private int scale; private Point imageP; private BufferedImage chImage; private ArrayList&lt;Rectangle&gt; part; public Printer(int scale1){ scale = scale1; map = new Map(); ch = new Character(); imageP = ch.getPoint(); chImage = ch.getImage(); part = map.setPart(); } protected void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(chImage, imageP.x*scale, imageP.y*scale, null); for(int i=0; i&lt;part.size(); i++){ Rectangle temp = new Rectangle(part.get(i)); g.drawRect(temp.x, temp.y, temp.width, temp.height); g.fillRect(temp.x, temp.y, temp.width, temp.height); } } } package Game; import java.awt.Graphics; import java.awt.Point; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.JPanel; //Creates a image for a character and allows him to walk around the screen public class Character extends JPanel{ private BufferedImage image; private Point imageP; private int speed; private int scale; private int width; private int height; public Character(){ } public Character(int x, int y, int scale1, int w, int h){ super(); try { i…
has comment: http://stackoverflow.com/comment/31578373
has comment: http://stackoverflow.com/comment/31578018
tagged with: nullpointerexception
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21010148
has answer: http://stackoverflow.com/a/21010120
has answer: http://stackoverflow.com/a/21010290
has answer: http://stackoverflow.com/a/21010148
has comment: http://stackoverflow.com/comment/31578989
has comment: http://stackoverflow.com/comment/31579278
type: Question

http://stackoverflow.com/q/20867290
duplicate of: http://stackoverflow.com/q/10084787
linked to: http://stackoverflow.com/q/20865824
tagged with: java
has title: Failed to get my image loaded
has comment: http://stackoverflow.com/comment/31309091
tagged with: eclipse
answer count: 1
downvote count: 1
duplicate of: http://stackoverflow.com/q/20865824
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31309083
upvote count: 0
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/10084787
has body: I am trying to add a picture of a cow and eclipse is failing me. It won't allow any images, I think I may be doing my path wrong, but I am getting it straight from the properties that eclipse supplies upon right-clicking the image. So if anyone has any idea why my picture fails to load please tell me. NO ERROR MESSAGE! package odin; import java.awt.event.*; import javax.swing.*; public class Main extends JFrame implements ActionListener{ JPanel mypanel; JButton mybutton; JLabel mylabel; int Counter = 0; public Main(){ mypanel = new JPanel(); mybutton = new JButton("OK"); mybutton.addActionListener(this); mylabel = new JLabel(); JLabel imgLabel = new JLabel(new ImageIcon("/GuiTest/src/odin/COW.png")); mypanel.add(mybutton); mypanel.add(mylabel); mypanel.add(imgLabel); this.add(mypanel); } public static void main(String[] args){ Main first = new Main(); first.setTitle("First Attempt"); first.setSize(800,600); first.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); first.setVisible(true); first.setResizable(false); first.setLocationRelativeTo(null); } @Override public void actionPerformed(ActionEvent e) { if(e.getSource()==mybutton) { Counter = Counter + 1; mylabel.setText("My Clicks " + Counter); } } }
has answer: http://stackoverflow.com/a/20867335
tagged with: swing
score: -1

http://stackoverflow.com/comment/31367689
has text: API Docs is your friend, always try to look there. http://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html#BigDecimal(java.lang.String, java.math.MathContext)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20898675
score: 3

http://stackoverflow.com/q/20942369
has body: After spending a long time writing (what I like to think of as a nice program), I'm looking to clean up my code, and do some commenting so that its easy to read and looks nice and crisp. My question is, when do I use the different types of commenting? Block, Single Line, JavaDoc, etc. For example, if you take my code (just one method). How would I go about commenting it "correctly" public static String decipher(String cipherText, String key, String originalKey) { String cipher = cipherText; String plainText; int currentLetter; int cl = 0; StringBuilder deciphered = new StringBuilder(); while (deciphered.length() != key.length()) { for (int x = 0; x &lt; cipherText.length(); x++) { String plaintextVal; Character cipherChar = cipherText.charAt(x); Character keyChar = key.charAt(x); String currentCipherLetter = cipherChar.toString(); String currentKeyLetter = keyChar.toString(); int cipherVal = letters.indexOf(currentCipherLetter) + 1; int keyVal = letters.indexOf(currentKeyLetter) + 1; if (cipherVal - keyVal &lt; 0) { int negativeVal = cipherVal - keyVal; plaintextVal = letters.get((cipherVal - keyVal - 1) + 26); } else if (cipherVal - keyVal - 1 &lt; 0 &amp;&amp; cipherVal - keyVal &gt; 0) { plaintextVal = letters.get(0); } else if (cipherVal - keyVal == 0) { plaintextVal = letters.get(25); } else { plaintextVal = letters.get(cipherVal - keyVal - 1); } deciphered.append(plaintextVal); } } plainText = deciphered.toString(); System.out.println(cipherText + "/" + originalKey + " = " + plainText); return plainText; } Also, if you could give me an example of WHAT I should actually write in these comments, I don't exactly know what is not needed(useless info) vs Useful commenting. If you write a commented example with my code, just guess what the functions do. All help/suggestions is appreciated. Hopefully this question can help people in the future as well. Thanks, Sully
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31451714
favorite count: 0
has title: How to "Correctly" Comment a program, using different commenting styles and when to use them?
type: AnsweredQuestion
score: -5
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20942416
has comment: http://stackoverflow.com/comment/31451704
downvote count: 5
tagged with: comments
accepted answer: http://stackoverflow.com/a/20942416
tagged with: code-cleanup

http://stackoverflow.com/comment/31297718
type: AnswerComment
comment on: http://stackoverflow.com/a/20857152
type: Comment
has text: You are welcome, Check this link - http://stackoverflow.com/questions/1665595/how-to-use-axis-wsdl2java-generated-files and read the links provided
score: 0

http://stackoverflow.com/comment/31465823
has text: Exactly I have no idea, but sadly that’s my requirement.... Any alternative method is also cool....
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20950424
score: 0

http://stackoverflow.com/comment/31421026
has text: You should debug what exactly is the content of "filename". Maybe there is a non-digit char in (for example spaces or the file extension).
type: Comment
score: 1
comment on: http://stackoverflow.com/q/20926630
type: QuestionComment

http://stackoverflow.com/q/20954443
answer count: 1
type: UnansweredQuestion
tagged with: code-signing
has comment: http://stackoverflow.com/comment/31515898
has comment: http://stackoverflow.com/comment/31492882
tagged with: security
tagged with: applet
has comment: http://stackoverflow.com/comment/31557161
type: Question
has title: Code signing certificate has to be imported from Java console to view Publisher correctly and avoid signature error
has body: We have purchased a code signing certificate, and I have signed an Applet jar with this certificate, using the jarsigner command and certificate in .pfx format. But when the applet is loaded in the browser, it shows the "Publisher Unknown" and "digital signature could not be verified" error.If I import the certificate from Java Control Panel -> Security -> Certificates -> Signer CA, the Publisher starts showing up correctly and "Digital signature is verified" message appears. My question is that as we are signing the jar with a trusted certificate, then why do I have to still import the certificate to see correct results? Shouldn't it show the Publisher correctly/verify signature correctly , even without having to import it?
has answer: http://stackoverflow.com/a/21015068
score: 0
tagged with: java
tagged with: certificate
has comment: http://stackoverflow.com/comment/31527880

http://stackoverflow.com/comment/31533160
score: 1
has text: You don't actually show what you're putting into the array...that would help a bit in dealing with the context.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20985719

http://stackoverflow.com/comment/31305796
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20865395
score: 0
has text: can't you remove the second line and replace (first) in condition statement by (list.get(0))?

http://stackoverflow.com/a/20890837
has body: you are writing to standard out, if there is no listener for that stream then no worries.
score: 0
has comment: http://stackoverflow.com/comment/31353776
type: Answer
has comment: http://stackoverflow.com/comment/31353242
answers question: http://stackoverflow.com/q/20890790

http://stackoverflow.com/a/20875633
type: Answer
answers question: http://stackoverflow.com/q/20875578
score: 0
has body: Most maps, including HashMap, make no promises about order of contents. Consider SortedMap, or maintaining both a hash map and a sorted list in parallel. Difference between HashMap, LinkedHashMap and TreeMap

http://stackoverflow.com/comment/31413424
has text: read up on MediaRecorder - you're calling "reset" ; you probably want to release()... you're also not setting your "recording" flag properly. This is really just debugging - helping you understand how a service and broadcast receiver work together is one thing, but you should be able to solve this at this point.
comment on: http://stackoverflow.com/a/20871528
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/20899266
type: Answer
has comment: http://stackoverflow.com/comment/31368832
upvote count: 1
has comment: http://stackoverflow.com/comment/31369281
has comment: http://stackoverflow.com/comment/31371331
downvote count: 0
has comment: http://stackoverflow.com/comment/31372060
has comment: http://stackoverflow.com/comment/31371697
has comment: http://stackoverflow.com/comment/31378726
has comment: http://stackoverflow.com/comment/31369710
has comment: http://stackoverflow.com/comment/31378942
score: 1
has comment: http://stackoverflow.com/comment/31372029
answers question: http://stackoverflow.com/q/20899235
has comment: http://stackoverflow.com/comment/31378892
has body: Change to mApplication = (MyApplication)getApplicationContext(); Edit: Delete the second application tag and move this to the first android:name="com.android.app.MyApplication" Edit: public class MyApplication extends Application { private static MyApplication singleton; public MyApplication getInstance(){ return singleton; } public void onCreate() { super.onCreate(); singleton = this; } // other methods } Then in Activity mApplication = MyApplication.getInstance(); Example: public class Main extends Activity{ ArrayList<HashMap<String,String>> arraylist = new ArrayList<HashMap<String,String>>(); MyApplication mapp; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.main); mapp = MyApplication.getInstance(); TextView tv = (TextView) findViewById(R.id.textView1); tv.setText("My String from Application class is"+mapp.hello); for(int i=0;i<10;i++) { HashMap<String,String> map = new HashMap<String,String>(); map.put("key", "value"+i); arraylist.add(map); } mapp.setArrayListMapData(arraylist); Button b = (Button) findViewById(R.id.button1); b.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub startActivity(new Intent(Main.this,MainActivity.class)); } }); } main.xml <?xml version="1.0" encoding="utf-8"?> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="51dp" android:text="TextView" /> MainActivity public class MainActivity extends ListActivity { ListView lstView; ArrayList<HashMap<String,String>> arraylist; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); MyApplication mApplication = MyApplication.getInstance(); Log.i("................",""+mApplication.hello); lstView = getListView(); lstView.se…

http://stackoverflow.com/comment/31746728
score: 0
type: Comment
has text: This answer does not reply directly to the question asked, it's actually intended to give additional information as requested in comments of my above answer.
type: AnswerComment
comment on: http://stackoverflow.com/a/21102206

http://stackoverflow.com/comment/31498346
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20967440
score: 0
has text: did u get any stack trace?

http://stackoverflow.com/a/20950820
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/20950732
has comment: http://stackoverflow.com/comment/31466827
has body: in the parent layout add android:weightsum="3" and in imagview add android:layoutwidth="0dp"
type: Answer

http://stackoverflow.com/comment/31508299
type: QuestionComment
score: 0
has text: if the user has registered then only skip the registration activity else show the register activity
comment on: http://stackoverflow.com/q/20972832
type: Comment

http://stackoverflow.com/comment/31481738
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20958513
has text: What does the object you are trying to filter look like? On what property are you trying to filter on?

http://stackoverflow.com/comment/31537561
type: QuestionComment
has text: Indentation. I miss you.
score: 4
comment on: http://stackoverflow.com/q/20988304
type: Comment

http://stackoverflow.com/a/20971435
has comment: http://stackoverflow.com/comment/31505456
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has body: If you want to replace entire words only, you can use replaceAll(), which takes a regular expression instead of a normal string, and word boundaries (\\b) like this: String aaa = msg.replaceAll("\\bass\\b", ""); You can read more on word boundaries in this excellent tutorial.
type: Answer
accepted answer of: http://stackoverflow.com/q/20971381
has comment: http://stackoverflow.com/comment/31506150
answers question: http://stackoverflow.com/q/20971381

http://stackoverflow.com/comment/31510767
comment on: http://stackoverflow.com/q/20973939
type: Comment
has text: Yes, as a number to see if it looks valid.
score: 0
type: QuestionComment

http://stackoverflow.com/a/20960832
answers question: http://stackoverflow.com/q/20959558
score: 5
type: AcceptedAnswer
upvote count: 5
type: Answer
downvote count: 0
has body: It will require some effort to code this up. The two main parts are: Querying resolved versions using the Configuration#getIncoming or Configuration#getResolvedConfiguration API Manipulating the POM using Groovy's XMlParser API (assuming the new maven-publish plugin is used) Information about the Configuration API can be found in the Gradle Build Language Reference, which further links into the Javadoc. The full Gradle distribution contains a tiny sample that demonstrates POM manipulation. Information about XmlParser can be found in the Groovy docs.
accepted answer of: http://stackoverflow.com/q/20959558

http://stackoverflow.com/comment/31350630
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20884470
has text: So how can you refer to the instance leftAction if it hasn't been created? Or are you refering to a class, not an instance? Also, sorry to bother you, but VK_RIGHT doesn't work. However RIGHT does. (Might want to change that for people looking here in the future)
score: 0

http://stackoverflow.com/a/20977054
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31519893
has body: You can try using the regex id=(\d+) and extract the value of the first capturing group: String url = "http://localhost:1111/search?id=10&amp;time=3200&amp;type=abc"; Pattern id = Pattern.compile("id=(\\d+)"); Matcher m = id.matcher(url); if (m.find()) System.out.println(m.group(1)); 10 See Pattern and Matcher.
upvote count: 2
has comment: http://stackoverflow.com/comment/31516289
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31516366
accepted answer of: http://stackoverflow.com/q/20976930
has comment: http://stackoverflow.com/comment/31517082
type: Answer
answers question: http://stackoverflow.com/q/20976930

http://stackoverflow.com/comment/31318947
comment on: http://stackoverflow.com/q/20872313
has text: I doubt RegEx is suited to this. It needs some type of parser. RegEx is powerful, but it is not magic.
type: Comment
type: QuestionComment
score: 3

http://stackoverflow.com/comment/31568649
type: Comment
has text: @fo_x86: Sometimes the nearest representable value is lower than the original value, sometimes it is higher. In the case of 2.3, it is lower. In the case of .1, it is higher, 0.1000000000000000055511151231257827021181583404541015625. Then multiplying by 100,000 happens to produce exactly 10,000, due to rounding. Converting that to an `int` produces 10,000. Dividing by 100,000 produces 0.1000000000000000055511151231257827021181583404541015625, which is displayed as “.1”.
comment on: http://stackoverflow.com/a/21004990
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31490754
type: AnswerComment
score: 0
has text: I would need to set NETWORK_SETTINGS_DONE back to false some time after the catch is done right? in case if the problem arises again and the catch block would need re-executing
type: Comment
comment on: http://stackoverflow.com/a/20963036

http://stackoverflow.com/a/21014584
answers question: http://stackoverflow.com/q/21014448
type: Answer
has body: Here's code that implements a producer/consumer model using Akka, the Scala framework for actors. https://github.com/paulbutcher/AkkaProducerConsumerBenchmarks/tree/master/src This is from the following web page: http://paulbutcher.com/2013/01/22/benchmarking-producerconsumer-in-akka/ There's also akka-camel, with built-in Producer and Consumer classes: http://doc.akka.io/docs/akka/snapshot/scala/camel.html
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21014448
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/20870351
has title: Object casting Subclass/Superclass
type: UnansweredQuestion
has body: Would someone explain the concept of casting objects in Java and the usage of a subclass in place of a superclass? Also the usage of a superclass in place of a subclass? I have read a few books and online material but I just don't get this concept for some reason... For example if a have this class structure where object is the base class and Vehichle extends the object class. Then if we have 2 additional classes "Car" which extends "Vehichle" and "Motorcycle" which also extends vehicle. How does the object casting work? When would an explict cast be needed? When would the cast be implicit? Object | Vehicle | Car - Motorcycle
tagged with: java
has answer: http://stackoverflow.com/a/20870389
type: Question
duplicate of: http://stackoverflow.com/q/5306835
has answer: http://stackoverflow.com/a/20870594
linked to: http://stackoverflow.com/q/5306835
score: 0
answer count: 2

http://stackoverflow.com/comment/31356317
has text: @axelrod I thought the link to the official documentation was enough. What piece of the puzzle are you still missing?
comment on: http://stackoverflow.com/a/20870564
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/20958755
tagged with: java
type: Question
has body: If I have two servlets: @WebServlet (urlPatterns = {"/s1"}) public class Servlet1 extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { Map&lt;String, Integer&gt; map = new HashMap&lt;String, Integer&gt;(); map.put("A", 100); map.put("B", 200); map.put("C", 300); req.setAttribute("map", map); getServletContext().getRequestDispatcher("Servlet2").forward(req, resp); } } public class Servlet2 extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { Map map = (Map) req.getAttribute("map"); for (Object o : map.values()) { System.out.println(o); } } } How can I make redirect between them? And which path I need to use in my getRequestDispatcher method? And one more condition - Servlet2 must be without any mapping in annotations or in web.xml.
has comment: http://stackoverflow.com/comment/31482196
has comment: http://stackoverflow.com/comment/31482509
has answer: http://stackoverflow.com/a/20958787
has comment: http://stackoverflow.com/comment/31482302
tagged with: servlets
has comment: http://stackoverflow.com/comment/31482290
score: 0
tagged with: requestdispatcher
accepted answer: http://stackoverflow.com/a/20958787
answer count: 1
has title: How to redirect from one servlet to another by using tricky redirection?
tagged with: http-redirect
type: AnsweredQuestion

http://stackoverflow.com/a/20867792
has body: Here's the explanation, partly as a cautionary tale: the output was being added to an ArrayList in the XML node that accessed it the XML nodes were created by cloning prototypes the ArrayList was initialised in the declaration, not in the initialise() method of the class, so every instance ended up referring to the same object. Duh. Another two days of my life down the drain! Happy new year...
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/20858207
answers question: http://stackoverflow.com/q/20858207

http://stackoverflow.com/q/20992593
score: 2
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: java
tagged with: ssl
has title: Different Exceptions when using tomcat remote and local java.net.SocketException SSLHandshakeException
type: Question
upvote count: 2
tagged with: sslhandshakeexception
tagged with: tomcat
favorite count: 0
has body: I'm writing a JUNIT-Test to test a connection to tomcat 7.0.47 over HTTPS/TLSv1.1 with a corrupted Client-Certificate. When I run my test against a remote tomcat everything works fine, I get an SSLHandshakeException. When I run the same test against a local tomcat I get this error: java.net.SocketException: Software caused connection abort: socket write error But on the tomcat logs I could see that the request and the client certificate has arrived and was checked in tomcat. Does anyone have an idea why there are different Exceptions? The configurations and versions of both tomcats are the same.

http://stackoverflow.com/q/20995393
score: 1
tagged with: java
upvote count: 1
has body: Following is my flume Sink code to split event and store in Hbase,It gives me error when it takes null event public class MyHbaseEventSerializer implements HbaseEventSerializer { @Override public void configure(Context context){} @Override public void initialize(Event event, byte[] columnFamily) { this.payload = event.getBody(); this.cf = columnFamily; this.e = event; } @Override public List&lt;Row&gt; getActions() throws FlumeException { List&lt;Row&gt; actions = Lists.newArrayList(); try{ // here splitting event and store in Hbase. }catch(Exception e){ throw new FlumeException("Could not get row key!", e); } return actions } @Override public List&lt;Increment&gt; getIncrements() { List&lt;Increment&gt; incs = new LinkedList&lt;Increment&gt;(); } @Override public void close() {} } It Continuous infinite with this error ERROR : [SinkRunner-PollingRunner-DefaultSinkProcessor] (org.apache.flume.SinkRunner$PollingRunner.run:160) - Unable to deliver event. Exception follows. java.lang.IllegalStateException: begin() called when transaction is OPEN! at org.apache.flume.channel.BasicTransactionSemantics.begin(BasicTransactionSemantics.java:131) at org.apache.flume.sink.hbase.HBaseSink.process(HBaseSink.java:234) at org.apache.flume.sink.DefaultSinkProcessor.process(DefaultSinkProcessor.java:68) at org.apache.flume.SinkRunner$PollingRunner.run(SinkRunner.java:147) at java.lang.Thread.run(Thread.java:724) Has any one solution to resolve this Thanks in advance..
type: Question
downvote count: 0
has title: HbaseSink Flume Exception
favorite count: 0
tagged with: hbase
type: UnansweredQuestion
tagged with: flume
answer count: 0

http://stackoverflow.com/a/20879459
has body: its very random suggestion but did you set up elasticsearch with custom claster name? if yes, maybe try to add it to settings then?
type: Answer
score: 0
answers question: http://stackoverflow.com/q/20879056
has comment: http://stackoverflow.com/comment/31339217

http://stackoverflow.com/a/20875738
answers question: http://stackoverflow.com/q/20875032
has body: Since you're using html content, you need to use html markup to control the formatting. Just putting in line breaks and whitespace isn't going to do it unless you're willing to use text/plain instead of text/html.
upvote count: 2
type: Answer
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20875032
score: 2
downvote count: 0

http://stackoverflow.com/a/20987975
has body: To get the name try System.out.println(a.getClass().getInterfaces()[0]); System.out.println(b.getClass().getSuperclass()); Output: interface testPackage.InterfaceClass class testPackage.AbstractClass If you want to check if an object is an instance of a class, try instanceof. Edit: If you want to get the type the variables were declared with, you can use reflection. This works if these are fields, in other words, if they are declared as class fields, no local variables. System.out.println(Test.class.getDeclaredField("a").getType()); // Test is the name of the main' method class System.out.println(Test.class.getDeclaredField("b").getType());
downvote count: 0
answers question: http://stackoverflow.com/q/20987910
score: 3
upvote count: 3
type: Answer

http://stackoverflow.com/q/20886727
score: 0
accepted answer: http://stackoverflow.com/a/20886760
answer count: 1
has comment: http://stackoverflow.com/comment/31345570
has comment: http://stackoverflow.com/comment/31345239
duplicate of: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/31345605
has comment: http://stackoverflow.com/comment/31345691
has comment: http://stackoverflow.com/comment/31345014
has title: How to break loop
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31345263
has body: I have tried all the ways i can think of to break this loop, but none have worked. I was wondering if anyone can help. import java.io.*; import java.util.*; public class Tester { public static void main(String args[]) { int j; for(j=5;j&gt;4;j++) { Scanner kbReader = new Scanner(System.in); System.out.print("Type in a sentence and press ENTER. "); String a = kbReader.next( ); String b = a.toUpperCase(); System.out.println(b); if( b == "EXIT" ) break; } } }
tagged with: java
has answer: http://stackoverflow.com/a/20886760
type: Question
has comment: http://stackoverflow.com/comment/31345292

http://stackoverflow.com/comment/66339014
comment on: http://stackoverflow.com/q/20902290
has text: Header says "how to resize image with opencv" but answer describes to resize a "cropped image" not a Java File or Java Buffered Image or something else. So my question is "how to get Mat object out of BufferedImage or at least File?"
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31413649
type: QuestionComment
comment on: http://stackoverflow.com/q/20922777
has text: So I should know how to load jar with floating name.
score: 0
type: Comment

http://stackoverflow.com/a/20999903
type: Answer
score: 0
has body: It's either the socket or the outputStream. In ConnectBT, you don't check if socket is not null. You directly call socket.connect() assuming socket is valid. The same applies to outputStream. You use it before making sure it's not null. Also you call startActivityForResult(enableBluetooth, 0); but you don't check for the result which is whether bluetooth got enabled or not. This makes your device also suspicious. Calling loadPairedDevice(); connectBT(); makes sense only when bluetooth is enabled. Enabling bluetooth can take couple of seconds, but you call them right away.
answers question: http://stackoverflow.com/q/20997968

http://stackoverflow.com/a/20906254
has body: I think you can just use ProcessBuilder like so; String[] cmd = { "java.exe", "-jar", "updater.jar", updateURL, workingPath }; ProcessBuilder pb = new ProcessBuilder(cmd); try { Process p = pb.start(); } catch (IOException e) { e.printStackTrace(); } System.exit(0); You might also use SwingUtilities to invokeLater() like so javax.swing.SwingUtilities.invokeLater(new Runnable() { @Override public void run() { Runtime.getRuntime().exec( "java.exe -jar updater.jar " + updateURL + " " + workingPath); } } );
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20906018

http://stackoverflow.com/comment/31536107
score: 0
type: QuestionComment
type: Comment
has text: then your parsing is not right. follow the docs
comment on: http://stackoverflow.com/q/20987043

http://stackoverflow.com/a/20860867
score: 36
type: AcceptedAnswer
has body: javaee.jar ships with neither eclipse nor java(jdk). The file must be manually downloaded and added to the project build path. The java ee 7 api can be found here. Alternatively, a maven dependency can be used: javax javaee-api 7.0
accepted answer of: http://stackoverflow.com/q/20859379
type: Answer
answers question: http://stackoverflow.com/q/20859379
upvote count: 36
downvote count: 0
has comment: http://stackoverflow.com/comment/58772227

http://stackoverflow.com/comment/31381111
score: 0
type: AnswerComment
has text: this is a really good idea - i try it in the future!
type: Comment
comment on: http://stackoverflow.com/a/20905839

http://stackoverflow.com/comment/31456939
type: QuestionComment
comment on: http://stackoverflow.com/q/20945529
has text: Please this I want...I am new here.
score: 0
type: Comment

http://stackoverflow.com/q/21000550
has title: Eclipse and GWT looking for inherited module in wrong package, despite gwt.xml file having correct path?
score: 1
favorite count: 0
type: Question
tagged with: package
has body: Upon attempting to run my Google Web Application I've been working on in Eclipse using GWT, it gives me this error: "Loading modules com.example.pbot.Pbot Loading inherited module 'com.example.pbot.Pbot' [ERROR] Unable to find 'com/example/pbot/Pbot.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source? [ERROR] shell failed in doStartup method" All of my packages are com.pbot, com.pbot.client, com.pbot.server, etc; I don't know where it's seeing com.example. The entry-point class in the gwt.xml file is com.pbot.client.Pbot, which is my entry point class. Here's the full gwt.xml: --&gt; &lt;!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd"&gt; &lt;module rename-to='pbot'&gt; &lt;!-- Inherit the core Web Toolkit stuff. --&gt; &lt;inherits name='com.google.gwt.user.User'/&gt; &lt;!-- Inherit the default GWT style sheet. You can change --&gt; &lt;!-- the theme of your GWT application by uncommenting --&gt; &lt;!-- any one of the following lines. --&gt; &lt;inherits name='com.google.gwt.user.theme.clean.Clean'/&gt; &lt;!-- &lt;inherits name='com.google.gwt.user.theme.standard.Standard'/&gt; --&gt; &lt;!-- &lt;inherits name='com.google.gwt.user.theme.chrome.Chrome'/&gt; --&gt; &lt;!-- &lt;inherits name='com.google.gwt.user.theme.dark.Dark'/&gt; --&gt; &lt;!-- Other module inherits --&gt; &lt;!-- Specify the app entry point class. --&gt; &lt;entry-point class='com.pbot.client.Pbot'/&gt; &lt;!-- Specify the paths for translatable code --&gt; &lt;source path='client'/&gt; &lt;source path='shared'/&gt; &lt;/module&gt; I've cleaned, refreshed and restarted the project, I don't know what else to do. Where is it reading "com.example?" Please help!
has answer: http://stackoverflow.com/a/21000698
tagged with: http://stackoverflow.com/tag/xml
tagged with: java
answer count: 2
upvote count: 1
tagged with: eclipse
tagged with: gwt
has comment: http://stackoverflow.com/comment/31591338
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21012941
downvote count: 0

http://stackoverflow.com/comment/31544421
comment on: http://stackoverflow.com/q/20992493
score: 0
has text: Which language do you use?
type: QuestionComment
type: Comment

http://stackoverflow.com/a/20932335
type: Answer
answers question: http://stackoverflow.com/q/20932244
upvote count: 1
has body: Hi you never used the the value of dayOfMonthString as you only assigned the values to it on the based of conditions but never used in logic so it is saying that it was never used.
downvote count: 0
score: 1

http://stackoverflow.com/comment/31320324
has text: Well presumably it can't find that resource. Unfortunately you haven't given us any information about how you expect it to find the resource. Where is it? Is the class in a jar file?
comment on: http://stackoverflow.com/q/20873026
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31439350
comment on: http://stackoverflow.com/a/20935067
type: Comment
has text: I am still facing the same error. Please suggest me some other alternative.
score: 0
type: AnswerComment

http://stackoverflow.com/a/20951945
upvote count: 6
answers question: http://stackoverflow.com/q/20951766
type: AcceptedAnswer
downvote count: 0
has body: What did you expect to happen? You create a new empty entity, then you exit. You don't persist() the entity with an entity manager (or in Hibernate terms, save() to a Session). So it never exists as far as the database is concerned. It is just a plain Java object like any other, and gets garbage collected when the last reference to it is removed. You need to: Use the Configuation to produce a SessionFactory and store the SessionFactory somewhere accessible. You don't want to create this all the time, it should be created on startup. Container-managed persistence and injection can be handy here. Obtain a Session from the SessionFactory Pass the new object to Session.save(...), so it gets INSERTed in the DB after proper key generation, etc. It might be a good idea to re-read a Hibernate and/or JPA tutorial to cover the basics of the object life cycle. The Getting Started Guide may be a good starting point, particularly the section on native Hibernate APIs. Personally, if I was doing basic stuff I'd use the JPA APIs instead, though. PersistenceUnit, EntityManager, etc. See Getting started with Hibernate and JPA.
type: Answer
score: 6
accepted answer of: http://stackoverflow.com/q/20951766

http://stackoverflow.com/comment/31516743
type: Comment
has text: Got some help from this : Specify the date format in XMLGregorianCalendar[1] [1]: http://stackoverflow.com/questions/14060161/specify-the-date-format-in-xmlgregoriancalendar
type: QuestionComment
comment on: http://stackoverflow.com/q/20970088
score: 0

http://stackoverflow.com/comment/31391962
has text: @pjs Ok, yes a min heap according to ordering. So for 1,2,3 with a reverse natural order, 3 will be considered like the minimum and it'll be at the root of the min heap. Thanks :)
score: 0
comment on: http://stackoverflow.com/a/20910906
type: AnswerComment
type: Comment

http://stackoverflow.com/q/20947260
score: 14
has comment: http://stackoverflow.com/comment/31459821
has answer: http://stackoverflow.com/a/20947279
upvote count: 14
has title: How to print last two digits of given integer a=1234 in java
favorite count: 0
has answer: http://stackoverflow.com/a/20947307
answer count: 4
downvote count: 0
has answer: http://stackoverflow.com/a/70525659
type: UnansweredQuestion
has body: If i'm giving values like a=1234, i want to print last two digits 34 only.. can anyone give me solution for this... int a=1234; System.out.print(a);
tagged with: java
has answer: http://stackoverflow.com/a/20947343
type: Question

hql
tag name: hql
tags question: http://stackoverflow.com/q/21014838
tags question: http://stackoverflow.com/q/20868973
tags question: http://stackoverflow.com/q/20920015
tags question: http://stackoverflow.com/q/20913975
tags question: http://stackoverflow.com/q/21005407
type: Tag
tags question: http://stackoverflow.com/q/20899975

http://stackoverflow.com/q/20976375
possible better answer: http://stackoverflow.com/a/20978088
favorite count: 0
tagged with: bytebuffer
has answer: http://stackoverflow.com/a/20978088
has comment: http://stackoverflow.com/comment/31516479
tagged with: aes
has answer: http://stackoverflow.com/a/20977963
has answer: http://stackoverflow.com/a/20980040
has comment: http://stackoverflow.com/comment/31515458
tagged with: encryption
upvote count: 1
type: AnsweredQuestion
has title: Java NIO + AES Encryption from Client to Server - ByteBuffer issue
has body: I'm quite a newbie regarding encryption and NIO, I have the following code for client: String key1 = "1234567812345678"; byte[] key2 = key1.getBytes(); SecretKeySpec secret = new SecretKeySpec(key2, "AES"); Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.ENCRYPT_MODE, secret); byte[] encrypted = cipher.doFinal(msg.getBytes()); System.out.println("Encrypted info: " + encrypted); String send = encrypted.toString(); bytebuf = ByteBuffer.allocate(48); bytebuf.clear(); bytebuf.put(send.getBytes()); bytebuf.flip(); while(bytebuf.hasRemaining()) { nBytes += client.write(bytebuf); } and the following code for server: // Server receives data and decrypts SocketChannel socket = (SocketChannel) key.channel(); ByteBuffer buf = ByteBuffer.allocate(1024); nBytes = socket.read(buf); String data = new String(buf.array()).trim(); String key1 = "1234567812345678"; byte[] key2 = key1.getBytes(); SecretKeySpec secret = new SecretKeySpec(key2, "AES"); Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.DECRYPT_MODE, secret); byte[] decrypted = cipher.doFinal(data.getBytes()); System.out.println("Decrypted Info: " + new String(decrypted)); When a message is sent from the Client to the Server, "HELLO" for example is encrypted to [B@34d74aa5 and on the Server side I get *Data packet found as [B@34d74aa5. Till here everything looks fine, but I get the following exception: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16 when decrypting with padded cipher I suspect that I have some issue with the way the data is coming out of the buffer on the server side? Any ideas on this? UPDATE: **Based on Erickson's answer this is the final solution javax.crypto.BadPaddingException: Given final block not properly padded Client Code: String key1 = "1234567812345678"; byte[] key2 = key1.getBytes(); byte[] iv = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; IvParameterSpec ivspec = new IvParameterSpec(iv); SecretKeySpec secret = new SecretKeySpec(key2…
tagged with: java
accepted answer: http://stackoverflow.com/a/20977963
tagged with: nio
has comment: http://stackoverflow.com/comment/42677246
type: Question
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/31515780
score: 1

http://stackoverflow.com/comment/31409093
comment on: http://stackoverflow.com/q/20920448
type: QuestionComment
has text: Are `CMax` and `datas` correctly initialized ?
type: Comment
score: 2

http://stackoverflow.com/comment/31412914
score: 0
type: Comment
type: QuestionComment
has text: Well, in that case, check the answers below.
comment on: http://stackoverflow.com/q/20922442

readonly
tag name: readonly
tags question: http://stackoverflow.com/q/20980517
type: Tag

http://stackoverflow.com/comment/31303418
score: 0
has text: You don't need to explicitly set variables to `null` when you're "done" with them. That advice applies only to the specific case of array elements, to keep you from inadvertently hanging on to objects you don't need anymore. As references go out of scope, they automatically get discarded.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20863989

http://stackoverflow.com/comment/31391332
type: Comment
has text: @CalifornianAcorn I would suggest you read the link suggested rather than asking to be spoon fed.
comment on: http://stackoverflow.com/a/20910861
type: AnswerComment
score: 3

http://stackoverflow.com/comment/31429675
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20931001
score: 0
has text: @chrylis, When I tried 10 times, output generated only one time...Anyway I have edited the question...

http://stackoverflow.com/q/20944759
tagged with: tomcat
favorite count: 0
has title: On trying to print JasperReports report using Java, the Tomcat Apache Server is shutting down when trying to view the report again
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21436686
downvote count: 0
score: 1
tagged with: java
has body: I am trying to use JasperReports to create reports in my project. I already have the .jrxml file generated. After that I have created the front end (a form) and on clicking "Submit", I need to print the report. On Clicking "Submit" button, I am calling the below code in my Action class (Struts 1.2), if (actionForm.get("hiddenAction").toString().equalsIgnoreCase("Submit")) { try { //DataBase connection = ConnectionHelper.getUniqueInstance().getConnectionFromPool(); Map&lt;String, Object&gt; parameters = new HashMap&lt;String, Object&gt;(); String report = "E:\\Report\\RP_BI_SUCCESS.jrxml"; String fromStrDate = "01/12/2013"; String toStrDate = "25/12/2013"; parameters.put("I_SPMID", 0); parameters.put("I_GATEWAYLKUPID", 0); parameters.put("I_FROMDATE", Utilities.convertStringDateToSQLDate(fromStrDate)); parameters.put("I_TODATE", Utilities.convertStringDateToSQLDate(toStrDate)); parameters.put("I_MODE", "A"); try { JasperReport jr = JasperCompileManager.compileReport(report); JasperPrint jasperPrint = JasperFillManager.fillReport(jr, parameters, connection); JasperViewer.viewReport(jasperPrint); jasperPrint = null; } catch (Throwable t) { t.printStackTrace(); } } } To set this up, I have used JasperReports 5.5.0 (executable JAR file) in a folder in my project. Case 1: When I click on "Submit" button, i am able to get the JasperViewer window with the necessary report i wanted. Then if i am closing the report the Tomcat Apache Server (Tomcat Apache V 7.0) is getting shut down automatically. Case 2: But if i am clicking on "Submit" again without closing the previous opened report, then its fine. Can anyone please help me to solve this issue?
type: Question
tagged with: jasper-reports
tagged with: struts
upvote count: 1
answer count: 1

data-structures
tags question: http://stackoverflow.com/q/20884455
tags question: http://stackoverflow.com/q/20962332
tag name: data-structures
tags question: http://stackoverflow.com/q/20990580
tags question: http://stackoverflow.com/q/20890929
tags question: http://stackoverflow.com/q/21010881
tags question: http://stackoverflow.com/q/20896947
tags question: http://stackoverflow.com/q/20929077
type: Tag
tags question: http://stackoverflow.com/q/20861991

http://stackoverflow.com/a/20896642
answers question: http://stackoverflow.com/q/20896401
has body: for sending mail you are using network,network operations you cna't do in main thread that is why you are getting android.os.NetworkOnMainThreadException so do the network operations in using AsyncTask ,to know more details about using AsyncTask and about the exception you are getting visit link How to fix android.os.NetworkOnMainThreadException?
has comment: http://stackoverflow.com/comment/31365875
score: 0
type: Answer

http://stackoverflow.com/a/21015544
accepted answer of: http://stackoverflow.com/q/21015238
answers question: http://stackoverflow.com/q/21015238
has comment: http://stackoverflow.com/comment/112253009
has comment: http://stackoverflow.com/comment/31587430
has body: Usually that information is stored in a special meta tag in the &lt;head&gt;. &lt;meta name="description" content="...Here goes the description your after..."&gt; So what you want to do is to parse the content of your URL looking for that meta data tag. (So no need to use the API.) And an example of how to parse and download the page can be found here Parse Web Site HTML with JAVA. But if you prefer to use the Bing API it will return the description as well in the xml or json payload, according to http://www.bing.com/developers/s/apibasics.html. Or with the Google API by using the custom search API and setting the c2coff property to 0, for more information of the API https://developers.google.com/custom-search/docs/xml_results.
has comment: http://stackoverflow.com/comment/31587445
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/31587326

http://stackoverflow.com/comment/31327488
type: Comment
type: QuestionComment
has text: final Spinner defects = (Spinner) findViewById(R.id.defects); ArrayAdapter<String> adapter1 = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list); defects.setAdapter(adapter1);
comment on: http://stackoverflow.com/q/20876735
score: 0

http://stackoverflow.com/q/20864595
accepted answer: http://stackoverflow.com/a/20871355
downvote count: 0
has comment: http://stackoverflow.com/comment/31304333
answer count: 1
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/31304680
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/20871355
type: Question
has title: Why doesn't this Jackson pretty print function work?
tagged with: jackson
has body: Why doesn't this Jackson pretty print function work? Just trying to read a file and pretty print it using jackson api: public static void printJsonFromFile( String fileName ) { System.out.println("-----------------"); ObjectMapper mapper = new ObjectMapper(); try { System.out.println( mapper.writerWithDefaultPrettyPrinter() .writeValueAsString( readFile( fileName, StandardCharsets.UTF_8 )) ); } catch ( IOException e ) { e.printStackTrace(); } System.out.println("-----------------"); } static String readFile(String path, Charset encoding) throws IOException { byte[] encoded = Files.readAllBytes( Paths.get( path ) ); return encoding.decode( ByteBuffer.wrap( encoded ) ).toString(); }

http://stackoverflow.com/a/20863613
downvote count: 0
answers question: http://stackoverflow.com/q/20863564
has comment: http://stackoverflow.com/comment/31302707
has body: You need to create an instance of Main so that the image can be loaded from its constructor.
has comment: http://stackoverflow.com/comment/31302623
upvote count: 3
has comment: http://stackoverflow.com/comment/31302664
type: Answer
score: 3

http://stackoverflow.com/comment/31590415
type: AnswerComment
has text: I did not got it. Is it resolved? If this answer helped you please dont forget to mark it as an answer. :)
comment on: http://stackoverflow.com/a/21016823
score: 0
type: Comment

http://stackoverflow.com/a/20908436
downvote count: 0
has comment: http://stackoverflow.com/comment/31386592
answers question: http://stackoverflow.com/q/20908213
type: Answer
has comment: http://stackoverflow.com/comment/31386550
has comment: http://stackoverflow.com/comment/31408310
upvote count: 1
has body: You have to list all of your subclasses in @XmlSeeAlso annotation of your parent class.
score: 1
has comment: http://stackoverflow.com/comment/31409767

http://stackoverflow.com/comment/31455265
has text: So how would I retrieve this then on the main thread? What would be the command?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20944183

http://stackoverflow.com/comment/31431561
score: 0
type: AnswerComment
type: Comment
has text: @ahmedhamdy Here is my input file: KFFOP CAT JXK FIDO JPWIWTHBRPPDPNFHBRPP ABCDEFGHI USPVCMF A USPVCMF AAAAAAA B BCDEFGHIJ I can't format it :/ but every two lines is obviously what I need, but it does all of them except for the last pair!
comment on: http://stackoverflow.com/a/20931939

http://stackoverflow.com/q/20965745
has title: Assert times of expectLastCall
has body: I am not sure what i do is correct or not. I want assert times of void method call. My code is below. processor.processInitialDump will invoke service.applyInitialDump. My question is event I give times as 100, Still can pass the test. I want assert the call times. What I can do for this issue? Service service = EasyMock.createMock(Service.class); service.applyInitialDump(entities); EasyMock.expectLastCall().times(100); processor.processInitialDump(entities) BTW: If I the expect is less than call time. expectLastCall work correctly. exception will be throw. Service service = EasyMock.createMock(Service.class); service.applyInitialDump(entities); EasyMock.expectLastCall().times(1); processor.processInitialDump(entities) processor.processInitialDump(entities)
accepted answer: http://stackoverflow.com/a/21014583
answer count: 1
tagged with: junit
downvote count: 0
score: 1
favorite count: 0
upvote count: 1
tagged with: testng
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21014583
tagged with: easymock
type: Question

http://stackoverflow.com/comment/31362728
comment on: http://stackoverflow.com/a/20889470
has text: From your code, it is not clear how you are using multiple threads. Maybe you can update your question with this information.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31503663
comment on: http://stackoverflow.com/q/20970256
score: 0
type: QuestionComment
has text: Sorry,it prints as 0E-4.
type: Comment

http://stackoverflow.com/comment/31519036
score: 0
type: AnswerComment
type: Comment
has text: sorry it is a double value not float from EditText.
comment on: http://stackoverflow.com/a/20978181

http://stackoverflow.com/a/20933212
downvote count: 0
answers question: http://stackoverflow.com/q/20931337
has body: You are asking several different questions. Here are some hints: ':MyApp-AndroidLibrary' is a logical project path, which gets mapped to a physical path based on information provided in settings.gradle. A multi-project build can have an arbitrary directory structure, which is configured in settings.gradle. No need to move directories around, unless you want to. Eclipse workspace and Gradle build are separate boundaries. You can have multiple builds in the same workspace. When working with libraries built from source, you can either make them part of the same build, or have a separate build for them. In the latter case, you need to make sure to build the library before the app, and exchange artifacts via a Maven or Ivy repository. This could be automated using a CI server and a corporate Maven/Ivy repository. Alternatively, you could trigger the library's build manually on your machine and use a local Maven/Ivy repository. For more information, check out the Gradle User Guide, especially the chapter on multi-project builds.
type: Answer
upvote count: 13
has comment: http://stackoverflow.com/comment/39566938
has comment: http://stackoverflow.com/comment/39538806
has comment: http://stackoverflow.com/comment/57913480
has comment: http://stackoverflow.com/comment/62721097
has comment: http://stackoverflow.com/comment/34352869
score: 13

http://stackoverflow.com/q/20953461
tagged with: java
has body: Well,I'm reading an article involved in interrupt in java.Now I don't understand a sample very well as shown below: I'm wondering why it will cause an infinite loop there.What does "It can't restore the interrupt status earlier" mean. Appreciate any help.Thanks.
score: 0
answer count: 2
has title: Why it would cause an infinite loop here
has answer: http://stackoverflow.com/a/20953529
accepted answer: http://stackoverflow.com/a/20953529
has answer: http://stackoverflow.com/a/20953518
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20953518
has comment: http://stackoverflow.com/comment/32818073
tagged with: multithreading
type: Question

http://stackoverflow.com/q/20872563
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/31319657
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31319499
has comment: http://stackoverflow.com/comment/31319883
has comment: http://stackoverflow.com/comment/31319733
has answer: http://stackoverflow.com/a/20872603
has title: ClassNotFoundException error and reflection
score: 0
has comment: http://stackoverflow.com/comment/31319544
answer count: 3
possible better answer: http://stackoverflow.com/a/20872603
has answer: http://stackoverflow.com/a/20872624
tagged with: classnotfoundexception
tagged with: variables
favorite count: 0
has answer: http://stackoverflow.com/a/20872690
accepted answer: http://stackoverflow.com/a/20872624
has comment: http://stackoverflow.com/comment/31319624
has body: I am able to access a class and its variables, but is there anyway in changing a user defined variable? e.g: Class c = Class.forName(theclassname); Object o = c.newInstance(); theclassname t = (theclassname) o; i can do t.variable = 1; but can i do String v = "variable"; t.v = 1; in any way?
has comment: http://stackoverflow.com/comment/31319512
type: AnsweredQuestion
tagged with: reflection

http://stackoverflow.com/q/20897533
has answer: http://stackoverflow.com/a/20897763
has title: Failed to Insert Data in SQLITE DataBase using Java in Android?
score: 0
tagged with: sqlite
answer count: 1
tagged with: insert
accepted answer: http://stackoverflow.com/a/20897763
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/31374329
upvote count: 1
has body: i am newbie in android here is the table : private static final String parameterString = "CREATE TABLE IF NOT EXISTS parameterTable(ID INTEGER PRIMARY KEY AUTOINCREMENT,param_type TEXT,cash_code TEXT,param_description TEXT)"; dataBaseAdapterInstance = new DataBaseAdapter(context); @Override public void onCreate(SQLiteDatabase db) { db.execSQL(parameterString); } private void setHardCodedSpinnerValue() { dataBaseAdapterInstance.openToWrite(); final String endUserContractorArray[] = {"End User -With Risk Assessment","End User -Without Risk Assessment", "Contractor" }; String query = "INSERT INTO parameterTable(ID,param_type,cash_code,param_description) " + "VALUES ('331','"+endUserContractorArray[0]+"','"EUWRA"','"End User With Risk Assessment"');"; dataBaseAdapterInstance.getDatabaseInstance().execSQL(query); } I am getting error on this line String query = "INSERT INTO parameterTable(ID,param_type,cash_code,param_description) " + "VALUES ('331','"+endUserContractorArray[0]+"','"EUWRA"','"End User With Risk Assessment"');"; These are the hardcode values EUWRA"','"End User With Risk Assessment"' dataBaseAdapterInstance has already declared.The error is when i am trying to insert hardcoded Values.Please help me what am i doing wrong ?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31365964
tagged with: java
has comment: http://stackoverflow.com/comment/31366048
has comment: http://stackoverflow.com/comment/31365954
downvote count: 1
type: Question

http://stackoverflow.com/comment/31412545
has text: @ÁronNemmondommegavezetéknevem so what is the problem in initializing in `onActivityCreated` and what do you mean by logical? And what is onActivityCreated designed to do?
comment on: http://stackoverflow.com/q/20918424
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/31520661
has text: but for another method I used hibernate save() method. It worked fine without @Transactional annotation. I've put edited the code put Transactional over the editOwner method & its class still it doesn't work.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20979188

http://stackoverflow.com/comment/31569992
comment on: http://stackoverflow.com/q/21005884
score: 0
type: Comment
type: QuestionComment
has text: for some reason it won't work for me. the localStorage stuff works fine but JSON isn't responding

http://stackoverflow.com/comment/31460495
score: 0
has text: Can you show me how to implement the LoginContext in my RMI app ? maybe A link on how to implement it in my app
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20937933

http://stackoverflow.com/q/20949779
has title: json parsing in android giving type mismatch
score: 0
tagged with: java
answer count: 2
accepted answer: http://stackoverflow.com/a/20949812
tagged with: http://stackoverflow.com/tag/json
type: AnsweredQuestion
has body: am parsing a json string. When i run my code am receiving json exception which says "type mismatch" at a point where am getting json array from json object. here is my code String dataFromLogin="{"catego":{"id":"2","fname":"Tashen Jazbi","uname":"tashen", "password":"123","pic_url":"","lati":"33.7167","longi":"73.0667","city":"Islamabad", "country":"Pakistan","mobid":"000000000000000","street":"xyz", "dateandtime":"2013-12-29 18:07:52"}}"; try { JSONObject jsonObj = new JSONObject(dataFromLogin); //JSONObject response = jsonObj.getJSONObject("catego"); JSONArray contacts = jsonObj.getJSONArray("catego"); for (int i = 0; i &lt; contacts.length(); i++) { JSONObject c = contacts.getJSONObject(i); fullname = c.getString("fname"); uname = c.getString("uname"); pic_url = c.getString("pic_url"); lat = c.getString("lati"); lng = c.getString("longi"); city = c.getString("city"); country = c.getString("country"); street= c.getString("street"); } } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } I couldn't found where am doing wrong. If anyone can help then it'll be much appreciated. Thanks :)
has answer: http://stackoverflow.com/a/20949812
type: Question
tagged with: android
possible better answer: http://stackoverflow.com/a/20949962
has answer: http://stackoverflow.com/a/20949962

http://stackoverflow.com/comment/31589549
has text: You might as well disable that warning entirely in the workspace settings then :/ I'd rather just let Eclipse generate the default serialVersionUID in stead of adding the annotation.
comment on: http://stackoverflow.com/a/21016725
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/20882653
has comment: http://stackoverflow.com/comment/31337727
type: Answer
downvote count: 2
score: -2
has comment: http://stackoverflow.com/comment/31337619
answers question: http://stackoverflow.com/q/20882501
upvote count: 0
has body: You don't need to specify the credentials in your application. Just access your database via JNDI, specifying the name of the datasource you've created in the WS. One way is to configure persistence unit using the pre-configured datasource (Please double check if it is configured correctly - the test feature is available in WS) oracle.toplink.essentials.PersistenceProvider jdbc/MyDataSource <property name="toplink.logging.level" value="INFO"/> If the datasource is not configured on the application container side, you may set it up yourself on the application side. For example, you need a number of the applications each one has its own database connection config. oracle.toplink.essentials.PersistenceProvider <exclude-unlisted-classes>false</exclude-unlisted-classes> <property name="toplink.logging.level" value="INFO"/> <property name="toplink.jdbc.driver" value="oracle.jdbc.OracleDriver"/> <property name="toplink.jdbc.url" value="jdbc:oracle:thin:@myhost:l521:MYSID"/> <property name="toplink.jdbc.password" value="tiger"/> <property name="toplink.jdbc.user" value="scott"/> Your persistence.xml has the config for both ways. Remove the unnecessary code and try again.

http://stackoverflow.com/q/20987466
has comment: http://stackoverflow.com/comment/31536556
tagged with: regex
has comment: http://stackoverflow.com/comment/31536229
linked to: http://stackoverflow.com/q/20706793
has comment: http://stackoverflow.com/comment/31537107
has answer: http://stackoverflow.com/a/20987983
has comment: http://stackoverflow.com/comment/31536731
has answer: http://stackoverflow.com/a/20988035
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has body: I have a requirement where I get a string in which I have to replace the value between &lt; p811:Credential&gt; and &lt; /p811:Credential&gt; In this case AAAAA/BBBBBB) Only the Credential text will be constant all the time the prefix will need not be the same Example strings 1.abc &lt; p811:Credential&gt;AAAAA/BBBBBB&lt; /p811:Credential&gt;xyz 2.gsd&lt; K999:Credential&gt;EEEEE/XXXXX&lt; / K999:Credential&gt;tre How can we do this ?
linked to: http://stackoverflow.com/q/16702357
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31536235
tagged with: string
favorite count: 0
has title: How to replace the text in two substrings of a string?
type: UnansweredQuestion

http://stackoverflow.com/q/20915466
tagged with: comparable
possible better answer: http://stackoverflow.com/a/20915732
has answer: http://stackoverflow.com/a/20915732
answer count: 2
downvote count: 0
has body: I currently have a method to return the non-zero indices in an iterable. I want this method to be able to handle any class extending java.lang.Number. Number, of course, does not implement Comparable. But I don't want to have separate methods for Long, Integer, etc. As of now, this is what I have: public static &lt;T extends Number &amp; Comparable&lt;? super T&gt;&gt; nonZeroIndices(Iterable&lt;T&gt; iterable) { Set&lt;Integer&gt; nonzero_indices = Sets.newTreeSet(); Iterator&lt;T&gt; iterator = iterable.iterator(); int i = 0; while (iterator.hasNext()) { T t = iterator.next(); if (t.doubleValue() != 0) // This is what is bothering me nonzero_indices.add(i); i++; } return nonzero_indices; } But I want to avoid doubleValue(). I would also like to avoid having a bunch instanceOf calls in my method. Can I make this method to work on type T where T extends Number and T implements Comparable? EDIT Using &lt;T extends Number &amp; Comparable&lt;? super T&gt;&gt; (as suggested by Sotirios) will still require a bunch of instanceOf statements, which I want to avoid. I was hoping that I can safely cast zero to type T, but the compiler issues a warning saying "unchecked cast". To be more specific, I tried if (t.compareTo((T) new Integer(0) == 0) but it issues the warning.
tagged with: generics
has comment: http://stackoverflow.com/comment/31400609
accepted answer: http://stackoverflow.com/a/20915712
favorite count: 0
has title: Is it possible to compare against zero value in a generic method extending Number?
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20915712
has comment: http://stackoverflow.com/comment/31400708

http://stackoverflow.com/comment/91978238
score: 0
type: Comment
has text: linkTo and methodOn are static method, please check this https://docs.spring.io/spring-hateoas/docs/current/api/org/springframework/hateoas/mvc/ControllerLinkBuilder.html
type: AnswerComment
comment on: http://stackoverflow.com/a/29841099

http://stackoverflow.com/q/20855104
score: 0
tagged with: sql
has comment: http://stackoverflow.com/comment/31286006
answer count: 1
has comment: http://stackoverflow.com/comment/31286940
has comment: http://stackoverflow.com/comment/31285447
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/11871042
has title: Ternary operator for order by clause in main query
tagged with: java
has comment: http://stackoverflow.com/comment/31286320
has answer: http://stackoverflow.com/a/20855561
type: Question
tagged with: jasper-reports
has body: I am working on struts 2 web application in which I have a JasperReports report (jrxml) in which i have main query <defaultValueExpression> </defaultValueExpression> select USER_ID, USER_NAME,CURRENT_ADDRESS,CURRENT_TOWN,CURRENT_POSTAL_CODE,CURRENT_COUNTRY,USER_ADDRESS group by USER_ID, USER_NAME,CURRENT_ADDRESS,CURRENT_TOWN,CURRENT_POSTAL_CODE,CURRENT_COUNTRY,USER_ADDRESS order by $P!{getOrder}, USER_ID In JSP, i have screen which has option "Order by" which has 5 option like this <option value='1' <s:if test="FormBean.orderByField == 1">selected="selected"</s:if>> <fmt:message key="name" /> <option value='2' <s:if test="FormBean.orderByField == 2">selected="selected"</s:if>> <fmt:message key="current address" /> <option value='3' <s:if test="FormBean.orderByField == 3">selected="selected"</s:if>> <fmt:message key="user address" /> <option value='4' <s:if test="FormBean.orderByField == 4">selected="selected"</s:if>> <fmt:message key="postal code" /> <option value='5' <s:if test="FormBean.orderByField == 5">selected="selected"</s:if>> <fmt:message key="country" /> I need to get pdf format ordered by the option selected in the select option. So i have done is: I created a HashMap i which i gets me the value that i select in the select option jasperParameter.put("getOrder", pdfBean.getManageOrder()); Here pdfBean.getManageOrder() will give me String value from the tag which i will pass in report Now depending of the value selected in "getOrder" i need to replace the data in the above query String of report ORDERED by the appropriate data sql Order by clause depending on the values selected like this $P{getOrder}.equals("1")?"USER_NAME":$P{getOrder}.equals("2")?"CURRENT_ADDRESS":$P{getOrder}.equals("3")?"CURRENT_TOWN":$P{getOrder}.equals("4")?"CURRENT_POSTAL_CODE":$P{getOrder}.equals("5")?"COUNTRY":"" if value 3 selected the query should liook like this select USER_ID, USER_NAME,CURRENT_ADDRESS,CURRENT_TOWN,CURRENT_POSTAL_CODE,CURRENT_COUNTRY,USER_ADDRESS group by USER…
has comment: http://stackoverflow.com/comment/31287053

http://stackoverflow.com/comment/31565109
type: AnswerComment
has text: @supercat: it doesn’t matter whether you have native code or not, having different implementations for strings and substring within the same JVM or having `byte[]` strings for ASCII strings and `char[]` for others implies that every operation has to check which kind of string it is before operating. This hinders inlining of the code into the methods using strings which is the first step of further optimizations using the context information of the caller. This is a big impact.
type: Comment
score: 2
comment on: http://stackoverflow.com/a/20945113

http://stackoverflow.com/comment/31536213
comment on: http://stackoverflow.com/a/20987524
type: AnswerComment
has text: @user3171788 If your project need it, You have to refer it else it wont solve your problem.
score: 0
type: Comment

http://stackoverflow.com/a/20973700
has comment: http://stackoverflow.com/comment/31509928
score: 6
upvote count: 6
answers question: http://stackoverflow.com/q/20973664
has body: It is considered bad style to reassign parameters. You are supposed to create a new local variable.
has comment: http://stackoverflow.com/comment/31509852
has comment: http://stackoverflow.com/comment/32922769
has comment: http://stackoverflow.com/comment/31509819
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31509858

http://stackoverflow.com/q/20860186
favorite count: 0
tagged with: netbeans-platform
tagged with: antlr4
downvote count: 1
type: AnsweredQuestion
tagged with: netbeans
tagged with: java
has body: I have a simple grammar written in ANTLR4 that includes (among others) a whitespace rule: WhiteSpace : [ \t\r\n]+ -&gt; skip; This is integrated into a NetBeans platform application using org.netbeans.spi.lexer.Lexer. When the input has trailing whitespace (before EOF), I get the following exception: java.lang.IllegalStateException: Lexer ExpressionLexer@2cdea2eb returned null token but lexerInput.readLength()=1 lexer-state: null tokenStartOffset=20, readOffset=21, lookaheadOffset=22 Chars: "\n" - these characters need to be tokenized. Fix the lexer to not return null token in this state. How can I make this trailing whitespace not cause an error? Edit: This works correctly without error using only ANTLR lexer and parser code. The error is only when integrating with the NetBeans lexer (and possibly other integrations).
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/20860187
accepted answer: http://stackoverflow.com/a/20860187
has title: NetBeans lexer throws exception recognizing trailing whitespace
tagged with: antlr
score: 0
answer count: 1

http://stackoverflow.com/q/20878660
has comment: http://stackoverflow.com/comment/31330610
score: 0
has title: Android - Null Pointer Exception error when launching new activity
answer count: 3
has comment: http://stackoverflow.com/comment/31330753
tagged with: android-intent
has comment: http://stackoverflow.com/comment/31330679
accepted answer: http://stackoverflow.com/a/20879492
has body: The following code accepts an intent from a listview that contains a listview. This activity captures the title of the listview selected, and then launches this activity, passing a string intent of the title. Before this activity loads, it crashes and logcat reports a 'Null Pointer Exception'. The items in the string array are as follows: [0][.] = Id, starting at 0 [1][.] = name, the name as shown on the listview [2][.] = description ect This is the view activity public class view extends HomeActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.view); Bundle b = getIntent().getExtras(); String value = b.getString("index"); TextView title = (TextView) findViewById(R.id.textView1); TextView description = (TextView) findViewById(R.id.textView2); ImageView iv = (ImageView) findViewById(R.id.imageView1); RatingBar rb = (RatingBar) findViewById(R.id.ratingBar1); int tempPosition = 0; int intvalue = 0; //Find the id of the item[0], given the name[1] while(value!=Challenges.chalarray[tempPosition][1]){ if (Challenges.chalarray[tempPosition][1].contains(value)){ String s = Challenges.chalarray[tempPosition][0]; intvalue = Integer.parseInt(s); } tempPosition = tempPosition + 1; } title.setText(Challenges.chalarray[intvalue][1]); description.setText(Challenges.chalarray[intvalue][2]); String temp = Challenges.chalarray[intvalue][4]; String s1 = Challenges.chalarray[intvalue][3]; float f1 = Float.parseFloat(s1); int resourceId = getResources().getIdentifier (temp, "drawable", "com.tim.listviewapp"); iv.setImageResource(resourceId); rb.setRating(f1); I'm 99% sure the sending side is correct, so I have not posted it. I am happy to post it if you guys think theres something wrong with it. Thank you HEAPS! EDIT: Logcat: 01-02 03:18:48.789: D/AndroidRuntime(1194): Shutting down VM 01-02 03:18:48.789: W/dalvikvm(1194): threadid=1: thread exiting with uncaught exception (group=0xb4b00b90) 01-02 03:18:48.8…
has comment: http://stackoverflow.com/comment/31330627
tagged with: java
possible better answer: http://stackoverflow.com/a/20878688
tagged with: listview
has comment: http://stackoverflow.com/comment/31330766
has answer: http://stackoverflow.com/a/20878688
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20878799
has comment: http://stackoverflow.com/comment/31330729
has comment: http://stackoverflow.com/comment/31331558
tagged with: nullpointerexception
type: Question
has answer: http://stackoverflow.com/a/20879492
has comment: http://stackoverflow.com/comment/31330580
tagged with: android
has comment: http://stackoverflow.com/comment/31330503

http://stackoverflow.com/comment/31352558
has text: By JDBC you are bound to get objects implementing JDBC interfaces such as Struct... the way you have implemented is actually quite straight to the problem. You can make it look a little more nice by playing with your Delivery class constructor, but it would be essentially the same. You maybe can close the gap by using automatic bean populators like the one in Apache Commons, or an ORM which would populate instance beans out of your query/proc call, but it is as close as you can get (at least as far as I know).
comment on: http://stackoverflow.com/q/20889624
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20954334
has title: java JTable sort objects
answer count: 0
type: UnansweredQuestion
tagged with: tablerowsorter
tagged with: swing
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31473724
upvote count: 1
downvote count: 0
tagged with: jtable
favorite count: 0
has body: I am sorry for asking this. But I am having huge problems understanding how to do so. I have a JTable. For that JTable I have my own AbstractTableModel that returns a custom object for getValueAt. Additionally I also have my own TableCellRenderer that uses a lot of colors, and uses column value to extract specified values from object that is given by getValueAt. However I would like to be able to sort values. So how would I go about sorting? I would like to be able to receive the two objects, and the column, and sort based on that. I tried reading bunch of tutorials but they show how to sort either based on string, or just sort without knowing the column. Also should I be doing sorting in the class where I create the JTable, or in AbstractTableModel or in TableCellRenderer? Any help or pointing to good tutorial will be greatly appreciated. I am sorry but I really suck at this worsting and have never done it.

http://stackoverflow.com/comment/69371623
score: 2
has text: @SatyakiMukherjee can you share your source code?
comment on: http://stackoverflow.com/q/20943407
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31438793
type: AnswerComment
type: Comment
has text: @DakshShah You can just insert that code in your existing Java program - the if block is not required, it is there in case `mbrola_us1` is not found, to show you what other voices are available. Note that I have never used that library or tested that code but based on their tutorial it should work.
comment on: http://stackoverflow.com/a/20935638
score: 0

http://stackoverflow.com/comment/31509409
score: 0
has text: An idea for adapting "Rectangle r = component.rect;" to the list of rectangles ?
type: Comment
comment on: http://stackoverflow.com/a/20923537
type: AnswerComment

http://stackoverflow.com/comment/31423415
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20927735
has text: The hashmap approach from the duplicate is what you want here

http://stackoverflow.com/comment/31444627
comment on: http://stackoverflow.com/q/20938726
has text: @PeterLawrey `+ s(s.sub...` -> `+ d(s.sub...`
type: Comment
type: QuestionComment
score: 1

finalize
type: Tag
tags question: http://stackoverflow.com/q/20952054
tag name: finalize
tags question: http://stackoverflow.com/q/20899990

http://stackoverflow.com/comment/31351313
type: Comment
comment on: http://stackoverflow.com/a/20860142
has text: @user3149617 - Heh, no worries. It happens when switching back and forth between languages. Out of curiosity, which line caused the " "Attempting to use index type '-1..." error? BTW, you should post the final CF code as a separate "answer", so it is more visible to others. You can still mark Steve's response as the official answer.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31419062
has text: Keep in mind that the simple formula is not applicable for any two numbers (in case of valid p and q for RSA, it is ok though)
type: Comment
comment on: http://stackoverflow.com/a/20925674
score: 1
type: AnswerComment

http://stackoverflow.com/comment/31483647
comment on: http://stackoverflow.com/q/20959453
score: 0
type: Comment
type: QuestionComment
has text: If it is a typo, correct it by putting quotes around `Hello`.

http://stackoverflow.com/a/21040452
answers question: http://stackoverflow.com/q/20883910
score: 0
has body: I got the answer String orLoginString = "Or Login to Place your Order"; SpannableString redSpannable= new SpannableString(orLoginString); ClickableSpan clickableSpan = new ClickableSpan() { @Override public void onClick(View textView) { //Your code onclick of underline string } @Override public void updateDrawState(TextPaint ds) { // TODO Auto-generated method stub super.updateDrawState(ds); //You change the color of underline string. //You can make underline visible or invisible } }; redSpannable.setSpan(clickableSpan, 3, 8, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); yourtextview.setText(redSpannable); loginSelectionFirstTimeLaunching.setMovementMethod(LinkMovementMethod.getInstance());
type: Answer

http://stackoverflow.com/comment/31400282
type: Comment
comment on: http://stackoverflow.com/q/20914327
has text: I want to not extend the JPanel?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/31491328
score: 0
type: AnswerComment
has text: Thanks for making this! When I compile it, it gives me unrecognized symbol errors. Maybe I am including the wrong jar file? I am currently adding httpclient-4.3.1.jar as the classpath during compile. Any suggestions?
type: Comment
comment on: http://stackoverflow.com/a/20940953

http://stackoverflow.com/comment/31602946
has text: @AndreaLigios - my second links explains that and the example following in that link.
type: AnswerComment
comment on: http://stackoverflow.com/a/21023803
score: 0
type: Comment

http://stackoverflow.com/q/20927290
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/20927399
upvote count: 3
has title: Apache not obeying If-Modified-Since
tagged with: cache-control
tagged with: apache-httpcomponents
type: AnsweredQuestion
score: 3
tagged with: java
tagged with: http-headers
type: Question
has answer: http://stackoverflow.com/a/20927399
tagged with: apache
has body: I'm downloading a JAR file, and would like to utilize If-Modified-Since so I don't get the whole file if I don't need it, but for some reason my vanilla Apache (afaik) isn't returning the 304 correctly. This is from wireshark: GET /whatever.jar HTTP/1.1 If-Modified-Since: Sat, 04 Jan 2014 21:46:26 GMT User-Agent: Jakarta Commons-HttpClient/3.1 Host: example.com HTTP/1.1 200 OK Date: Sat, 04 Jan 2014 20:32:31 GMT Server: Apache/2.2.4 (Unix) mod_ssl/2.2.4 OpenSSL/0.9.8e DAV/2 mod_jk/1.2.26 PHP/5.3.6 SVN/1.4.4 Last-Modified: Sat, 04 Jan 2014 19:13:14 GMT ETag: "b6c037-1ddad9f-d17a6680" Accept-Ranges: bytes Content-Length: 31305119 Vary: User-Agent Content-Type: text/plain ... [bunch of bytes] ... There aren't other headers I need to specify, is there? Am I missing a module that Apache needs in order to read this header correctly? Any other thoughts or suggestions? Here is my Java code, for reference: File jarFile = new File(filePath); GetMethod get = new GetMethod(downloadUrl); Date lastModified = new Date(jarFile.lastModified()); get.setRequestHeader("If-Modified-Since", DateUtil.formatDate(lastModified)); HttpClient client = new HttpClient(); int code = client.executeMethod(get); UPDATE: Solution The If-Modified-Date needed to exactly match the server, and I achieved this by explicitly setting the lastModifiedDate on the downloaded file: String serverModified = get.getResponseHeader("Last-Modified").getValue(); jarFile.setLastModified(DateUtil.parseDate(serverModified).getTime()); After doing this, subsequent calls would not download the file.

encryption
tags question: http://stackoverflow.com/q/20902854
tags question: http://stackoverflow.com/q/20925656
tags question: http://stackoverflow.com/q/20921158
tags question: http://stackoverflow.com/q/20949437
tags question: http://stackoverflow.com/q/20942872
tags question: http://stackoverflow.com/q/20995263
tags question: http://stackoverflow.com/q/20961481
tags question: http://stackoverflow.com/q/20867640
tag name: encryption
tags question: http://stackoverflow.com/q/20876249
tags question: http://stackoverflow.com/q/20967518
tags question: http://stackoverflow.com/q/20923378
tags question: http://stackoverflow.com/q/20976375
tags question: http://stackoverflow.com/q/20887572
tags question: http://stackoverflow.com/q/20983874
tags question: http://stackoverflow.com/q/20929105
tags question: http://stackoverflow.com/q/20871030
tags question: http://stackoverflow.com/q/20920803
tags question: http://stackoverflow.com/q/20877251
tags question: http://stackoverflow.com/q/20868745
tags question: http://stackoverflow.com/q/20871297
tags question: http://stackoverflow.com/q/20897662
type: Tag
tags question: http://stackoverflow.com/q/20924999
tags question: http://stackoverflow.com/q/20938222
tags question: http://stackoverflow.com/q/20862143

http://stackoverflow.com/comment/31285485
type: Comment
has text: Update your question with the changes you have done. It should work as i have shown. Have you made your `getSD()` method `public static` ?
score: 0
comment on: http://stackoverflow.com/a/20854941
type: AnswerComment

http://stackoverflow.com/a/20968271
has body: This other question showed me how to do it: JFreeChart : obtain data source value on mouse click Here's my final code: panel_Letzte24H.addChartMouseListener((new ChartMouseListener() { public void chartMouseClicked(ChartMouseEvent mE) { System.out.println(mE.getEntity()); String full = mE.getEntity().toString(); String[] firstSplit = full.split("item = "); String[] finalSplit= firstSplit[1].split(","); try{ int index; index = Integer.parseInt(finalSplit[0]); System.out.println("Indexnumber: " + index); } catch(NullPointerException e){} } public void chartMouseMoved(ChartMouseEvent arg0) { // nothing here } })); I had to split the string twice to get the index number.
accepted answer of: http://stackoverflow.com/q/20953319
has comment: http://stackoverflow.com/comment/36231862
answers question: http://stackoverflow.com/q/20953319
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/20885901
score: 0
has comment: http://stackoverflow.com/comment/31365490
has body: Seems like you're trying to access an html file that's inside the WEB-INF directory. You can't access directly from the browser any resource that's inside WEB-INF. Put the html file into the web resources folder, but outside the WEB-INF and try again.
answers question: http://stackoverflow.com/q/20880307
has comment: http://stackoverflow.com/comment/31366472
type: Answer

http://stackoverflow.com/q/21008989
has comment: http://stackoverflow.com/comment/31575952
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31576043
tagged with: getter
has comment: http://stackoverflow.com/comment/31575915
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/21009046
has comment: http://stackoverflow.com/comment/31575843
has title: Getting the value of a variable of another class
has body: public int getwidth() { return width; } public int gethight() { return hight; } I have this methods in another class. I need to use them in another class now to get this information. The problem is: even though (it seems to me) that it is not a static-context, it constantly tells me that it is a static context and so it doesn't work. void setWidth() { /* getterclass is the class where the getwidth method is in */ this.width = getterClass.getwidth(); } I tried it this way, but it doesn't work. No matter what I do, it always tells me it is a static context. It seems to me that I do a horrible mistake somewhere.
tagged with: static
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21009045
has comment: http://stackoverflow.com/comment/31575795
has comment: http://stackoverflow.com/comment/31575922
has answer: http://stackoverflow.com/a/21009041

http://stackoverflow.com/comment/31454916
has text: can you paste more of your logs? There will be a detailed message for the excpetion as well
comment on: http://stackoverflow.com/q/20940998
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31338953
score: 0
has text: claim_option is the object of the class Claim_list it holds the data for the listview claim_list_adaptor is the ArrayList of the class Claim_list ArrayList<Claim_list>
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20883156

http://stackoverflow.com/a/25466186
has body: If you have Authorized App Engine Applications you app engine on the access control settings you do not need a password since it is local so just make you password= ""; However if you are using something remote for example phpmyadmin that is run from another host, your command line or a GCE VM that runs through a TCP , SSH or HTML you will need to have a password ="something"; where something is set by you in your access control.
type: Answer
score: 3
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/20896237

http://stackoverflow.com/comment/31391358
type: QuestionComment
type: Comment
score: 2
has text: See here: http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#MULTILINE
comment on: http://stackoverflow.com/q/20910952

http://stackoverflow.com/a/20995374
has comment: http://stackoverflow.com/comment/31612964
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31604875
type: Answer
accepted answer of: http://stackoverflow.com/q/20995200
answers question: http://stackoverflow.com/q/20995200
has body: I moved your Menu class up out of the main method, and made it a static inner class. For clarity, I renamed it MyFrame and renamed the main method to displayGui. Let me know if you don't understand anything. public class Assignment4Test { public static void main(String[] args) { Scanner console = new Scanner(System.in); final int Username = 3387; final int Password = 5183; final int AccountNumber = 22334455; int EnteredUsername; int EnteredPassword; int EnteredAccountNumber; for (int s = 0; s &lt;= 3; s++) { if (s &lt; 3) { System.out.println("Enter Username"); EnteredUsername = console.nextInt(); System.out.println("Username Entered is " + EnteredUsername); System.out.println("Enter Password"); EnteredPassword = console.nextInt(); System.out.println("Password Entered is " + EnteredPassword); System.out.println("Enter Account Number"); EnteredAccountNumber = console.nextInt(); System.out.println("Account Number Entered is " + EnteredAccountNumber); if (Username == EnteredUsername &amp;&amp; (Password == EnteredPassword) &amp;&amp; (AccountNumber == EnteredAccountNumber)) { System.out.println("Welcome"); new MyFrame().displayGui(); break; } else { System.out.println("Wrong Username, Password or Account Number. Please try again."); } } else { System.out.println("3 incorrect enteries detected. Program is terminating, goodbye!"); } } } static class MyFrame extends JFrame { JMenuBar menubar; JMenu TransferAnAmount; JMenuItem TransferAnAmountToAnotherAccount; JMenu ListRecentTransactions; JMenuItem ShowList; JMenu DisplayCurrentBalance; JMenuItem ShowBalance; JMenu ExitProgram; JMenuItem Exit; public MyFrame() { setLayout(new FlowLayout()); menubar = new JMenuBar(); setJMenuBar(menubar); TransferAnAmount = new JMenu("Transfer An Amount"); menubar.add(TransferAnAmount); ListRecentTransactions = new JMenu("List Recent Transactions"); menubar.add(ListRecentTransactions); DisplayCurrentBalance = new JMenu("Display Current Balance"); menubar.add(DisplayCurrentBalance); ExitPro…

http://stackoverflow.com/comment/31330753
type: QuestionComment
comment on: http://stackoverflow.com/q/20878660
has text: This is the full logcat, lines in logcat previous to this are for previous launches of the application
score: 0
type: Comment

http://stackoverflow.com/comment/79783363
comment on: http://stackoverflow.com/a/27393777
score: 0
type: Comment
has text: In my case the property `filePattern` was written in lowercase
type: AnswerComment

http://stackoverflow.com/q/20899532
tagged with: serial-port
has comment: http://stackoverflow.com/comment/31369379
tagged with: event-dispatch-thread
has title: displaying the output from a serial port in JTextField
type: UnansweredQuestion
tagged with: swing
tagged with: jtextfield
has comment: http://stackoverflow.com/comment/31369227
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/31374767
has comment: http://stackoverflow.com/comment/31369191
score: 0
has answer: http://stackoverflow.com/a/20905045
answer count: 1
has body: This is a part of a sample code from a RXTX serial communication program. I would like to know on how to extract the string variable that I have created to store the output so that I could use it in another class. The output is showing on the console but I want to display it in a JTextfield and I'm unable to extract it. I have done the GUI part. First I will show the main part: public class MainSerialGui { public static void main(String[] args) { SerialGui vimal = new SerialGui (); vimal.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); vimal.setSize(250, 200); vimal.setVisible(true); } } This is the GUI part public class SerialGui extends JFrame { //inherit all the stuff from JFrame and let us create a window private JTextField item1; private JButton readButton; public SerialGui (){ setLayout(new FlowLayout()); item1 = new JTextField("Display Output"); add(item1); readButton = new JButton("Read Data"); add(readButton); thehandler handler = new thehandler(); readButton.addActionListener(handler); } private class thehandler implements ActionListener { public void actionPerformed(ActionEvent event) { if(event.getSource() == readButton){ String portName = "COM4"; try{ CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort = portIdentifier.open(this.getClass().getName(),2000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(57600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); // Setting port parameters InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); (new Thread(new SerialReader(in))).start(); SerialReader comm = new SerialReader(null); item1.setText(comm.str); } } } catch (Exception e){ e.printStackTrace(); System.out.println("Only serial ports please"); } } } } } This is a separat…

http://stackoverflow.com/comment/31490832
type: QuestionComment
score: 1
has text: Get a faster internet connection? Also, look at NIO and selectors, although multiple threads will be a lot easier in your case.
comment on: http://stackoverflow.com/q/20963091
type: Comment

arraylist
tags question: http://stackoverflow.com/q/21015297
tags question: http://stackoverflow.com/q/20852144
tags question: http://stackoverflow.com/q/20953943
tags question: http://stackoverflow.com/q/20947130
tags question: http://stackoverflow.com/q/20988613
tags question: http://stackoverflow.com/q/20868082
tags question: http://stackoverflow.com/q/20986272
tags question: http://stackoverflow.com/q/21011662
tags question: http://stackoverflow.com/q/20959246
tags question: http://stackoverflow.com/q/20870090
tags question: http://stackoverflow.com/q/20870266
tags question: http://stackoverflow.com/q/20869559
tags question: http://stackoverflow.com/q/20859706
tags question: http://stackoverflow.com/q/20922879
tags question: http://stackoverflow.com/q/20996304
tags question: http://stackoverflow.com/q/20921024
tags question: http://stackoverflow.com/q/20927971
tags question: http://stackoverflow.com/q/20912716
tags question: http://stackoverflow.com/q/20891277
tags question: http://stackoverflow.com/q/20931207
tags question: http://stackoverflow.com/q/20959803
tags question: http://stackoverflow.com/q/20937048
tags question: http://stackoverflow.com/q/20860869
tags question: http://stackoverflow.com/q/20942130
tags question: http://stackoverflow.com/q/20987097
tags question: http://stackoverflow.com/q/20938892
tags question: http://stackoverflow.com/q/20922164
tags question: http://stackoverflow.com/q/20914224
tags question: http://stackoverflow.com/q/20881345
tags question: http://stackoverflow.com/q/20918498
tags question: http://stackoverflow.com/q/21007762
tags question: http://stackoverflow.com/q/20942518
tags question: http://stackoverflow.com/q/20881381
tags question: http://stackoverflow.com/q/20942468
tags question: http://stackoverflow.com/q/21016523
tags question: http://stackoverflow.com/q/20896040
tags question: http://stackoverflow.com/q/20921542
tags question: http://stackoverflow.com/q/20933302
tags question: http://stackoverflow.com/q/20910696
tags question: http://stackoverflow.com/q/20862722
tags question: http://stackoverflow.com/q/21006013
tags question: http://stackoverflow.com/q/20946093
tags question: http://stackoverflow.com/q/20948637
tags question: http://stackoverflow.com/q/21000508
tags question: http://stackoverflow.com/q/20978138
tags question: http://stackoverflow.com/q/20869325
tags question: http://stackoverflow.com/q/20888037
tags question: http://stackoverflow.com/q/20936517
tags question: http://stackoverflow.com/q/20851921
tags question: http://stackoverflow.com/q/21012360
tags question: http://stackoverflow.com/q/20912769
tags question: http://stackoverflow.com/q/20979362
tags question: http://stackoverflow.com/q/20985598
tags question: http://stackoverflow.com/q/20898050
tags question: http://stackoverflow.com/q/20940652
tags question: http://stackoverflow.com/q/20946826
tags question: http://stackoverflow.com/q/20865306
tags question: http://stackoverflow.com/q/20965807
tags question: http://stackoverflow.com/q/20924418
tags question: http://stackoverflow.com/q/20961617
tags question: http://stackoverflow.com/q/20852233
tags question: http://stackoverflow.com/q/20881157
tags question: http://stackoverflow.com/q/20964693
tags question: http://stackoverflow.com/q/21004273
tags question: http://stackoverflow.com/q/20967653
tags question: http://stackoverflow.com/q/20933824
tags question: http://stackoverflow.com/q/20878999
tags question: http://stackoverflow.com/q/20929248
tags question: http://stackoverflow.com/q/21002032
tags question: http://stackoverflow.com/q/20884857
tags question: http://stackoverflow.com/q/20979172
tags question: http://stackoverflow.com/q/21003933
tags question: http://stackoverflow.com/q/20967472
tags question: http://stackoverflow.com/q/21005120
tags question: http://stackoverflow.com/q/20931570
tags question: http://stackoverflow.com/q/20862515
tags question: http://stackoverflow.com/q/20977488
tags question: http://stackoverflow.com/q/20944024
tags question: http://stackoverflow.com/q/20993876
type: Tag

http://stackoverflow.com/comment/31393781
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20911942
has text: your code is right, maybe some permissions problem or invalid path?
score: 0

http://stackoverflow.com/q/20868540
possible better answer: http://stackoverflow.com/a/20868586
has answer: http://stackoverflow.com/a/20871758
tagged with: layout-manager
favorite count: 0
has body: I would like to ask if SpringLayout can do anything like absolute position because I think absolute position have problem when I maximize the frame and what do I have to use if I need to set JMenu and JToolBar and JTextField and JTable all in one line in order? I tried to use Borderlayout but it give me very big JTextField. I tried Gridlayout it give also big JTextField I need it big but not as big as it shows up.
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17874717
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/20868586
accepted answer: http://stackoverflow.com/a/20868634
tagged with: java
tagged with: swing
type: Question
tagged with: layout
has answer: http://stackoverflow.com/a/20868634
tagged with: springlayout
linked to: http://stackoverflow.com/q/519918
has title: Can SpringLayout do all the job
upvote count: 2
answer count: 3
linked to: http://stackoverflow.com/q/5621338

io
tags question: http://stackoverflow.com/q/20937079
tags question: http://stackoverflow.com/q/20929621
tags question: http://stackoverflow.com/q/20897464
tags question: http://stackoverflow.com/q/20912466
tags question: http://stackoverflow.com/q/20975916
tag name: io
tags question: http://stackoverflow.com/q/20927278
tags question: http://stackoverflow.com/q/20891281
tags question: http://stackoverflow.com/q/21013934
tags question: http://stackoverflow.com/q/20874859
tags question: http://stackoverflow.com/q/20927046
tags question: http://stackoverflow.com/q/20881753
tags question: http://stackoverflow.com/q/20986514
tags question: http://stackoverflow.com/q/20891629
tags question: http://stackoverflow.com/q/20956769
type: Tag
tags question: http://stackoverflow.com/q/20957536
tags question: http://stackoverflow.com/q/20926091

http://stackoverflow.com/a/20981814
answers question: http://stackoverflow.com/q/20981455
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/31533810
has body: Starting with the tutorial Reading from and Writing to a Socket, you could start with a simple echo server which uses a ServerSocket like so public static void main(String[] args) throws Exception { // create socket int port = 4444; ServerSocket serverSocket = new ServerSocket(port); System.err.println("Started server on port " + port); // repeatedly wait for connections, and process while (true) { // a "blocking" call which waits until a connection is requested Socket clientSocket = serverSocket.accept(); System.err.println("Accepted connection from client"); // open up IO streams BufferedReader in = new BufferedReader(new InputStreamReader( clientSocket.getInputStream())); PrintWriter out = new PrintWriter(clientSocket.getOutputStream()); // waits for data and reads it in until connection dies // readLine() blocks until the server receives a new line from // client String s; try { while ((s = in.readLine()) != null) { out.println(s); out.flush(); } } catch (Exception e) { e.printStackTrace(); } // close IO streams, then socket System.err.println("Closing connection with client"); out.close(); in.close(); clientSocket.close(); } Then you can use "telnet localhost 4444" to test it, or write an entire client; perhaps like the client in the tutorial above.
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31533866

http://stackoverflow.com/q/20873667
upvote count: 1
type: Question
tagged with: libgdx
tagged with: eclipse
has body: I'm beginning to develop games for android and I have what I believe a pretty simple question. I'm trying to replicate the game 'The Impossible Game' which is shown below for some practice. I'm having trouble with the white line the player uses as the "ground". When I want to create it, should I create is as its own texture and draw it like that on a texture atlas map and then put it into my game level picture and use collision detection, or should I just create that line in the background image and say if players position y = number, then stop falling? And then scroll the camera upwards when the player goes higher so the line doesn't always stay at that part of the screen. Which is an easier approach? hanks guys. I'm just not sure what's easier.
has comment: http://stackoverflow.com/comment/31321569
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31322108
score: 1
has answer: http://stackoverflow.com/a/20989562
tagged with: opengl-es
favorite count: 0
has comment: http://stackoverflow.com/comment/31321871
type: UnansweredQuestion
tagged with: android
has title: How should I draw this in a game?
tagged with: java

http://stackoverflow.com/comment/31551244
comment on: http://stackoverflow.com/q/20996075
type: QuestionComment
score: 0
has text: according to docs datetime is accurate to 1/300 second. http://infocenter.sybase.com/archive/index.jsp?topic=/com.sybase.help.ase_15.0.blocks/html/blocks/blocks36.htm It's possible Sybase doesn't show you fractions of second. Looks like you have to use convert function.
type: Comment

http://stackoverflow.com/a/20946965
score: 0
type: Answer
has body: When you press the cancel button the JOptionPane returns nothing, so your input is equal null. and you code will already enter the do scoop, and when your code reach the line : for(int i =input.length()-1;i&gt;=0;i--) the input is already null. i prefer to add after the that line the follwing: if(input == null) { break; }
answers question: http://stackoverflow.com/q/20946716

http://stackoverflow.com/comment/31416312
type: Comment
has text: I've edited my answer with this pattern: "([0-9]+|[a-z\\)])(?=[0-9]+|[a-z\\(])". You can modify it after reading about regex and their use and practice.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20912733

http://stackoverflow.com/a/20904317
type: AcceptedAnswer
type: Answer
has body: One way is to declare final variable inside the for loop so the anonymous inner class can access to it. So add this line before handler1.postDelayed(new Runnable() { //start delay a: final int aValue = a; and then replace the a from the if/if else's with that aValue. Like this: if (aValue==0) {ans1 = btn5;} That how the anonymous inner class can get the value declared in the for loop.
answers question: http://stackoverflow.com/q/20903726
accepted answer of: http://stackoverflow.com/q/20903726
score: 0

http://stackoverflow.com/q/21007634
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/21009022
tagged with: logging
type: AnsweredQuestion
tagged with: java
type: Question
has title: Log4j log append to file name dependent on day - config
answer count: 1
has body: I'm fairly new to log4j and I would like to set up automatic logging of anything output to the console, like errors, or info messages for a web app running on my local server. How would I set up my xml and/or properties file to do this? What I really am looking for is that each day a new log file be created in a directory (Ex: /mylogs/app-log-01-08-2014.log) I've begun like this: &lt;!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"&gt; &lt;log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"&gt; &lt;!-- general application log --&gt; &lt;appender name="BarLogFile" class="org.apache.log4j.FileAppender"&gt; &lt;param name="File" value="my-changing-file-name.log" /&gt; -&gt;&gt;&gt; how does this change &lt;param name="Threshold" value="INFO" /&gt; -&gt;&gt;&gt; should INFO be Console here? &lt;/appender&gt; &lt;logger name="what-goes-here?"&gt; &lt;appender-ref ref="something-here"/&gt; &lt;/logger&gt; &lt;root&gt; &lt;level value="INFO"/&gt; &lt;/root&gt; Also, where in a web project does the xml file go? WEB-INF? Any help is appreciated.
has answer: http://stackoverflow.com/a/21009022
score: 0
tagged with: log4j

http://stackoverflow.com/comment/31349527
has text: So to answer my question in the second comment: What you wrote above equals to 'creating a new class named leftAction, that extends AbstractAction'? Or is it just another instance of AbstractAction?
type: AnswerComment
comment on: http://stackoverflow.com/a/20884470
score: 0
type: Comment

http://stackoverflow.com/comment/65060159
type: AnswerComment
comment on: http://stackoverflow.com/a/38833038
type: Comment
has text: In case of latest Liberty you should select `jpa-2.1` feature, which enables built in EclipseLink provider and jdbc-4.1. jpa-2.0 is based on openJPA and you may have some conflicts.
score: 0

http://stackoverflow.com/comment/31580572
comment on: http://stackoverflow.com/q/21011599
score: 0
type: Comment
type: QuestionComment
has text: @JeroenVannevel Let's say I want to add several values onto the list, how would I add them? Does it have to be through the argument?

http://stackoverflow.com/q/20852144
possible better answer: http://stackoverflow.com/a/20852303
upvote count: 1
accepted answer: http://stackoverflow.com/a/20866235
has comment: http://stackoverflow.com/comment/31280366
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31280382
linked to: http://stackoverflow.com/q/2167602
has comment: http://stackoverflow.com/comment/31307223
has comment: http://stackoverflow.com/comment/31281871
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31281741
type: Question
has comment: http://stackoverflow.com/comment/31280293
answer count: 2
has comment: http://stackoverflow.com/comment/31281691
tagged with: byte-order-mark
tagged with: string-comparison
downvote count: 0
has comment: http://stackoverflow.com/comment/31280339
tagged with: string
has comment: http://stackoverflow.com/comment/31280367
tagged with: arraylist
has answer: http://stackoverflow.com/a/20852303
has title: Java: Comparing strings
favorite count: 0
has comment: http://stackoverflow.com/comment/31284563
has answer: http://stackoverflow.com/a/20866235
has body: I have an array list named myArraylist that contains items of the class named TStas. Tstas has a string variable named st_name. I want to search the array list, looking for the TStas instance whose st_name is equal to the string look for and when found return the position (found places) of the TStas in the array list. public static List&lt;Integer&gt; findplace_byname(String lookfor){ List&lt;Integer&gt; foundplaces = new ArrayList&lt;&gt;(); //list to place posistions of found items for(int k=0; k&lt;myArraylist.size(); k++) { TStas a=myArraylist.get(k); JOptionPane.showMessageDialog(null, "#"+a.st_name+"#"+lookfor+ "#"); //just to check if everything is read, if ((a.st_name).equals(lookfor)){ foundplaces .add(k); } } return foundplaces; } My problem is that the code fails to detect the equality when comparing to the a.st_name of the first item in myArraylist. For example: if I have in myarrailist an item with a.st_name=S9, an item with a.st_name=K9 and another with a.st_name=G4. When lookfor is K9 or G4 all is ok. When searching for the first item in the array having a.st_name=S9 the code fails to "see" the equality. I am using the showMessageDialog to check that the variable is realy read and it is so. Also I tried to delete or change the 1st item in the arraylist, but the same problem goes on: The 1rst item is not found. What is happening here? EDIT I used the trim() to remove any possible spaces but nothing changed. I then used .length() on the "trimed" string to get the length of each string to be compared and I found that for some reason the 1st element while being "S9" without any spaces has a length of 3!! Is it possible that some king of character is hidden? (I have no idea, a paragraph character or what?)
has comment: http://stackoverflow.com/comment/31280644
has comment: http://stackoverflow.com/comment/31281599

http://stackoverflow.com/comment/31360743
type: Comment
has text: In the future, to avoid a deluge of down votes, I suggest a couple of things. 1) Make sure you post *exactly* what your problem is (doesn't print anything, prints something wrong, crashes with an error). 2) Add any and all relevant error messages from either the compiler or the running of the program.
score: 4
type: QuestionComment
comment on: http://stackoverflow.com/q/20894513

http://stackoverflow.com/a/20907669
score: 1
has comment: http://stackoverflow.com/comment/31384488
upvote count: 1
type: Answer
has body: It's generally considered poor practice to be invoking Java from a scriptlet in a JSP page. JSP is intended to do HTML formatting, with some extra intelligence around using the Locale and things like that. A better PHP, if you will. Database processing should be handled by a servlet.
answers question: http://stackoverflow.com/q/20907608
downvote count: 0

http://stackoverflow.com/comment/31289872
type: QuestionComment
type: Comment
has text: POst your error log??
score: 0
comment on: http://stackoverflow.com/q/20857496

linked-list
tags question: http://stackoverflow.com/q/20928425
tags question: http://stackoverflow.com/q/20904872
tag name: linked-list
tags question: http://stackoverflow.com/q/20970885
tags question: http://stackoverflow.com/q/21011599
tags question: http://stackoverflow.com/q/20915277
tags question: http://stackoverflow.com/q/20914881
type: Tag
tags question: http://stackoverflow.com/q/20936053
tags question: http://stackoverflow.com/q/20944024
tags question: http://stackoverflow.com/q/20881714
tags question: http://stackoverflow.com/q/20913903
tags question: http://stackoverflow.com/q/20878280
tags question: http://stackoverflow.com/q/20943233
tags question: http://stackoverflow.com/q/20878245
tags question: http://stackoverflow.com/q/20887596
tags question: http://stackoverflow.com/q/20962762

http://stackoverflow.com/q/20993446
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31547824
has answer: http://stackoverflow.com/a/20994022
has answer: http://stackoverflow.com/a/20993642
type: Question
possible better answer: http://stackoverflow.com/a/20993752
has title: Is compiler able to optimize reference creation?
has body: Take for example a loop like this: public boolean method(){ for (int i = 0; i &lt; 5; i++) { if (this.object.getSomething().getSomeArray().get(i).getArray().size() &gt; 0) return false; } return true; } Each get method simply retrieves a private attribute. A more readable version of the same code would be: public boolean method(){ MySomeArray mySomeArray = this.object.getSomething().getSomeArray(); for (int i = 0; i &lt; 5; i++) { MyArray array = mySomeArray.get(i).getArray(); if (array.size() &gt; 0) return false; } return true; } Another version is: public boolean method(){ MySomeArray mySomeArray = this.object.getSomething().getSomeArray(); MyArray array; for (int i = 0; i &lt; 5; i++) { array = mySomeArray.get(i).getArray(); if (array.size() &gt; 0) return false; } return true; } I know that in theory compilers can optimize many things and in this case, (in my opinion) the three versions of the loop should be optimized in exactly the same machine code. Am I correct or there would be difference in terms of number of instructions executed in the three versions?
has answer: http://stackoverflow.com/a/20993752
tagged with: optimization
has comment: http://stackoverflow.com/comment/31548184
has answer: http://stackoverflow.com/a/20994210
has comment: http://stackoverflow.com/comment/31547586
accepted answer: http://stackoverflow.com/a/20994210
answer count: 4

http://stackoverflow.com/q/21017873
possible better answer: http://stackoverflow.com/a/21018046
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31591264
has comment: http://stackoverflow.com/comment/31591384
has body: I have a view in my android app that needs to open another view and also close\finish all the calling hierarchy that made it open. How can i do this? If i use this code, the finish() is never called no? Intent intent = new Intent(A.this, B.class); setResult(RESULT_OK); startActivity(intent); finish();
has title: using startActivityForResult() and then finish()
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21017921
favorite count: 0
has comment: http://stackoverflow.com/comment/31609811
type: Question
has comment: http://stackoverflow.com/comment/31591287
has comment: http://stackoverflow.com/comment/31591307
tagged with: android
accepted answer: http://stackoverflow.com/a/21017921
has answer: http://stackoverflow.com/a/21018046
answer count: 2
upvote count: 1
tagged with: android-intent
has comment: http://stackoverflow.com/comment/31591566
downvote count: 1

http://stackoverflow.com/q/20965445
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20966284
type: Question
accepted answer: http://stackoverflow.com/a/21021142
linked to: http://stackoverflow.com/q/1649435
linked to: http://stackoverflow.com/q/8204680
has comment: http://stackoverflow.com/comment/31494998
answer count: 3
has answer: http://stackoverflow.com/a/21021142
has comment: http://stackoverflow.com/comment/31494880
tagged with: regex
favorite count: 0
has answer: http://stackoverflow.com/a/21021232
has comment: http://stackoverflow.com/comment/31494797
upvote count: 2
has comment: http://stackoverflow.com/comment/31494847
possible better answer: http://stackoverflow.com/a/20966284
downvote count: 1
has title: Java Regex specify length
type: AnsweredQuestion
has body: Please find below the regex I am using for validating an email address. This is working fine. ^[-!#$%&amp;\\'*+\\\\./&lt;MORE_REGEX_HERE&gt;^_`a-z{|}~]+$ Now I want to add a length check in this regex for example the email address can be of max length 60. So I tried something like below ^([-!#$%&amp;\\'*+\\\\./&lt;MORE_REGEX_HERE&gt;^_`a-z{|}~]+){1,60}$ But its not working. Any thoughts?

http://stackoverflow.com/q/20851342
has answer: http://stackoverflow.com/a/22836117
score: 8
upvote count: 9
tagged with: java-native-interface
has title: Using Qt/C++ to call Java code through JNI. FindClass does not find class
has comment: http://stackoverflow.com/comment/31319712
has answer: http://stackoverflow.com/a/21175053
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21472540
answer count: 4
has answer: http://stackoverflow.com/a/25295742
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/31308938
tagged with: android
has comment: http://stackoverflow.com/comment/31295129
tagged with: qt
tagged with: c++
has body: I am new to JNI and this is my first program trying to call Java code from C++. I am using Qt 5.2 and I am writing an Android application. I am not able to find my java class and load it into my C++ program. I have read a lot of posts here on stack overflow and other places and it seems to be a common problem, but I have not been able to solve mine yet.. I am also not sure if the Java VM is properly set up as the Qt documentation on the QAndroidJniEnvironment is minimal. I am looking for a solution on how to be able to find my java class. I am also appreciating general feedback on other sections of the code (I assume there might be more errors). Error msg: Starting remote process.D/dalvikvm(24911): GC_CONCURRENT freed 384K, 5% free 9180K/9596K, paused 1ms+2ms, total 15ms D/dalvikvm(24911): Trying to load lib /data/data/org.qtproject.example.AndroidTest/lib/libgnustl_shared.so 0x428b2360 D/dalvikvm(24911): Added shared lib /data/data/org.qtproject.example.AndroidTest/lib/libgnustl_shared.so 0x428b2360 D/dalvikvm(24911): No JNI_OnLoad found in /data/data/org.qtproject.example.AndroidTest/lib/libgnustl_shared.so 0x428b2360, skipping init D/dalvikvm(24911): Trying to load lib /data/data/org.qtproject.example.AndroidTest/lib/libQt5Core.so 0x428b2360 D/dalvikvm(24911): Added shared lib /data/data/org.qtproject.example.AndroidTest/lib/libQt5Core.so 0x428b2360 D/dalvikvm(24911): Trying to load lib /data/data/org.qtproject.example.AndroidTest/lib/libQt5Network.so 0x428b2360 D/dalvikvm(24911): Added shared lib /data/data/org.qtproject.example.AndroidTest/lib/libQt5Network.so 0x428b2360 I/Qt (24911): Network start D/dalvikvm(24911): Trying to load lib /data/data/org.qtproject.example.AndroidTest/lib/libQt5Qml.so 0x428b2360 D/dalvikvm(24911): Added shared lib /data/data/org.qtproject.example.AndroidTest/lib/libQt5Qml.so 0x428b2360 D/dalvikvm(24911): No JNI_OnLoad found in /data/data/org.qtproject.example.AndroidTest/lib/libQt5Qml.so 0x428b2360, skipping init D/dalvikvm(24911): …
tagged with: java
linked to: http://stackoverflow.com/q/13263340
has comment: http://stackoverflow.com/comment/31294216
has comment: http://stackoverflow.com/comment/31308787
downvote count: 1

http://stackoverflow.com/a/21000913
answers question: http://stackoverflow.com/q/21000508
score: 0
type: Answer
has body: Normally key/value pairs assume a map, but in your case names are likely to have duplicates. So you are better off using a list (of pairs: name/from, e.g. of type Pair) to store data (unless my assumption about duplications is wrong). As you need to have random access to data use ArrayList Extracting random values from a collection is a completely independent problem: do you want/allow duplications or not? do you need to generate a random subset (collection) or to have a function that gives you a next random value from the list (possibly with duplications)? Assuming you want a random subset of data from the list use Google Permutations class. Assuming you want a random next value from the list (with duplications) use e.g. Math.random()*datalist.size() and convert it (down) to integer to get and index of an element, which then can be extracted using datalist.get(index).

http://stackoverflow.com/q/20965564
has answer: http://stackoverflow.com/a/21202600
answer count: 4
possible better answer: http://stackoverflow.com/a/24466667
score: 61
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24466667
tagged with: windows-xp
accepted answer: http://stackoverflow.com/a/21202600
downvote count: 1
tagged with: java-8
linked to: http://stackoverflow.com/q/11808829
type: Question
has comment: http://stackoverflow.com/comment/31500683
tagged with: dll
linked to: http://stackoverflow.com/q/1619662
has comment: http://stackoverflow.com/comment/31500604
tagged with: java
upvote count: 62
has comment: http://stackoverflow.com/comment/31614443
has comment: http://stackoverflow.com/comment/31502276
has body: I downloaded JDK8 build b121 and while trying to install I'm getting the following error: the procedure entry point RegDeleteKeyExA could not be located in the dynamic link library ADVAPI32.dll The operating system is Windows XP, Version 2002 Service Pack 3, 32-bit.
has comment: http://stackoverflow.com/comment/31580636
has answer: http://stackoverflow.com/a/26592646
has comment: http://stackoverflow.com/comment/31503442
favorite count: 0
has comment: http://stackoverflow.com/comment/31500904
has title: installing JDK8 on Windows XP - advapi32.dll error
has answer: http://stackoverflow.com/a/22683874
linked to: http://stackoverflow.com/q/24943927

http://stackoverflow.com/a/20889821
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31352479
has body: The factorial function overflows the range for int already at 13, so you will not be able to use the formula that uses factorials directly. Instead, expand the factorials and compute nCk from the alternative definition: nCk = n*(n-1)*...*(n-k+1) / k*(k-1)*...*2*1
answers question: http://stackoverflow.com/q/20889670
upvote count: 1
type: Answer

http://stackoverflow.com/comment/31486937
score: 0
has text: This is how my Service looks like (StreamFileService.thrift): typedef binary binar service StreamFileService { binar getBytes(1:string fileName); }
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20960541

http://stackoverflow.com/comment/31493937
comment on: http://stackoverflow.com/q/20964894
type: QuestionComment
type: Comment
has text: ImageIO.read(new File("D:\\image\\12.jpg")); -- Is in Java.. Your Android system doesnt have this path. The same applies to Write operations as well... You have to put these images in "raw" folder and access these images... Remember, your android system is different from your Windows system..
score: 0

http://stackoverflow.com/comment/31384984
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20904392
has text: Just saw your edit, and first of something you misunderstood me or i was not very clear. The 32:2 should not be divided it is a number. i have just edited my original post, with some code. maybe you can help me ?
type: AnswerComment

http://stackoverflow.com/comment/31358814
comment on: http://stackoverflow.com/q/20893506
score: 0
has text: Jeff, just corrected me, and claims my problem is that my package names are conflicting. But regardless, when I do such, the problem still occurs. Thanks C:
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21012564
downvote count: 0
has body: You can use split() and create an array. String name = "John Mark Lester Andrew Todd"; String[] names=name.split(" ");
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/21012543
score: 2

http://stackoverflow.com/a/64699471
has body: With null in first position and then from the oldest to the newest : Collections.sort(myList, new Comparator&lt;MyBean&gt;() { public int compare(MyBean b1, MyBean b2) { if (b1 == null || b1.getMyDate() == null) { return -1; } if (b2 == null || b2.getMyDate() == null) { return 1; } return b1.getMyDate().compareTo(b2.getMyDate()); } });
type: Answer
score: 0
answers question: http://stackoverflow.com/q/20946128

http://stackoverflow.com/q/20891390
upvote count: 5
has body: I want to know there is some algorithm that make a graph into planar graph ? I searched in Google I didn't find something that can help me
has comment: http://stackoverflow.com/comment/88129812
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20891718
downvote count: 0
has answer: http://stackoverflow.com/a/20891718
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31355393
tagged with: graph
score: 5
tagged with: algorithm
has title: Algorithm to make a simple graph planar
answer count: 2
has comment: http://stackoverflow.com/comment/31355486
has answer: http://stackoverflow.com/a/20895774
has comment: http://stackoverflow.com/comment/31355043
accepted answer: http://stackoverflow.com/a/20895774
tagged with: planar-graph
favorite count: 0

http://stackoverflow.com/q/20910597
has title: Jframe dispose on condition
has answer: http://stackoverflow.com/a/20910734
has body: This is my code: public Loading(Evento e){ initComponents(); setLocationRelativeTo(null); this.evento = e; new Thread(new thread1()).start(); } public class thread1 implements Runnable{ @Override public void run(){ for (int i=0; i&lt;=100; i++){ //Progressively increment variable i jpb.setValue(i); //Set value jpb.repaint(); //Refresh graphics try{ Thread.sleep(30); if(i==100){ GestaoEvento a = new GestaoEvento(evento); a.setVisible(true); ---&gt;&gt;&gt;&gt;this.dispose();&lt;&lt;&lt;&lt;--- } } //Sleep 50 milliseconds catch (InterruptedException err){} } } } this.dispose() doesn't work there because this refers to the thread, how can I close this frame there?
has comment: http://stackoverflow.com/comment/31390764
tagged with: dispose
score: 0
tagged with: thread-sleep
answer count: 1
tagged with: jframe
tagged with: swing
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20910734
tagged with: java
type: Question

http://stackoverflow.com/comment/31499263
has text: yes agree (excluding of 99 pct of users here) we aren't code engine here...............
comment on: http://stackoverflow.com/q/20967823
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31595124
comment on: http://stackoverflow.com/q/21016884
score: 0
type: QuestionComment
type: Comment
has text: Thanks for your help. What I ended up doing: create a jar of application 2, import that jar to application 1, I copied all the resource/wordnet to my application 1 workspace and it works. Thanks for your help!

concurrency
tag name: concurrency
tags question: http://stackoverflow.com/q/20952590
tags question: http://stackoverflow.com/q/20949071
tags question: http://stackoverflow.com/q/20945984
tags question: http://stackoverflow.com/q/20969486
tags question: http://stackoverflow.com/q/20995715
tags question: http://stackoverflow.com/q/20980154
tags question: http://stackoverflow.com/q/20983570
tags question: http://stackoverflow.com/q/20882815
tags question: http://stackoverflow.com/q/20894516
tags question: http://stackoverflow.com/q/20893557
tags question: http://stackoverflow.com/q/21000931
type: Tag
tags question: http://stackoverflow.com/q/20859113
tags question: http://stackoverflow.com/q/20969292
tags question: http://stackoverflow.com/q/20948756
tags question: http://stackoverflow.com/q/20912466
tags question: http://stackoverflow.com/q/21005383

http://stackoverflow.com/q/20967089
possible better answer: http://stackoverflow.com/a/20967375
accepted answer: http://stackoverflow.com/a/20967165
type: Question
tagged with: android-layout
has body: I am trying to create a help screen overlay which appears the first time the app is run which covers the entire screen including the action bar. I have the logic to work out if the app has been launched before, however I'm struggling to get the overlay to cover the action bar. I have tried a few different techniques, including a custom dialog and calling a new layout on top, all of which seem to not cover the action bar. Could some please help me. in the onCreate method: Dialog helpOverlay = new Dialog(HomeActivity.this); helpOverlay.requestWindowFeature(Window.FEATURE_NO_TITLE); helpOverlay.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); helpOverlay.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); helpOverlay.getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY); helpOverlay.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); WindowManager.LayoutParams params = helpOverlay.getWindow().getAttributes(); params.gravity = Gravity.TOP | Gravity.LEFT; params.x = 100; params.y = 20; // If user taps anywhere on the screen, dialog will be cancelled. helpOverlay.setCancelable(true); // Setting the content using prepared XML layout file. helpOverlay.setContentView(R.layout.help_overlay); helpOverlay.show(); help_overlay.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/home_overlay_layout_test" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:windowActionBarOverlay="true"&gt; &lt;ImageView android:id="@+id/help_overlay_test" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:src="@drawable/helphome" /&gt; &lt;/RelativeLayout&gt; The helphome image is a 9-patch image which I was hoping to use for all resolutions.…
has comment: http://stackoverflow.com/comment/31497713
tagged with: java
has answer: http://stackoverflow.com/a/20967165
has comment: http://stackoverflow.com/comment/31497722
answer count: 2
upvote count: 1
tagged with: layout
downvote count: 0
has answer: http://stackoverflow.com/a/20967375
favorite count: 0
linked to: http://stackoverflow.com/q/4481226
tagged with: android
type: AnsweredQuestion
has title: Android - how to create an overlay fullscreen including Action Bar
score: 1

http://stackoverflow.com/q/20973268
score: 2
downvote count: 0
type: UnansweredQuestion
has body: I have stucked with how to parse these data in the form of key value pair.Please guide me Company Name: Cartell Chemical Co., Ltd. Business Owner: Michael Chen Employees: 210 Main markets: North America, Europe, China, South Asia Business Type: Manufacturer I need output in these format.please guide me using Java with Jsoup library Company Name:Cartell Chemical Co., Ltd. Business Owner:Michael Chen Employees:210 Main markets:North America, Europe, China, South Asia Business Type:Manufacturer
type: Question
has answer: http://stackoverflow.com/a/20973477
tagged with: java
upvote count: 2
tagged with: jsoup
answer count: 2
has answer: http://stackoverflow.com/a/20973764
has title: Parsing String with key value pair using Jsoup Library
favorite count: 0

http://stackoverflow.com/comment/31822643
type: AnswerComment
type: Comment
has text: What I'm now trying to do is make the mask take 100101011111010101010111 and return 10010101-11110101-01010111 and be able to do that with any number of bytes.
comment on: http://stackoverflow.com/a/21001773
score: 0

http://stackoverflow.com/a/20983259
type: Answer
upvote count: 2
has body: Multiple threads are executing the same operation simultaneously. Therefore, you will of course get different answers each time you run it, based on which Threads run at which times (which is not deterministic). Note that your synchronization is inside your for loop, which means that each thread will loop independently of the synchronization. Also, you are synchronizing on this which means that each instance of the Thread is synchronizing only with itself i.e. there is no synchronization at all. You could synchronize outside the loop on a common monitor Object. But that of course, would basically cause each Thread to do the operation serially. But at least your result will be deterministic. If you want to do the multiplication only once for each element in the array, in a multi-threaded manner, you should initialize each Thread with a specific slice of the array to process.
answers question: http://stackoverflow.com/q/20983122
score: 2
downvote count: 0

http://stackoverflow.com/a/20939583
type: Answer
has comment: http://stackoverflow.com/comment/31446246
upvote count: 3
accepted answer of: http://stackoverflow.com/q/20939548
answers question: http://stackoverflow.com/q/20939548
score: 3
type: AcceptedAnswer
downvote count: 0
has body: You don't want to pass in the Array (note that it is an Array not a List, they are different things): public void setListSize () { You want to set up your member array: listA = new int [listSize]; Before you were passing an array into the function then overwriting the reference to that array local to the function only. What you need to do is modify the reference to the array in the main object, for which either listA needs to be static (so the static method can access it) or setListSize needs to be non-static. To make this function generic do this: public static int[] createList() { Scanner reader = new Scanner (System.in); while (true) { System.out.print("Enter array size for between [1-50]: "); int listSize = Integer.parseInt(reader.nextLine()); if (listSize &gt; 50 || listSize &lt; 1) { System.out.println("Array size must be between [1-50]"); } else { return new int [listSize]; } } } Then in your calling function just do: listA = createList(); listB = createList(); etc.

http://stackoverflow.com/q/20986514
type: Question
has answer: http://stackoverflow.com/a/20986752
tagged with: java
has comment: http://stackoverflow.com/comment/31534480
has comment: http://stackoverflow.com/comment/31534872
score: 0
has title: Search for specific string inside text file
answer count: 1
has comment: http://stackoverflow.com/comment/31535021
has body: I am currently developing a java application that will read the contents of text files from a specific folder. The application is already capable of reading the contents of text files, however, the text files are server logs and I only need to take data from their contents such as Error Name, Time, Date, etc. Any ideas on how to do that, or functions that can help me? For a better view here is my code. public class ListFiles { public static void main(String[] args) throws FileNotFoundException, IOException { // Directory path here String path = "C:/Users/Pasusani/Desktop/logs"; String files; File folder = new File(path); File[] listOfFiles = folder.listFiles(); for (int i = 0; i &lt; listOfFiles.length; i++) { if (listOfFiles[i].isFile()) { files = listOfFiles[i].getName(); if (files.endsWith(".txt") || files.endsWith(".TXT")) { if (listOfFiles[i].getName().equals("R320-txtfile.txt")) { JOptionPane.showMessageDialog(null, listOfFiles[i] .getName().toString()); String paths = "C:/Users/Pasusani/Desktop/logs/" + listOfFiles[i].getName().toString(); FileReader file = new FileReader(paths); BufferedReader reader = new BufferedReader(file); String text = ""; String line = reader.readLine(); while (line != null) { text += line; line = reader.readLine(); } System.out.println(text); JTextArea ta = new JTextArea(); ta.setVisible(true); ta.setText(text); } else if (listOfFiles[i].getName().equals("try.txt")) { String paths = "C:/Users/Pasusani/Desktop/logs/" + listOfFiles[i].getName().toString(); FileReader file = new FileReader(paths); BufferedReader reader = new BufferedReader(file); String text = ""; String line = reader.readLine(); while (line != null) { text += line; line = reader.readLine(); } System.out.println(text); JTextArea ta = new JTextArea(); ta.setVisible(true); ta.setText(text); } else { JOptionPane.showMessageDialog(null, "hah"); } // System.out.println(files); } else { JOptionPane.showMessageDialog(null, "wala lang"); } } } } }
tagged with: io
has comment: http://stackoverflow.com/comment/31534925
tagged with: parsing
tagged with: text-files
type: UnansweredQuestion

http://stackoverflow.com/comment/31435162
score: 0
type: Comment
has text: First check the required APIs are available on your included folder/path. If the APIs are there than check if you have included them while compilation compiler should be able to access it.
type: AnswerComment
comment on: http://stackoverflow.com/a/20933885

http://stackoverflow.com/a/20931246
answers question: http://stackoverflow.com/q/20931176
score: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31430014
has body: Here is a sample class. Check the comments.... public class A{ void m1() { ..... B b=new B(); b.m1() ; //will call only method m1 in B b.m2() ; //will call only method m2 in B b.callAll() ; //will call both m1 and m2 method in B .... } } public class B { void m1() { .... } void m2() { .... } void callAll() { m1(); m2(); } }
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/20931176

http://stackoverflow.com/comment/31561758
score: 0
type: Comment
has text: Not sure if you are talking about passing parameters to an object of a class (constructor) or you want command-line arguments.
type: QuestionComment
comment on: http://stackoverflow.com/q/21001802

http://stackoverflow.com/comment/31382236
score: 0
has text: How can I draw to a spritebatch a polygon? i want to define 8 points, and move each one with the keyboard, until i have the perfect match.
comment on: http://stackoverflow.com/a/20906425
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31550377
comment on: http://stackoverflow.com/a/20989476
has text: I cant to use try catch as : 1. NullPointerException may be occours not only by getActivity, but also by code written in that thread. 2. I have used Jar File in my project, some of the threads are envoked from there. Also it's not a good pratice to use try catch. So, I avoid such solutions, want to know if there is any better solution.Thanks for responding
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31387982
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20908783
type: AnswerComment
has text: how do i do that when exporting? ive only found this macro - http://support.microsoft.com/kb/291296/en-us i need a simpler way than a macro. the client has to be able to push out an updated csv to the users easily

http://stackoverflow.com/a/20953164
upvote count: 9
answers question: http://stackoverflow.com/q/20945602
downvote count: 0
has body: A more efficient solution is String str[] = {"a", "b", "c"}; // or whatever if (str.length == 0 ) { return ""; } return "'" + Joiner.on("','").join(str) + "'"; which is also shorter than using a Function (at least without function literals; the handling of an empty input makes this solution ugly). The bad part is the fact that you have to include the prefix and suffix in the Joiner in an not really obvious way and repeat them. This example makes it more obvious: return "[" + Joiner.on("], [").join(str) + "]"; To get it right without thinking, just remember what comes out for ["+", "+"], namely [+], [+] and use the plus-separated parts.
has comment: http://stackoverflow.com/comment/31496519
score: 9
type: Answer

http://stackoverflow.com/a/20987253
type: Answer
answers question: http://stackoverflow.com/q/20978535
downvote count: 0
score: 26
type: AcceptedAnswer
upvote count: 26
has body: After doing some digging, I've discovered that the HTTPRequestAdapter.parseRequest() method has an issue with the way that MockMVC sends requests. Specifically, the request sent by MockMVC doesn't include a header in the request with the name host. HTTPRequestAdapter requires that header and does not account for the fact that it can be null, so it generates the NullPointerException. I fixed the issue with this code: mockMvc.perform(get("/validation-success") .header("host", "localhost:80")) .andExpect(status().isOk()); The host header won't be null and your tests should pass.
accepted answer of: http://stackoverflow.com/q/20978535

http://stackoverflow.com/comment/31287646
has text: ok , but can you tell me how to add graphics from different classes on the sam Panel ?? i am searching on the internet for 30-40 minutes and nothing..
comment on: http://stackoverflow.com/q/20856152
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/31323793
type: Comment
comment on: http://stackoverflow.com/q/20874775
has text: How would I populate it? As I am trying to populated it to all be "0.00%" initially.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/31375823
type: QuestionComment
has text: the code that you show us does not show where either paint or paint2 are called.
score: 0
comment on: http://stackoverflow.com/q/20903193
type: Comment

http://stackoverflow.com/a/21017614
answers question: http://stackoverflow.com/q/21008480
score: 0
type: Answer
has body: Finally I found the answer. The mistake was, doing a sign() in Alice part. Because when you are doing the hashing and encryption it already became a signature, and when you sign() it another time in the Bob's part became impossible to recover the hashed signature . my code is also a good example of "One-way hashing in java security public key encryption" this is the modification in Alice part and everything work after. public byte[] Sign(byte[] aMessage) { try { // get an instance of a cipher with RSA with ENCRYPT_MODE // Init the signature with the private key // Compute signature Cipher cipher = Cipher.getInstance("RSA"); cipher.init(Cipher.ENCRYPT_MODE, thePrivateKey); // get an instance of the java.security.MessageDigest with MD5 // process the digest MessageDigest md5_digest = MessageDigest.getInstance("MD5"); byte[] digest = md5_digest.digest(aMessage); // return the encrypted digest byte[] cipherText = cipher.doFinal(digest); return cipherText; } catch (Exception e) { System.out.println("Signature error"); e.printStackTrace(); return null; } }
accepted answer of: http://stackoverflow.com/q/21008480
type: AcceptedAnswer

http://stackoverflow.com/a/20984998
answers question: http://stackoverflow.com/q/20984943
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
has body: You are most likely getting a NumberFormatException since dividing an integer by 2 results in a number ending in .5 The dot will cause parseInt() to fail, integers have no periods. You could just catch the Exception, but I suggest you just cast the resulting double to an int because getWidth() returns an integer anyways, so you cannot go out of bounds. I also do not see the point of the String nonsense unless you are displaying these numbers in a TextView or something similar. Eg int myNum = (int) (getWindowManager().getDefaultDisplay().getWidth()/2); Which is equivalent to double widthDouble = getWindowManager().getDefaultDisplay().getWidth()/2; int myNum = (int) widthDouble;
upvote count: 2
accepted answer of: http://stackoverflow.com/q/20984943

http://stackoverflow.com/comment/31342893
type: Comment
type: QuestionComment
score: 1
has text: If they open the port by mistake I will open a bug on Java :) With Excel it is not the bug.
comment on: http://stackoverflow.com/q/20884353

http://stackoverflow.com/a/20905535
score: 0
has comment: http://stackoverflow.com/comment/31381932
type: Answer
has comment: http://stackoverflow.com/comment/31380837
accepted answer of: http://stackoverflow.com/q/20905489
has comment: http://stackoverflow.com/comment/31382379
has comment: http://stackoverflow.com/comment/31381185
answers question: http://stackoverflow.com/q/20905489
has comment: http://stackoverflow.com/comment/31380935
has comment: http://stackoverflow.com/comment/31380618
has body: I think what your asking for is an image hosting site, maybe http://www.imgur.com ? If this is not correct, please explain your question in more detail, a code sample of downloading an image does not offer much in site into a solution your looking for
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31382017
has comment: http://stackoverflow.com/comment/31380528
has comment: http://stackoverflow.com/comment/31381307

http://stackoverflow.com/a/40687608
has comment: http://stackoverflow.com/comment/99481847
type: Answer
has body: I found that when I used the toArray method, I got the results in the reverse order to what I expected. When I created this stack: Stack&lt;String&gt; stack = new Stack&lt;&gt;(); stack.push("foo"); stack.push("bar"); I wanted an array like: {"bar", "foo"} Because of course, stacks are LIFO. If you pop each element off the stack, you would pop "bar" first, and then "foo". Instead, toArray returns {"foo", "bar"}. A solution is to use a LinkedList instead. There is a push method on LinkedList, it performs the same as addFirst, and the result will be a list whose contents (if you traverse it of course) are "bar" and then "foo". And it also has the toArray method which returns as expected. Test case: LinkedList&lt;String&gt; list = new LinkedList&lt;&gt;(); list.push("foo"); list.push("bar"); String[] arr = list.toArray(new String[0]); Assert.assertArrayEquals(new String[] { "bar", "foo" }, arr);
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/20959537
downvote count: 0

http://stackoverflow.com/a/45170263
downvote count: 0
answers question: http://stackoverflow.com/q/20902290
score: 4
has body: Please read manual for c++ method Resize it's the same to java. You can choose a type of interpolation. In some cases it's important for a best result. Mat croppedImage = cropImage(image,rect); Mat resizeImage = new Mat(anyHeight, anyWidth, croppedImage.type()); int interpolation = Imgproc.INTER_CUBIC; Imgproc.resize(croppedImage, resizeImage, resizeImage.size(), 0, 0, interpolation );
type: Answer
upvote count: 4

http://stackoverflow.com/comment/31498043
has text: Hi Ali HAMDI, I am getting the same error when I tried with SoapUI tool as well. And internet issue can be completely ruled out
score: 0
comment on: http://stackoverflow.com/q/20967299
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31343232
type: AnswerComment
score: 0
type: Comment
has text: SOAPUI is generating data based on WSDL. I give my WSDL URI like `http://localhost:8080/test//service/test-api/testApi.wsdl`, when i create new SOAPUI project
comment on: http://stackoverflow.com/a/20883478

http://stackoverflow.com/a/21011084
has comment: http://stackoverflow.com/comment/31579771
has body: Use a stringbuffer or a stringbuilder to concatenate your string object in the tostring method Your aString gets initialized again and again without concatenation Use stringbuffer.append here where aString should be a str in String buffer Edit1 public String toString() { StringBuffer aString = new StringBuffer(); for(int row = 0; row &lt; arrayName.length; row++) { for(int col = 0; col &lt; arrayName[row].length; col++) { aString.append(" " + arrayName[row][col]); } } return aString.toString(); }
score: 0
has comment: http://stackoverflow.com/comment/31579527
type: Answer
answers question: http://stackoverflow.com/q/21011027

http://stackoverflow.com/comment/76758567
has text: For my case it was a simple file size issue, see[link](https://tecadmin.net/increase-tomcat-upload-file-size-limit/)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20995808
score: 0

http://stackoverflow.com/comment/31584332
type: Comment
has text: @ Hardik >> already posted
comment on: http://stackoverflow.com/q/21013793
score: 0
type: QuestionComment

substring
tags question: http://stackoverflow.com/q/20999861
type: Tag
tags question: http://stackoverflow.com/q/20954408
tags question: http://stackoverflow.com/q/21012521
tag name: substring

http://stackoverflow.com/comment/31565089
type: Comment
type: QuestionComment
score: 1
has text: so make position `final` or make data `final` though i think getting the task on the position is better
comment on: http://stackoverflow.com/q/21003484

http://stackoverflow.com/q/20904300
answer count: 0
has comment: http://stackoverflow.com/comment/31387038
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31378289
tagged with: forms
type: Question
has title: playframework, using forms to add/change something in a database
tagged with: playframework
type: UnansweredQuestion
has body: I'm am trying to make a database with ploegen. Now I want to give every ploeg a value punten. I made the input form like this: Geef punten @form(routes.Application.geefPunten(ploegnaam, punten)) { @inputText(ploegForm("ploegnaam")) @inputText(ploegForm("punten")) } But when I try to run this, I get an error saying: not found: value ploegnaam In my routes file I made this: # Ploegen GET /ploegen controllers.Application.ploegen() POST /ploegen controllers.Application.nieuwePloeg() POST /ploegen controllers.Application.deletePloeg(id: Long) POST /ploegen controllers.Application.geefPunten(ploegnaam: String, punten: Integer) And this is the method which I made in my Application: public static Result geefPunten(String ploegnaam, Integer punten) { return TODO; } Can you tell me how to solve this error?

http://stackoverflow.com/q/20947972
has comment: http://stackoverflow.com/comment/31477745
has comment: http://stackoverflow.com/comment/31646650
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31501177
has comment: http://stackoverflow.com/comment/31471846
has comment: http://stackoverflow.com/comment/31504936
has comment: http://stackoverflow.com/comment/31511273
type: Question
has title: Netbeans 7.4 issue: build-impl.xml is overwritten as build-impl.xml~ at shutdown
has comment: http://stackoverflow.com/comment/31498736
has body: Every time I shut down Netbeans 7.4, the build-impl.xml swaps name to build-impl.xml~, and so when I reopen Netbeans and run my project, I immediately get the error build.xml:12: Cannot find nbproject/build-impl.xml imported from build.xml Simply renaming the file build-impl.xml resolves the issue, but it is a pain to do each time. What is causing this issue, and is there a more permanent solution? Thanks
tagged with: netbeans
has comment: http://stackoverflow.com/comment/31470866
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31498771

http://stackoverflow.com/q/20974316
tagged with: jdbc
has body: I have a ResultSet object ResultSet theInfo = stmt.executeQuery(sqlQuery); but I want to have a function that can be called from another java class public Vector loadStuff(){ try { while (theInfo.next()){ aVector.addElement(new String(theInfo.getString("aColumn"))); // puts results into vectors } } catch (SQLException e) { e.printStackTrace(); } return aVector; } I'm not entirely sure how to go about this. I want to some how call a void method that returns a populated vector. is this possible?
has answer: http://stackoverflow.com/a/20975180
score: 0
answer count: 1
tagged with: java
has title: how to get a ResultSet from an outside java class
accepted answer: http://stackoverflow.com/a/20975180
type: AnsweredQuestion
tagged with: vector
tagged with: sql
has comment: http://stackoverflow.com/comment/31510903
has comment: http://stackoverflow.com/comment/31511042
type: Question

http://stackoverflow.com/comment/31477700
has text: You are passing the values of the variables( 5, 10, 20, 30); Instead of passing the variables (x,y,width,length) which you have declared and assigned values to.
type: QuestionComment
comment on: http://stackoverflow.com/q/20956561
type: Comment
score: 0

http://stackoverflow.com/a/20994682
answers question: http://stackoverflow.com/q/20992496
upvote count: 1
has comment: http://stackoverflow.com/comment/31550155
has comment: http://stackoverflow.com/comment/31548617
has comment: http://stackoverflow.com/comment/31548325
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31549687
score: 1
has comment: http://stackoverflow.com/comment/31549545
has comment: http://stackoverflow.com/comment/31548699
type: Answer
has comment: http://stackoverflow.com/comment/31549190
has comment: http://stackoverflow.com/comment/31549079
has body: I think that 333 and 638 are both good answers... Let me explain : April included to December 1986 = 9 months + 27 full years + 0 months in 2014 = 333. Same thinking applied to the other : November included to december 1960 = 2 months + 53 full years + 0 months in 2014 = 638. Both numbers are right from the point of view : first month included, last month excluded
accepted answer of: http://stackoverflow.com/q/20992496

http://stackoverflow.com/q/20875648
answer count: 4
linked to: http://stackoverflow.com/q/17874717
has answer: http://stackoverflow.com/a/20875706
tagged with: swing
type: Question
tagged with: actionlistener
has comment: http://stackoverflow.com/comment/31325577
tagged with: java
has title: Action Listener error
has comment: http://stackoverflow.com/comment/31325551
has body: I keep getting an error when I implement the ActionListener. I dont really understand how to fix it. I did the actionPerformed (ActionEvent ev) {} and put my login button to call it with lg.addActionListener(this); import java.awt.*; import javax.swing.*; import java.awt.Event.*; import java.applet.Applet; public class LoginScreen extends JApplet implements ActionListener { JTextField un; JPasswordField pw; JButton lg; JLabel user,pass; public LoginScreen () { un = new JTextField (); pw = new JPasswordField (); lg = new JButton ("login"); user = new JLabel ("username"); pass = new JLabel ("password"); lg.addActionListener(this); this.setLayout(null); user.setBounds(10, 10, 120, 20); pass.setBounds(10, 30, 120, 20); un.setBounds(140, 10, 200, 20); pw.setBounds(140, 30, 200, 20); lg.setBounds(140, 55, 100, 20); this.add(user); this.add(pass); this.add(un); this.add(pw); this.add(lg); this.setSize(500, 300); this.setVisible(true); } public void actionPerformed(ActionEvent ev) { } }
has answer: http://stackoverflow.com/a/20875701
score: 0
linked to: http://stackoverflow.com/q/5621338
has answer: http://stackoverflow.com/a/20875713
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31328537
has comment: http://stackoverflow.com/comment/31328478
has answer: http://stackoverflow.com/a/20875720

http://stackoverflow.com/a/20898101
upvote count: 1
has body: create new instance of Student object inside the for loop like this for (String item : strList) { int x = 0; String[] arr = item.split(":"); Student student = new Student(); student.setFirstName(arr[0]); student.setLastName(arr[1]); student.setRegNumber(arr[2]); student.setCoursework1Marks(Integer.parseInt(arr[3])); student.setCoursework2Marks(Integer.parseInt(arr[4])); student.setFinalExamMarks(Integer.parseInt(arr[5])); studentDetails.add(student); }
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20898050

http://stackoverflow.com/comment/31396991
score: 2
has text: Here is the section explaining that: http://developer.android.com/guide/practices/screens_support.html#ConfigurationExamples
type: AnswerComment
comment on: http://stackoverflow.com/a/20913614
type: Comment

http://stackoverflow.com/comment/31609732
has text: @EricB. The method itself is defined in the abstract base class `AbstractHandlerMapping`
type: Comment
comment on: http://stackoverflow.com/a/21004067
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31449139
type: Comment
comment on: http://stackoverflow.com/a/20940791
score: 0
type: AnswerComment
has text: I've always struggled to find the reason not to use `public enum MySingleton { INSTANCE; }` vs this idiom. The only difference is that with the enum, the singleton is loaded when the enum is loaded vs. the singleton is loaded when `getInstance` is called with the private holder. However I don't see why you would load the enum unless you plan to actually use the singleton, so in most reasonable cases they would be loaded at the same time...

2d
tags question: http://stackoverflow.com/q/20973786
tags question: http://stackoverflow.com/q/20959717
tags question: http://stackoverflow.com/q/20926039
tag name: 2d
tags question: http://stackoverflow.com/q/20861508
type: Tag

http://stackoverflow.com/q/20967683
tagged with: android
has answer: http://stackoverflow.com/a/20967704
has answer: http://stackoverflow.com/a/20967744
has comment: http://stackoverflow.com/comment/31498776
type: AnsweredQuestion
has title: Android: Runtime crash when added SDK_INT code
tagged with: java
tagged with: eclipse
type: Question
accepted answer: http://stackoverflow.com/a/20967704
tagged with: runtime-error
possible better answer: http://stackoverflow.com/a/20967720
has body: I have tried to add some extra code to an already working project that would show some TextView text: a line telling the user the Android version they are using. However, I added the code and there are no red errors in the project itself, but the app crashes when it runs. I tried to clean my project, which seems to work fine, but it doesn't fix the problem. The only files I added code to were the main, the layout, and the strings files. They are posted below. I added just 2 lines of new code in the updateQuestion() method, although it seems to have no problem there. I added a TextView widget in the activity_quiz.xml layout file (at the bottom) and then I added 1 string, API level near the top in the strings.xml file. Here is my LogCat (I don't know what it means): 01-07 00:45:18.256: E/AndroidRuntime(20543): FATAL EXCEPTION: main 01-07 00:45:18.256: E/AndroidRuntime(20543): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.bignerdranch.android.geoquiz/com.bignerdranch.android.geoquiz.QuizActivity}: java.lang.NullPointerException 01-07 00:45:18.256: E/AndroidRuntime(20543): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211) 01-07 00:45:18.256: E/AndroidRuntime(20543): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) 01-07 00:45:18.256: E/AndroidRuntime(20543): at android.app.ActivityThread.access$600(ActivityThread.java:141) 01-07 00:45:18.256: E/AndroidRuntime(20543): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) 01-07 00:45:18.256: E/AndroidRuntime(20543): at android.os.Handler.dispatchMessage(Handler.java:99) 01-07 00:45:18.256: E/AndroidRuntime(20543): at android.os.Looper.loop(Looper.java:137) 01-07 00:45:18.256: E/AndroidRuntime(20543): at android.app.ActivityThread.main(ActivityThread.java:5103) 01-07 00:45:18.256: E/AndroidRuntime(20543): at java.lang.reflect.Method.invokeNative(Native Method) 01-07 00:45:18.256: E/AndroidRuntime(20543): at java.lang.reflect.…
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/20967720

http://stackoverflow.com/q/20859493
has answer: http://stackoverflow.com/a/20859831
accepted answer: http://stackoverflow.com/a/20860414
has answer: http://stackoverflow.com/a/20859821
has answer: http://stackoverflow.com/a/20859603
has answer: http://stackoverflow.com/a/20860414
tagged with: sockets
answer count: 4
tagged with: serversocket
has title: How to restart a serverSocket in java
possible better answer: http://stackoverflow.com/a/20859603
type: AnsweredQuestion
tagged with: network-programming
tagged with: java
has body: I am trying to add a restart server function that ejects all players and threads, then starts a new server socket for new players. This is how I have tried it, but when I restart, then try to add more players they don't connect? Any help would be awesome, thanks. Alternatively, is there a way to eject all connections from server without closing socket? private volatile ServerSocket ss; private Socket p1; private Socket p2; private GameSession ses; private ObjectOutputStream top1; private ObjectOutputStream top2; public void connectToClient() { try { ss = new ServerSocket(8000); while (true) { p1 = ss.accept(); top1 = new ObjectOutputStream(p1.getOutputStream()); p2 = ss.accept(); top2 = new ObjectOutputStream(p2.getOutputStream()); see = new GameSession(p1, p2, top1, top2); new Thread(see).start(); } } catch (IOException ex) { System.err.println(ex); } } private void restartServer() { if (ss.isBound()) { try { ss.close(); ss = new ServerSocket(8000); displayLog.append(new Date() + ": Server started at socket " + ss.getLocalPort() + '\n'); } catch (IOException ex) { System.err.println(ex); } } }
has comment: http://stackoverflow.com/comment/31294046
type: Question
score: 0

http://stackoverflow.com/comment/31376410
has text: @DavidWallace thanks. But the link in one of the answers to question http://javabook.compuware.com/content/memory/how-garbage-collection-works.aspx explained "there is no explicit deletion and no memory is given back to the operating system."
comment on: http://stackoverflow.com/q/20880231
score: 0
type: QuestionComment
type: Comment

jaxb
tags question: http://stackoverflow.com/q/20997527
tags question: http://stackoverflow.com/q/20907623
tags question: http://stackoverflow.com/q/20997421
tags question: http://stackoverflow.com/q/21005841
tags question: http://stackoverflow.com/q/20896645
tags question: http://stackoverflow.com/q/20873523
tags question: http://stackoverflow.com/q/20962053
tags question: http://stackoverflow.com/q/20982576
tags question: http://stackoverflow.com/q/20973589
type: Tag
tag name: jaxb
tags question: http://stackoverflow.com/q/20973171
tags question: http://stackoverflow.com/q/21004786
tags question: http://stackoverflow.com/q/20879988
tags question: http://stackoverflow.com/q/20998414
tags question: http://stackoverflow.com/q/20908213
tags question: http://stackoverflow.com/q/20885742
tags question: http://stackoverflow.com/q/20883329

http://stackoverflow.com/comment/31469447
type: Comment
has text: Yeah, I made sure you had more than 1 ;-)
comment on: http://stackoverflow.com/a/20950859
score: 1
type: AnswerComment

http://stackoverflow.com/comment/31572098
has text: moving your choosedCosN declaration out of the ActionListener should work..
comment on: http://stackoverflow.com/q/21006861
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20889929
has comment: http://stackoverflow.com/comment/31351641
has comment: http://stackoverflow.com/comment/31352540
tagged with: awt
type: Question
has answer: http://stackoverflow.com/a/20890550
has body: EDIT: Added code from the game. I got Key Bindings for a game I'm working on. They're supposed to move objects when keys are pressed. (currently, each println(..) represents actual code to move things on the screen, will be added later). The printing in the console works, but with delays. The words "left", "right", etc. appear with a delay in the console, sometimes half a second delay, sometimes a few seconds delay. There is no delay at all sometimes, but when a lot of keys are pressed one after the other, there's a delay of several seconds, and only then the words appear in the console (like the computer had too much to handle at the same time). When I did the same Key Bindings in a different project without all the game logic, only pressing buttons that print words in the console - it worked perfectly without delay. So I suspect the problem is something with the game code, or the way I used Key Bindings inside the game code. How do I fix this? I tried putting the Key Bindings code in the thread that contains the game-loop (before the game-loop), and in the constructor. Same problem. Here is the relevant code of the Board class (extending JPanel), the main JPanel of the game which displays the graphics and manipulates objects. import java.util.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Board extends JPanel implements Runnable { Tank tank1,tank2; boolean[] keysPressed1,keysPressed2; Action upAction,leftAction,rightAction,wAction,aAction,dAction; InputMap inputMap; ActionMap actionMap; public Board(){ setFocusable(true); setBackground(Color.BLACK); tank1 = new Tank("red"); tank2 = new Tank("blue"); inputMap = this.getInputMap(); actionMap = this.getActionMap(); Thread gameloop = new Thread(this); gameloop.start(); } public void paintComponent(Graphics g){ super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; // Drawing tanks on the screen. } public void run(){ // Key Bindings ////// upAction = new AbstractAction(){ public vo…
score: 0
tagged with: swing
answer count: 1
has comment: http://stackoverflow.com/comment/31351653
tagged with: key-bindings
tagged with: java
has comment: http://stackoverflow.com/comment/31351898
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31352078
has title: Key Bindings in Java: Delay after key press

http://stackoverflow.com/q/21014051
score: -5
has answer: http://stackoverflow.com/a/21014098
has comment: http://stackoverflow.com/comment/31584840
tagged with: java
has answer: http://stackoverflow.com/a/21014231
has comment: http://stackoverflow.com/comment/31584765
type: Question
has answer: http://stackoverflow.com/a/21014097
has title: String comparison in java does not gives the desired results
has comment: http://stackoverflow.com/comment/31584677
upvote count: 0
downvote count: 5
tagged with: comparison
has answer: http://stackoverflow.com/a/21014094
has answer: http://stackoverflow.com/a/21014068
accepted answer: http://stackoverflow.com/a/21014231
linked to: http://stackoverflow.com/q/513832
tagged with: string
possible better answer: http://stackoverflow.com/a/21014068
duplicate of: http://stackoverflow.com/q/513832
favorite count: 0
tagged with: equals
answer count: 5
has comment: http://stackoverflow.com/comment/31584700
has comment: http://stackoverflow.com/comment/31584757
has body: I tried with the following class : public class EqualMethodTestWithNew { public static void main(String[] args) { String value = "xxx"; String name = new String("xxx") ; System.out.println("hascode : value : "+value.hashCode()); System.out.println("hascode : name : "+name.hashCode()); if (value == name) { System.out.println("equal == 1"); } else { System.out.println("false == 1"); } } } though the hasCode is same for the both variable it prints the false == 1. could some one explain the reason why? thanks
type: AnsweredQuestion

http://stackoverflow.com/comment/31335175
comment on: http://stackoverflow.com/q/20881215
has text: And then how do I remove it?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31350551
score: 1
comment on: http://stackoverflow.com/a/20888650
type: AnswerComment
type: Comment
has text: @ElhadiMamoun That's fine if you are processing all rows in a loop, but in this case he's trying to let the user dictate processing direction. A while loop makes no sense here.

http://stackoverflow.com/q/20986163
tagged with: http://stackoverflow.com/tag/pdf
has answer: http://stackoverflow.com/a/30511469
tagged with: spring
tagged with: acrobat
type: UnansweredQuestion
tagged with: itext
has comment: http://stackoverflow.com/comment/31610812
upvote count: 1
has comment: http://stackoverflow.com/comment/31542008
has comment: http://stackoverflow.com/comment/31598254
score: 1
tagged with: java
has title: Not able to Save the POST data contents of an XFDF form
type: Question
has body: We are Not able to Save the POST data contents from an XFDF form. The POST event is triggered using a button inside the PDF. We are using Java + SPRING on server side. EXCEPTION: java.io.IOException: Expected &gt; for tag: &lt;{1}/&gt; near line 1, column 13 Observed the same error in itext demo page too! Here it is: http://itextpdf.com:8180/book/xfdf Please help us finding the solution. [MORE DETAILS] The error is reproducible in the iText demo page itself. Url:http://itextpdf.com:8180/book/xfdf We can notice it in the ajax response part after submitting the form. By the way, here is the input, ouput and source code in our app. HTTP POST INPUT DATA: %FDF-1.2 1 0 obj &lt;&lt;/FDF&lt;&lt;/F&lt;&lt;/Type/Filespec/F(http///localhost/8081/triplefin/document/download/4)/UF(http///localhost/8081/triplefin/document/download/4)&gt;&gt;/Fields[&lt;&lt;/T(pat_name)/V(sample)&gt;&gt;&lt;&lt;/T(member_number)&gt;&gt;&lt;&lt;/T(p_add)&gt;&gt;&lt;&lt;/T(p_city)&gt;&gt;&lt;&lt;/T(p_state)&gt;&gt;&lt;&lt;/T(p_zip)&gt;&gt;&lt;&lt;/T(pat_phone)&gt;&gt;&lt;&lt;/T(pat_dob)&gt;&gt;&lt;&lt;/T(doc_name)/V(provider1)&gt;&gt;&lt;&lt;/T(doc_add)/V(7/15 krishna nagar)&gt;&gt;&lt;&lt;/T(doc_city)/V(coimbatore)&gt;&gt;&lt;&lt;/T(doc_state)/V(641041)&gt;&gt;&lt;&lt;/T(doc_zip)&gt;&gt;&lt;&lt;/T(doc_phone)/V(1232131)&gt;&gt;&lt;&lt;/T(doc_fax)/V(023423423)&gt;&gt;&lt;&lt;/T(specialty)&gt;&gt;&lt;&lt;/T(npi_number)&gt;&gt;&lt;&lt;/T(drug)&gt;&gt;&lt;&lt;/T(drug_dosage)&gt;&gt;&lt;&lt;/T(rx_direction)&gt;&gt;&lt;&lt;/T(Diagnosis)&gt;&gt;&lt;&lt;/T(pat_start_date)&gt;&gt;&lt;&lt;/T(alternatives_used)&gt;&gt;&lt;&lt;/T(non_formulary_reason)&gt;&gt;&lt;&lt;/T(addi_treatment)&gt;&gt;&lt;&lt;/T(doc_signature)&gt;&gt;&lt;&lt;/T(doc_sig_date)&gt;&gt;]&gt;&gt;&gt;&gt; endobj trailer &lt;&lt;/Root 1 0 R&gt;&gt; %%EO DETAILED EXCEPTION MESSAGE: java.io.IOException: Expected &gt; for tag: &lt;{1}/&gt; near line 1, column 13 at com.itextpdf.text.xml.simpleparser.SimpleXMLParser.throwException(SimpleXMLParser.j…
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35251922
favorite count: 0

http://stackoverflow.com/comment/31378394
comment on: http://stackoverflow.com/q/20904167
score: 0
has text: @Duncan, my 2d array come s from a tsv file. i want to multiply a string with the array, so i can get a combination of FA out. see me edit, hope it helps.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23354672
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20991641
upvote count: 1
has body: From [jaspersoft download][1] [1]: http://jaspersoft.artifactoryonline.com/jaspersoft/jr-ce-releases/net/sf/jasperreports/jasperreports-functions/5.5.0/ download the jasperreports-functions-5.5.0.jar and place it in your class path.
score: 1

http://stackoverflow.com/comment/31354640
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20891386
has text: The Thread-class does not offer more informations, but maybe you use any kind of locks (for example ReentrantLock in j.u.concurrent-package offers special methods for querying queuing threads).
type: Comment

http://stackoverflow.com/a/21032492
score: 0
answers question: http://stackoverflow.com/q/20955171
type: AcceptedAnswer
has body: After searching a large portion of the JUNG2 API, I assume there is no such utility. What would be needed is an edge transformation function, but even if there are many applications for it, there seem to be no traces of any such utility function. Depending on your application, a different approach might be worth a look: You could subclass DirectedGraph, implementing a wrapper for any existing Graph that inverts edges on the fly. Specifically, getInEdges() would return getOutEdges() and vice versa. You still need to wrap other functions that depend on the Edge direction. Depending on your application, this approach might or might not be simpler than simply copying the edges.
type: Answer
accepted answer of: http://stackoverflow.com/q/20955171

http://stackoverflow.com/a/20939581
downvote count: 0
answers question: http://stackoverflow.com/q/20939438
has comment: http://stackoverflow.com/comment/31446287
score: 1
has body: Since you didn't specify a layout, you were using BorderLayout which only displays 1 component in each section. Unless you specify a different location as an additional arg when using the default BorderLayout, the add(component) method will "overwrite" whatever was there previously. Therefore, when you add your second component to your frame it overwrites the first. I noticed that you imported GridLayout, but i don't see it used in your code. If you add a statement in the constructor like: this.setLayout(new GridLayout(4, 2)); it will change the layout from the default BorderLayout to the GridLayout, and you will have 4 rows of 2 compartments each in which to place components. Calling the add(component) method will add a component in the next available section, starting with row 1 spot 1. If you only want to add those two items, try putting in the statement this.setLayout(new GridLayout(1, 2)); before you add your components. This will place them side by side.
upvote count: 1
type: Answer

http://stackoverflow.com/comment/31422452
comment on: http://stackoverflow.com/q/20926599
score: 0
type: Comment
type: QuestionComment
has text: @user3130732 Get the working code from [here](http://pastebin.com/y2Kne8Rv)

http://stackoverflow.com/comment/31489121
type: AnswerComment
comment on: http://stackoverflow.com/a/20895082
score: 0
type: Comment
has text: Check out [Laying Out Components Within a Container](http://docs.oracle.com/javase/tutorial/uiswing/layout/index.html)

http://stackoverflow.com/q/20850591
tagged with: arrays
answer count: 1
tagged with: compilation
score: 0
has comment: http://stackoverflow.com/comment/31277435
linked to: http://stackoverflow.com/q/4386076
tagged with: netbeans
tagged with: compiler-errors
has comment: http://stackoverflow.com/comment/31277688
type: UnansweredQuestion
has title: Uncompilable Source Code error in java
has answer: http://stackoverflow.com/a/20850785
tagged with: java
has comment: http://stackoverflow.com/comment/31277891
has comment: http://stackoverflow.com/comment/31277460
type: Question
has body: Viewing the file in NetBeans, it indicates that it has an error, but doesn't say what. When I accessed the constant from another class, it gives an Uncompilable Source Code RuntimeException. The file below is changed from the original only in that the package, class, and variable names are changed, and the original array has about 200x100 integers package javaapplication; class Constants { static final int[][] MAP = {{1, 2, 3 }, {2, 3, 4 }, {4, 9, 0 }, {2, 3, 4 }}; } I tried to isolate the problem, by starting with an array of 3 rows of 181 0's. I added one row at a time, without any errors, until I added the 69th row (exactly like all the others). Then, NetBeans indicated an error parsing the file. Is there a limit of about 38,000 characters?

http://stackoverflow.com/q/20930226
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31429294
has comment: http://stackoverflow.com/comment/31428839
answer count: 0
tagged with: java
tagged with: noclassdeffounderror
type: Question
has body: I want to run a JUnit test that uses android.text.format.Time, but when I try to add android.jar to the classpath, I get "java.lang.RuntimeException: Stub!", because android.jar contains only stub implementation of the classes. How do I run a normal Java program and use the Time library android.text.format.Time?
has title: How do I run a non-android-emulating Java program using the Android Time library android.text.format.Time?
linked to: http://stackoverflow.com/q/8982631
linked to: http://stackoverflow.com/q/16906930
score: 0
tagged with: android
tagged with: junit
has comment: http://stackoverflow.com/comment/31428240

http://stackoverflow.com/comment/31341184
comment on: http://stackoverflow.com/q/20884592
type: Comment
type: QuestionComment
has text: update it with the error logs. haven't the foggiest on which line it errors on...
score: 0

http://stackoverflow.com/comment/31563371
type: Comment
type: QuestionComment
score: 0
has text: probably just oversight in their tutorial. Mind if I convert that last comment to an answer?
comment on: http://stackoverflow.com/q/21002236

http://stackoverflow.com/a/20997517
downvote count: 0
has body: You're telling the compiler (by the explicit cast) to trust you that you're not making errors, so it's ignoring the errors and doesn't detect it in compilation time. That's why you don't get a compilation error. But when the program runs, you'll get an exception since A is not an instance of B. You probably wanted to do: A b = (A) new B(); Note that if you remove the explicit cast, you'll get a compilation error (Which is always preferable) because the compiler already knows that you're doing a mistake. In the other example, that you think it's the same.. Well.. it's not the same, there, req is an instance of HttpServletRequest.
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/20997450

http://stackoverflow.com/q/20957393
has title: An irrelevant NullPointerException during serialization
tagged with: serialization
has comment: http://stackoverflow.com/comment/31479589
has answer: http://stackoverflow.com/a/20978633
has comment: http://stackoverflow.com/comment/31479798
has comment: http://stackoverflow.com/comment/31480864
has comment: http://stackoverflow.com/comment/31479466
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/20978633
type: Question
answer count: 1
has body: I use serialization for saving the current state of my model to a file and load it maybe some minutes later. My application has nothing that deals JPA or similar technologies. It's a completely JavaSE desktop Swing Application. Serialization works quite well. Only I encountered that after the serialization the DnD feature that I have defined for a JList to another one stops to function(The DnD feature is defined by me and isn't a default one). I don't serialize the GUI. I just serialize and save the models. The GUI is created every time the program is run. But once upon a time I discovered that the following exception occurs and the model isn't serialized. This exception happened only once. I could save the serialized model before that.(I note that no change happened in the code) It doesn't have a clue in my code. The line of the code where this exception is thrown is: out.writeObject(galMachine); I know that the error is so obscure but I appreciate any clue. Thanks! Btw, the galMachine isn't null. The program works well so all its members have been initialized correctly! Note: This exception can happen only when I have loaded a serialized instance to the program and not when it has created all its objects itself. Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at javax.swing.plaf.metal.MetalScrollBarUI.installDefaults(MetalScrollBarUI.java:90) at javax.swing.plaf.basic.BasicScrollBarUI.installUI(BasicScrollBarUI.java:168) at javax.swing.JScrollBar.writeObject(JScrollBar.java:771) 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:601) at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:975) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1480) at java.io.ObjectOutputStream.writeO…
has comment: http://stackoverflow.com/comment/31479926
score: 0
has comment: http://stackoverflow.com/comment/31483736
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/31481743

http://stackoverflow.com/comment/31287050
has text: @BalusC Like the edit 2 shows, I'm using omnifaces 1.6.3. And I've just checked Glassfishv ersion, which is `Version = GlassFish Server Open Source Edition 3.1.1 (build 12)`
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20855657

http://stackoverflow.com/a/20977496
type: Answer
has body: There's not much to it, construct the event listener, pass in a mock event, and test. @Test public void testEventListener() { ActionListener subjectUnderTest = new MyActionListener(); ActionEvent mockEvent = mock(ActionEvent.class); // Or just create a new ActionEvent, e.g. new ActionEvent(); // setup mock subjectUnderTest.actionPerformed(mockEvent); // validate } Problems can arise when you follow the standard patterns for creating event listeners, where you define an anonymous class that directly interacts with the containing class. However it shouldn't be hard to refactor such a class into its own full class, and pass in any dependencies to the constructor, rather than implicitly from the surrounding class.
upvote count: 11
answers question: http://stackoverflow.com/q/20977403
has comment: http://stackoverflow.com/comment/31525352
score: 11
accepted answer of: http://stackoverflow.com/q/20977403
has comment: http://stackoverflow.com/comment/31521929
has comment: http://stackoverflow.com/comment/31526116
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/31584700
type: QuestionComment
type: Comment
score: 1
has text: @NarendraPathai I think we should have an "auto-punch" feature that come from the screen when someone ask about `==` vs `equals`.
comment on: http://stackoverflow.com/q/21014051

http://stackoverflow.com/q/20911268
has answer: http://stackoverflow.com/a/26590602
possible better answer: http://stackoverflow.com/a/20911480
type: AnsweredQuestion
has body: Trying to Add a list of files to a Jlist, then filter the files in the JList to only return .txt files and fixed char length. Also trying remove the file path that gets returned, and only show the filename+extension in the JList of files. So far, accomplished all except removing the file path. For example, it still returns "C:\java_help.txt" instead of just "java_help.txt" in the JList. import javax.swing.*; import java.io.*; public class FileName extends JFrame{ JPanel pnl=new JPanel(); public static void main (String[]args) { FileName print=new FileName(); } JList list; @SuppressWarnings("unchecked") public FileName() { super("Swing Window"); setSize(250,300); setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true); add(pnl); String path="C:/"; File folder=new File(path); File[]listOfFiles=folder.listFiles(new TextFileFilter()); list=new JList(listOfFiles); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.setLayoutOrientation(JList.VERTICAL); pnl.add(list); pnl.revalidate(); } } class TextFileFilter implements FileFilter { public boolean accept(File file) { String name=file.getName(); return name.length()&lt;28&amp;&amp;name.endsWith(".txt"); } } I thought getName() was supposed to accomplish this, but it doesn't seem to be the case. How can I remove the path from the filename, and be left with just filename+extension in the JList? Applicable examples to the code above would be appreciated.
has comment: http://stackoverflow.com/comment/31392119
upvote count: 1
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/31392101
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20911480
answer count: 6
has comment: http://stackoverflow.com/comment/31392176
has comment: http://stackoverflow.com/comment/31398656
has answer: http://stackoverflow.com/a/20911494
has answer: http://stackoverflow.com/a/20911500
has answer: http://stackoverflow.com/a/20911674
accepted answer: http://stackoverflow.com/a/20911674
has title: Java: list of files in jlist showing filename+extension only
downvote count: 0
has comment: http://stackoverflow.com/comment/31392505
favorite count: 0
has answer: http://stackoverflow.com/a/20911593
tagged with: file-io
linked to: http://stackoverflow.com/q/7222161
tagged with: jlist

http://stackoverflow.com/q/20867383
has comment: http://stackoverflow.com/comment/31309257
score: 0
has body: I am new to spring and trying to develop a very basic application with database interaction.I want to know how to make user information available to all controllers and their methods as long as the user is logged in?? I am using spring mvc.
answer count: 1
tagged with: spring-security
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31309607
has title: How to make user information available to all controllers and their methods in spring mvc?
tagged with: spring
linked to: http://stackoverflow.com/q/3668153
type: Question
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/20867435
tagged with: java

grouplayout
type: Tag
tag name: grouplayout
tags question: http://stackoverflow.com/q/20910216

http://stackoverflow.com/comment/31518407
type: Comment
comment on: http://stackoverflow.com/a/20974123
has text: I think that's actually where I got it originally, but it was in my project at the time and it met OP's description.
type: AnswerComment
score: 1

http://stackoverflow.com/a/21003110
type: Answer
answers question: http://stackoverflow.com/q/21002992
downvote count: 0
score: 10
has comment: http://stackoverflow.com/comment/31594374
has body: You should add a + sign after the abstract class. So "execution(* com.x.y.x.MyClass.myMethod(..))" should look like: "execution(* com.x.y.x.MyClass+.myMethod(..))" ↑ The + is about inheritance either extending the given class (MyClass) or implementing an interface.
upvote count: 10

osmdroid
type: Tag
tag name: osmdroid
tags question: http://stackoverflow.com/q/20973276

http://stackoverflow.com/a/20851844
upvote count: 1
score: 1
downvote count: 0
has body: Yes what is being passed is a reference to the original object. So the changes you do to the returned object, affects the original. Java uses 'pass by value' mechanism. However when it comes to objects what is passed is a copy of the reference to the object. So changes you do via the returned reference affects the original object. However when it comes to primitives what is passed is a real copy therefore changes you do to primitives don't affect the original.
type: Answer
answers question: http://stackoverflow.com/q/20851784

http://stackoverflow.com/comment/31355308
type: QuestionComment
comment on: http://stackoverflow.com/q/20890674
has text: you say "due to transport requirments, my communication will not utilize WebSockets." then you are asking how to use websockets? Or did you try it and it not work?
score: 0
type: Comment

http://stackoverflow.com/comment/31585599
type: Comment
comment on: http://stackoverflow.com/a/21014026
has text: @user469718 but you were talking about correctly implemented clone
type: AnswerComment
score: 0

http://stackoverflow.com/a/20968188
has comment: http://stackoverflow.com/comment/31502180
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/31506798
answers question: http://stackoverflow.com/q/20966772
has body: This is how I implemented it: Input: &lt;p:inputText value="#{value}"&gt; &lt;p:ajax process="@this" update="@this error_msg" partialSubmit="true"/&gt; &lt;f:validator validatorId="validatorID"/&gt; &lt;/p:inputText&gt; Button: &lt;p:commandButton id="saveButton" action="#{controller.save()}" process="@all" update="@all" partialSubmit="false" /&gt; This works like a charm ;) Hope it helps you too.

http://stackoverflow.com/comment/31430190
type: QuestionComment
comment on: http://stackoverflow.com/q/20931057
has text: Cheched That , the Only Listed is 1.7.0_45, and that is Checked
score: 0
type: Comment

http://stackoverflow.com/comment/31578639
comment on: http://stackoverflow.com/q/21010501
score: 0
has text: The code you have posted looks ok to me. Post the full class and a bit more detail on exactly what you see happen and what you expect to happen.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31282774
score: 0
type: Comment
type: QuestionComment
has text: @sanket the issue is, why
comment on: http://stackoverflow.com/q/20853675

http://stackoverflow.com/a/24167329
type: Answer
has body: http://support.springsource.com/eol Date: January 31, 2012 Today, SpringSource, a division of VMware, announces that the End-Of-Life cycle for the following Spring projects is beginning. Commercial support for these versions will end as of January 31, 2013. Spring Framework 2.5 Spring Security 2.0 Spring Web Flow 2.0 Spring LDAP 1.2 Users of these versions are encouraged to upgrade prior to the End-Of-Life date. Support can be reached through your portal at https://www.vmware.com/accounts.
answers question: http://stackoverflow.com/q/20882576
score: 0

http://stackoverflow.com/comment/31431077
type: Comment
score: 1
comment on: http://stackoverflow.com/a/20931708
type: AnswerComment
has text: The anonymous inner class will help avoid creating a *separate* class file for each operation. So his original class with 10 or so functions can remain the same way, except being refactored to use the `Executor` pattern. So in a way, it can be more readable as all the *"something"* code are still in the same place, not moved to separate class files.

http://stackoverflow.com/comment/31327071
has text: @MelvinLai During "key exchange" as documented in the above link. I edited my answer to include the 10 step TLS/SSL handshake protocol.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20876423
type: Comment

http://stackoverflow.com/comment/31293214
has text: It is worth noting that the object doesn't change throughout execution, so maybe `final` is more appropriate?
comment on: http://stackoverflow.com/q/20859113
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/31510279
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20973939
score: 0
has text: I suggest you print out the reference address and break each expression into a separate line, possibly printing the result of each portion. This will allow you to narrow down where the problem is.

http://stackoverflow.com/q/20893268
has answer: http://stackoverflow.com/a/20893321
upvote count: 20
score: 18
has comment: http://stackoverflow.com/comment/31358273
has answer: http://stackoverflow.com/a/20894817
has answer: http://stackoverflow.com/a/20897383
accepted answer: http://stackoverflow.com/a/20897383
favorite count: 0
has comment: http://stackoverflow.com/comment/31380947
has comment: http://stackoverflow.com/comment/31365583
has title: Is there a way to schedule a Full Garbage Collection in Java?
has comment: http://stackoverflow.com/comment/31358260
duplicate of: http://stackoverflow.com/q/1481178
answer count: 4
has body: I have an application that's running on a 24x6 schedule. Currently, after running for a few days, a Full GC is performed automatically - and usually during a busy part of the day, which negatively impacts user response times. What I'd like to do is force a Full GC - perhaps at midnight each night, during very low usage times - to prevent it from happening during the day. I've tried System.gc(), but it doesn't seem to guarantee when a Full GC will happen, or even if it will. Is there some means of doing this? Version info: Java(TM) SE Runtime Environment (build 1.6.0_11-b03) Java HotSpot(TM) Server VM (build 11.0-b16, mixed mode) Additionally - Minor GCs are running, about every 10-15 seconds. But these are are not freeing up enough RAM to get the app through a full week. When a Full GC does happen, nearly 50% of the heap is freed. In relation to the above, calling System.gc() doesn't seem to mean that any of the next GCs, will be of the Full form needed to free those large chucks of memory. Yes, it is enabled (or not disabled, depending on how you read the -XX option). I've already played around with several of the CMS GC settings, which has helped greatly, but not solved the problem. Originally it was throwing OOMs, two to three times a week. I want to stop the endless loops of: constantly adding to heap space - which can only go on for so long constant tuning and testing of GC settings - it is long past the point of diminishing return I don't want to treat this like an NT machine and bounce it nightly. There are active user sessions throughout the night, and bouncing the app would mean loosing session data. To be more specific, I'm looking more for a technique to use to ensure that a Full GC is going to happen, rather than a simple method/function to call to run it. At the moment I'm looking at the modification of the percentage threshold used by CMS to determine when a Full GC is required. Thanks for any help.
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20893321
has answer: http://stackoverflow.com/a/20893349
linked to: http://stackoverflow.com/q/1481178
tagged with: java
downvote count: 2
tagged with: garbage-collection
type: Question

http://stackoverflow.com/comment/31519449
comment on: http://stackoverflow.com/a/20949072
has text: As I said in my previous comment, it still wouldn't be able to deal with the case of the non-leap years that are divisible by 100. But introducing a second `m` array will make it correct between 1 March 1900 and 28 February 2100.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31324706
type: Comment
comment on: http://stackoverflow.com/a/20875170
has text: a qualified name of the class containing main function. "qualified" means that the name includes package name and class name, dot-separated.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31587149
has text: @lonelycoder my favorite tool is `htop`, you can do some setup in `htop` to make it display `thread` information!
type: Comment
comment on: http://stackoverflow.com/a/21014989
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31577097
has text: @user3144549: see edit to answer. Please try some of the suggestions given
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21004104
type: AnswerComment

http://stackoverflow.com/comment/31330887
type: AnswerComment
type: Comment
has text: Thanks for your advice! I'm really sorry though, I'm new to Android programming. What do you mean by the views are null? The XML document contains all of them, with the correct referenced id. Again, thank you so much
comment on: http://stackoverflow.com/a/20878799
score: 0

http://stackoverflow.com/q/20890674
type: AnsweredQuestion
score: 3
downvote count: 0
has body: I am interested in deploying a server to GoDaddy as a C# web application, then have desktop clients developed in C# and Java be able to subscribe/publish to the server using WebSockets (RFC 6455). WebSocket supported libraries I am looking at are XSockets.Net and SignalR. I am not able to find anything on using XSockets.Net (not to be confused with XSocket.org) in Java. I understand that XSockets targets MS .Net framework and Mono environments. However, looking at SignalR, there is also SignalA which is a Java based SignalR client for Android. Thinking-out-loud... I understand there are many WebSocket libraries for Java, which suggests the idea that if I am able to publish a message (using WebSocket) from a Java application to a server, then I should be able to read it and processes it in C#, since WebSocket protocol is a standard. Thus far, I believe a SignalR solution will satisfy my requirement to allow C# &amp; Java applications to talk on the Web, but due to transport requirments of SignalR, my communication will not utilize WebSockets. Reading through SignalR requirements, to get WebSockets transport activated I must use Windows8+ with .Net Framework for 4.5+. GoDaddy does not use Windows8 for windows hosting, and even if it did, then all my clients must also use Windows8, which is not a guarentee. So the question is: How can I get C# &amp; Java desktop clients to talk on the web via WebSockets, othan than using SignalR and XSockets.Net? Any help is very much appreciated! EDIT: I will now look into deploying a C# XSockets.NET Server and have a C# XSockets.NET client and a Java JWebSocket client since both JWebSockets and XSockets support the WebSocket RFC6455 protocol. I will post my findings here and close this question if that was a successful effort.
has comment: http://stackoverflow.com/comment/31494479
has comment: http://stackoverflow.com/comment/31357092
favorite count: 0
has comment: http://stackoverflow.com/comment/31523223
has comment: http://stackoverflow.com/comment/31357737
type: Question
has title: Using WebSockets to communicate between Java and C# desktop applications?
answer count: 2
has answer: http://stackoverflow.com/a/20898224
tagged with: xsockets.net
has comment: http://stackoverflow.com/comment/31355712
has answer: http://stackoverflow.com/a/20896680
possible better answer: http://stackoverflow.com/a/20898224
upvote count: 3
tagged with: java
tagged with: signalr
tagged with: c#
has comment: http://stackoverflow.com/comment/31359474
tagged with: websocket
has comment: http://stackoverflow.com/comment/31355308
has comment: http://stackoverflow.com/comment/31357861
has comment: http://stackoverflow.com/comment/31355419
has comment: http://stackoverflow.com/comment/31355614
accepted answer: http://stackoverflow.com/a/20896680
has comment: http://stackoverflow.com/comment/31540923
has comment: http://stackoverflow.com/comment/31873792

http://stackoverflow.com/comment/31571592
has text: if I understand correct, if you remove the super then you are not invoking the super's printMethod(); right? so why is override useful in this case? I could just create 2 classes that do not extend anything and they both have a print statement.
type: AnswerComment
comment on: http://stackoverflow.com/a/21006742
score: 0
type: Comment

http://stackoverflow.com/q/20966201
linked to: http://stackoverflow.com/q/6255106
has answer: http://stackoverflow.com/a/20966462
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20966379
has answer: http://stackoverflow.com/a/20967254
accepted answer: http://stackoverflow.com/a/20966379
possible better answer: http://stackoverflow.com/a/20966462
tagged with: image
type: Question
has body: I am trying to load an image using the following code, but no image comes up only the window is shown... public class loadImg extends Component { public Image loadImageFile() { Image i = null; Toolkit tk = Toolkit.getDefaultToolkit(); i = tk.getImage("abcd.jpg"); waitFrImg(i); return(i); } private void waitFrImg(Image a) { MediaTracker mt = new MediaTracker(this); mt.addImage(a, 1); try { mt.waitForAll(); } catch(Exception e) { //e.printStackTrace(); //System.exit(1); System.out.println("Loading of the image was interrupted" ); System.exit(0); } } }
has comment: http://stackoverflow.com/comment/31496104
score: 0
answer count: 3
has title: Loading image in java
has comment: http://stackoverflow.com/comment/31496008

http://stackoverflow.com/a/20870188
type: Answer
answers question: http://stackoverflow.com/q/20870122
has body: You can use the getData(Ractangle rect) to return a region. Check it here
score: 0

http://stackoverflow.com/comment/31502492
type: QuestionComment
has text: do the simulation need older mass data, like after time_abs<=14 it will need time_abs<=2?
comment on: http://stackoverflow.com/q/20968797
score: 0
type: Comment

http://stackoverflow.com/q/20971419
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20971572
accepted answer: http://stackoverflow.com/a/20971572
has body: I have the following doc stored in MongoDB: { "id" : "5101", "contractId" : "001", "dueId" : [{"id":"001"},{"id":"002"}], "overdueAmount" : "", "amount" : "", "customerContact" : "Humus" } and I want to update to follow data: { "id" : "5101", "contractId" : "001", "dueId" : [{"id":"001"},{"id":"002"},{"id":"003"}], "overdueAmount" : "200", "amount" : "100", "customerContact" : "Bim" } you can see dueId is updated(insert a element) and amount, overdueAmount, customerContact are also updated. How can I use mongodb use update?
tagged with: mongodb
tagged with: sql-update
upvote count: 1
answer count: 1
favorite count: 0
type: AnsweredQuestion
has title: java mongodb update specific with array
downvote count: 0
type: Question
has comment: http://stackoverflow.com/comment/31505568

http://stackoverflow.com/comment/31484168
score: 0
type: Comment
has text: Is there also a way to do this with Executor? Or am I misunderstanding the concept of it?
comment on: http://stackoverflow.com/a/20959638
type: AnswerComment

http://stackoverflow.com/comment/31523434
score: 0
comment on: http://stackoverflow.com/q/20980568
type: Comment
type: QuestionComment
has text: Try a search for "ListView ArrayAdapter". That should pull up quite a few basic and useful examples

orientdb
tags question: http://stackoverflow.com/q/20884335
type: Tag
tag name: orientdb

http://stackoverflow.com/q/20983931
has answer: http://stackoverflow.com/a/20983967
favorite count: 0
tagged with: spring
accepted answer: http://stackoverflow.com/a/20984029
type: AnsweredQuestion
score: 2
has body: I am looking for caching solution that implements the org.springframework.cache.CacheManager other than ehcache. If there exist such solution, how to use it?
upvote count: 2
tagged with: java
type: Question
has title: Spring Cache Abstraction with Custom Cache Manager
tagged with: caching
answer count: 2
has answer: http://stackoverflow.com/a/20984029
possible better answer: http://stackoverflow.com/a/20983967
downvote count: 0

http://stackoverflow.com/comment/31564595
has text: @ᴍarounᴍaroun, ya I know that they do the same thing, just asked out of curiosity why we have two methods and about the performance.
comment on: http://stackoverflow.com/q/20995441
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31460293
comment on: http://stackoverflow.com/a/20947491
type: AnswerComment
score: 0
type: Comment
has text: I'll accept your question in 6 minutes cause i won't let me for some reason

http://stackoverflow.com/a/20912060
has comment: http://stackoverflow.com/comment/31394249
score: 10
has comment: http://stackoverflow.com/comment/38428823
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/90747550
has comment: http://stackoverflow.com/comment/31397212
upvote count: 10
type: Answer
accepted answer of: http://stackoverflow.com/q/20911763
has body: You can accomplish this using setFirstResult and setMaxResults. session.createCriteria(Foo.class) .setFirstResult(0) .setMaxResults(1);
answers question: http://stackoverflow.com/q/20911763
downvote count: 0

http://stackoverflow.com/q/20860543
tagged with: bufferedwriter
tagged with: java
upvote count: 10
score: 9
type: Question
has answer: http://stackoverflow.com/a/20860588
linked to: http://stackoverflow.com/q/1625234
linked to: http://stackoverflow.com/q/4614227
favorite count: 0
duplicate of: http://stackoverflow.com/q/1625234
answer count: 5
has answer: http://stackoverflow.com/a/20860589
has comment: http://stackoverflow.com/comment/31296036
has answer: http://stackoverflow.com/a/20860577
has comment: http://stackoverflow.com/comment/31296505
has comment: http://stackoverflow.com/comment/31296470
linked to: http://stackoverflow.com/q/10804286
has body: I'm trying to create a program which saves text on a file and then text can be added onto the file. However, every time i try to write to the file, it overwrites it and doesn't write anything. I need it to add whatever information i want it UNDER the rest. FileReader input; BufferedReader readFile; FileWriter output; BufferedWriter writeFile; try { // input = new FileReader(password_file); //readFile = new BufferedReader(input); output = new FileWriter(password_file); writeFile = new BufferedWriter(output); //while ((temp_user= readFile.readLine()) !=null) { //temp_pass = readFile.readLine(); //} temp_user = save_prompt.getText(); temp_pass = final_password; //Writes to the file writeFile.write(temp_user); writeFile.newLine(); writeFile.write(temp_pass); } catch(IOException e) { System.err.println("Error: " + e.getMessage()); } }
has comment: http://stackoverflow.com/comment/31296014
type: UnansweredQuestion
tagged with: file
duplicate of: http://stackoverflow.com/q/10804286
has answer: http://stackoverflow.com/a/20860581
downvote count: 1
has comment: http://stackoverflow.com/comment/31296207
tagged with: text
has title: BufferedWriter writes over existing file
has answer: http://stackoverflow.com/a/20860576

http://stackoverflow.com/comment/31400179
type: Comment
comment on: http://stackoverflow.com/a/20914447
score: 0
has text: you can't use sumbol morse outside its scope, delimited by the enclosing `{}`. If you look at the fragment I gave you in the answer, you see I put `String morse = ""` outside, so that it's visible at the end, when you have to return. You are missing very basic knowledge! I suggest you to stop a moment writing code and to return to a little bit of theory from books and lessons notes, whatever you have!
type: AnswerComment

http://stackoverflow.com/comment/31334291
type: AnswerComment
score: 0
type: Comment
has text: What is the purpose of the `View` in your `UI`? Why you are using this? Without knowing that how can we just write the code? Just define two `View` in your layout like you have defined Button simple.
comment on: http://stackoverflow.com/a/20878349

http://stackoverflow.com/q/20904641
answer count: 3
has comment: http://stackoverflow.com/comment/31378593
has answer: http://stackoverflow.com/a/20904677
favorite count: 0
has answer: http://stackoverflow.com/a/20905003
has answer: http://stackoverflow.com/a/20904687
upvote count: 1
linked to: http://stackoverflow.com/q/1448369
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20904687
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/20904677
type: Question
has body: I am using a treeMap in java. I want to get a sorted list/collection of all the values. Would TreeMap.values() do the trick? The collection that i get, would it be sorted based on the keySet, or would this collection be random. Thanks.
downvote count: 0
tagged with: treemap
has title: are the values in a treeMap sorted: java

http://stackoverflow.com/comment/31504141
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/20970565
has text: You really need to pick up a beginner's book, or read a tutorial. Don't rush it.
type: Comment

http://stackoverflow.com/comment/31516822
type: Comment
type: QuestionComment
has text: Where are you keeping the reference to `Messenger`? In which Activity?
comment on: http://stackoverflow.com/q/20896438
score: 0

http://stackoverflow.com/comment/53902148
comment on: http://stackoverflow.com/a/33040418
type: AnswerComment
has text: this answer is very low quality.
score: 0
type: Comment

http://stackoverflow.com/comment/31561363
has text: thanks a lot, helped me out,well I'm still newbie to java, can't figure out what should I do to compare integer
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21001024

http://stackoverflow.com/q/20986661
has comment: http://stackoverflow.com/comment/37332682
tagged with: network-programming
tagged with: recording
has title: Issue with recording from the Open ONVIF (Network Video Interface Forum ) device
tagged with: java
has answer: http://stackoverflow.com/a/25354001
type: Question
tagged with: ip-camera
has answer: http://stackoverflow.com/a/25255130
has comment: http://stackoverflow.com/comment/31893762
has comment: http://stackoverflow.com/comment/37410416
favorite count: 0
has body: I'm working on Open Network Video Interface Forum-Java project and following the steps described in the ONVIF Application Programmer's Guide. I have generated sources from the wsdls provided in ONVIF site. I'm able to retrieve the live stream URI using the media.wsdl. Now I have an issue with recording. The codes that I have tried is given below: RecordingService recording_ervice = new RecordingService(); RecordingPort record_port = recording_ervice.getRecordingPort(); BindingProvider bindingProvider = (BindingProvider) record_port; // Add a security handler for the credentials final Binding binding = bindingProvider.getBinding(); List&lt;Handler&gt; handlerList = binding.getHandlerChain(); if (handlerList == null) { handlerList = new ArrayList&lt;Handler&gt;(); } handlerList.add(new RecordStream.SecurityHandler()); // binding.setHandlerChain(handlerList); // Set the actual web services address instead of the mock service Map&lt;String, Object&gt; requestContext = bindingProvider.getRequestContext(); requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://" + deviceip + "/onvif/media_service"); requestContext.put(BindingProvider.USERNAME_PROPERTY, user); requestContext.put(BindingProvider.PASSWORD_PROPERTY, pass); Recordings recordings = record_port.getRecordings(); The above code on run gives an error as: Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Method 'ns11:GetServiceCapabilities' not implemented: method name or namespace not recognized I also tried with media service, then the error is: Exception in thread "main" com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 405: Method Not Allowed
answer count: 3
downvote count: 3
tagged with: onvif
upvote count: 93
has answer: http://stackoverflow.com/a/25400253
type: UnansweredQuestion
score: 90

http://stackoverflow.com/comment/31527368
comment on: http://stackoverflow.com/a/20982385
has text: Thanks, ill try it out, to clarify, its impossible to store "B692" as an int?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/20866426
has body: Change this method: @Override protected void onRestart() { super.onRestart(); refreshingThread.unpause(); } To: @Override protected void onStart() { super.onStart(); refreshingThread.start(); &lt;-- remove from onCreate(); } With this you will always start the thread when your activity starts up (or restarts) and stop it when your Activity is stopped.
has comment: http://stackoverflow.com/comment/31311977
answers question: http://stackoverflow.com/q/20866021
score: 0
type: Answer

http://stackoverflow.com/a/20929456
has comment: http://stackoverflow.com/comment/31427514
upvote count: 5
has comment: http://stackoverflow.com/comment/31427354
accepted answer of: http://stackoverflow.com/q/20929402
has comment: http://stackoverflow.com/comment/31427523
has comment: http://stackoverflow.com/comment/31427135
score: 5
has comment: http://stackoverflow.com/comment/31427506
has comment: http://stackoverflow.com/comment/31426765
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31427439
has body: Without pointing out the obvious of the variable names, I'll take a different approach at answering. Maybe you want to take an input and actually set it as the players name, in an OOP way. You obviously have a class player, so why not take in a name argument` in the constructor public class Player { private String name; public Player(String name){ this.name = name; } public String getName(){ return name; } } Then when you get the input you do this String playerName = input.nextLine(); Player player1 = new Player(playerName); Now when you create multiple Player's they will each have a distinct name Also you should follow Java naming convention. Class names start with capital letters UPDATE You need to create a new Player for every instance String playerName = input.nextLine(); Player player1 = new Player(playerName); playerName = input.nextLine(); Player player2 = new Player(playerName); playerName = input.nextLine(); Player player3 = new Player(playerName); playerName = input.nextLine(); Player player4 = new Player(playerName);
type: Answer
answers question: http://stackoverflow.com/q/20929402

http://stackoverflow.com/a/29195847
upvote count: 3
has body: This can be solved using Edit distance dynamic programming algorithm. Edit distance DP algorithm is used to find the minimum operations required to convert a source string to destination string. The operations can be either addition or deletion of characters. The K-palindrome problem can be solved using Edit distance algorithm by checking the minimum operation required to convert the input string to its reverse. Let editDistance(source,destination) be the function which takes source string and destination string and returns the minimum operations required to convert the source string to destination string. A string S is K-palindrome if editDistance(S,reverse(S))&lt;=2*K This is because we can transform the given string S into its reverse by deleting atmost K letters and then inserting the same K letters in different position. This will be more clear with an example. Let S=madtam and K=1. To convert S into reverse of S (i.e matdam) first we have to remove the character 't' at index 3 ( 0 based index) in S. Now the intermediate string is madam. Then we have to insert the character 't' at index 2 in the intermediate string to get "matdam" which is the reverse of string s. If you look carefully you will know that the intermediate string "madam" is the palindrome that is obtained by removing k=1 characters.
downvote count: 0
score: 3
type: Answer
has comment: http://stackoverflow.com/comment/46606070
answers question: http://stackoverflow.com/q/20892506

http://stackoverflow.com/comment/31483095
comment on: http://stackoverflow.com/q/20886463
score: 0
type: Comment
type: QuestionComment
has text: DISPALY variable is set. System.getProperty("os.name") is returning SunOS. (String) java.security.AccessController.doPrivileged (new sun.security.action.GetPropertyAction ("java.awt.graphicsenv", null)) is returning sun.awt.X11GraphicsEnvironment . Still facing issue.

http://stackoverflow.com/comment/31486927
has text: I got error when I tried to run you code, I have added it to my original question
type: AnswerComment
comment on: http://stackoverflow.com/a/20960798
score: 0
type: Comment

http://stackoverflow.com/q/20995107
favorite count: 0
downvote count: 0
has title: Drawing liquid with LibGDX
type: UnansweredQuestion
tagged with: libgdx
tagged with: rendering
tagged with: java
has answer: http://stackoverflow.com/a/21004958
type: Question
score: 5
answer count: 1
has body: I'm quite new to LibGDX and OpenGL, but I managed to make a simple liquid simulation using Box2D API. See this link (this is someone's else animation): Physics Liquid Currently I render the liquid particles as circles just like in the first image, but I want to make it look more natural like on the third one. The answer might be to use distance field and I tried this approach, but with no effect. I'm drawing each particle as a texture using SpriteBatch class, but that can be changed. I made a texture (from a procedural Pixmap) that represents each particle as a filled circle, with alpha channel decreasing further from the center, so the effect is similar to the second picture. Now, I must enable a threshold filter to alpha channel, something like: "draw only pixels with alpha > 0.5". This is post-processing step, because it matters what is the alpha channel of a pixel after all particles have been draw. Might or might not be done with shaders (ProgramShader), but after some research I still have no clue how to do this. Thanks for ANY help. EDIT: this example explains the method, but it's implemented in ActionScript.
upvote count: 5

http://stackoverflow.com/comment/31439972
has text: Asking an obvious question... You're not publishing artifacts to Jenkins are you? That is not supported.... Personally I run a separate instance of Nexus to host my release binaries. I also publish build logs into Nexus, so this setup means I have no strong backup requirements for my Jenkins server.
comment on: http://stackoverflow.com/q/20914953
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20913410
type: UnansweredQuestion
tagged with: spring
tagged with: java
type: Question
has title: Null value when I trying to inject bean to servlet filter via spring
has comment: http://stackoverflow.com/comment/31397382
score: 0
tagged with: filter
has comment: http://stackoverflow.com/comment/31398046
has comment: http://stackoverflow.com/comment/31397535
has body: My web.xml: springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain *.xhtml org.springframework.web.context.ContextLoaderListener org.springframework.web.context.request.RequestContextListener contextConfigLocation classpath*:*-applicationContext.xml My applicationContext.xml: <aop:scoped-proxy/> <property name="userModel" ref="studentModel"/> <property name="userModel" ref="studentModel"/> <sec:filter-chain-map path-type="ant"> <sec:filter-chain pattern="/**" filters=" sessionFilter, roleFilter"/> </sec:filter-chain-map> When I try to login, the filter fails. In debug, I saw that value of userModel is null. I also tried to add filters separately, but result is same. Where is my mistake?
answer count: 0

http://stackoverflow.com/a/20867777
type: Answer
has body: Only as an alternative to Andres answer you can turn on -verbose:class and redirect stdout to a file. There we'll get this log ... [Loaded java.lang.Object from C:\Program Files\Java\jre7\lib\rt.jar] [Loaded java.io.Serializable from C:\Program Files\Java\jre7\lib\rt.jar] [Loaded java.lang.Comparable from C:\Program Files\Java\jre7\lib\rt.jar] ... We can extract a class name, load it Class cls = Class.forName(className); if cls.getClassLoader() returns null it was loaded with bootstrap class loader.
upvote count: 1
answers question: http://stackoverflow.com/q/20867705
score: 1
downvote count: 0

http://stackoverflow.com/q/20960683
has answer: http://stackoverflow.com/a/20960768
answer count: 3
has comment: http://stackoverflow.com/comment/31486199
tagged with: operator-keyword
has answer: http://stackoverflow.com/a/20960772
has answer: http://stackoverflow.com/a/20960728
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31486897
tagged with: math
tagged with: java
has comment: http://stackoverflow.com/comment/31486255
has title: Using the Math.max operators to find the top two numbers in an array
type: Question
downvote count: 4
upvote count: 0
has body: I am doing a java project where I have to find the top two values of the times of a marathon. I have created arrays but I need to find the top two numbers in the array. Can I use the Math.max operator in Java. Here is the code btw : class Marathon { public static void main (String[] arguments) { String[] names = { "Elena", "Thomas", "Hamilton", "Suzie", "Phil", "Matt", "Alex", "Emma", "John", "James", "Jane", "Emily", "Daniel", "Neda", "Aaron", "Kate" }; int[] times = { 341, 273, 278, 329, 445, 402, 388, 275, 243, 334, 412, 393, 299, 343, 317, 265 }; for (int i = 0; i &lt; names.length; i++) { System.out.println(names[i] + ": " + times[i]); } } }
tagged with: max
tagged with: arrays
linked to: http://stackoverflow.com/q/1806816
score: -4

http://stackoverflow.com/a/20927644
type: Answer
answers question: http://stackoverflow.com/q/20927389
has body: Don't put your code in the main method. Instead I'd put it into the class constructor for the class the holds the main method, in your case Kalkulator. Then instantiate Kalkulator in the main method. Kalkulator won't be static, so you won't recieve this message. If you want to know why you're getting this error, its because the main method is declared as static, and as the error suggests a static thing can't access something not static. Check this out.
score: 0

http://stackoverflow.com/q/20973126
has comment: http://stackoverflow.com/comment/31508835
answer count: 0
has comment: http://stackoverflow.com/comment/31509219
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31508663
has comment: http://stackoverflow.com/comment/31508729
tagged with: java
tagged with: memory
has comment: http://stackoverflow.com/comment/31508629
type: Question
has title: 0/1 Knapsack Heap Space
tagged with: knapsack-problem
upvote count: 1
has comment: http://stackoverflow.com/comment/31508873
downvote count: 1
favorite count: 0
has body: I have a problem with 0/1 Knapsack problem. There is data which as 400 rows and 9476897 knapsack capacity. I have also another big data(10.000rows). When i run the program it gives an error in 2 dimensional array. How can i change it? By the way i changed the -Xms all situations, but it didn't work. ERROR: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at Knapsack.simple_fill(Knapsack.java:108) at Knapsack.main(Knapsack.java:99) int[][] s = new int[n + 1][W + 1]; for (int w = 0; w &lt;= W; w++) { s[0][w] = 0; } for (int i = 0; i &lt;= n; i++) { s[i][0] = 0; } for (int i = 1; i &lt;= n; i++) { for (int w = 0; w &lt;= W; w++) { if (st[i].weight &lt;= w) { if (st[i].profit + s[i - 1][w - st[i].weight] &gt; s[i - 1][w]) { s[i][w] = st[i].profit + s[i - 1][w - st[i].weight]; } else { s[i][w] = s[i - 1][w]; } } else { s[i][w] = s[i - 1][w]; } } }
score: 0
has comment: http://stackoverflow.com/comment/31509113

http://stackoverflow.com/q/20987716
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/21004968
has body: How to xml-parsing tag+text in tag (simple-framework) http://simple.sourceforge.net/resources.php I want to print this : xliffTestModel=XliffTestModel [attname=hours, g=%1$s, text=hours!!] I can't parse "hours!!" [XML] &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"&gt; &lt;string name="hours"&gt; &lt;xliff:g id="hours"&gt;%1$s&lt;/xliff:g&gt; hours!! &lt;/string&gt; &lt;/resources&gt; Here is my code. [Model] import org.simpleframework.xml.Element; import org.simpleframework.xml.Root; @Root(name = "resources") public class XMXliffStringModel { @Element(name = "string") public XliffTestModel xliffTestModel; @Override public String toString() { return "XMXliffStringModel [xliffTestModel=" + xliffTestModel + "]"; } } import org.simpleframework.xml.Attribute; import org.simpleframework.xml.Element; import org.simpleframework.xml.Namespace; import org.simpleframework.xml.Root; @Root(name = "string") public class XliffTestModel { @Attribute(required = false, name = "name") public String attname = ""; @Namespace(prefix = "xliff") @Element(required = false, name = "g") public String g; @Override public String toString() { return "XliffTestModel [attname=" + attname + ", g=" + g + "]"; } } [Main Code] XMXliffStringModel xmXliffStringModel = new XMXliffStringModel(); String path = "C:/Users/SEC/Desktop/strings.xml"; Serializer serializer = new Persister(); try { xmXliffStringModel = serializer.read(xmXliffStringModel.getClass(), new File(path)); } catch (Exception e) { e.printStackTrace(); } System.out.println(xmXliffStringModel);
tagged with: simple-framework
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21004968
tagged with: java
tagged with: tags
has title: How to xml-parsing tag+text in tag (simple-framework)
type: Question
tagged with: xml-parsing

http://stackoverflow.com/comment/31365709
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/20897464
has text: A buffer of only 8kB? Try something in the range of 1MB to 10MB for such huge files.

http://stackoverflow.com/comment/31385028
has text: This question appears to be off-topic because it is not in English
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/20907872

http://stackoverflow.com/comment/31398606
comment on: http://stackoverflow.com/a/20914363
type: AnswerComment
has text: I see what you are saying. But the problem is I cant get rid off osgi:reference because at some point in my program I invoke one of the methods exposed by osgi:service. which leads to my next question which is How can I write a JUNIT test case to test OSGI service. Thankx for your suggestion.
score: 0
type: Comment

http://stackoverflow.com/q/20871324
has title: Facebook integration not working in different devices
accepted answer: http://stackoverflow.com/a/20883518
score: 0
answer count: 1
tagged with: android
tagged with: facebook
has body: I am building an app where I am trying to integrate facebook. When I am using device of android 2.3.3 its working fine and i am able to post message. But when I am running that same app in android 4.1 then it showing "failed to post".I am using facebook-sdk version 3.6.0 My code as below FacebookActivity.java @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.facebook); btnPostStatus = (Button) findViewById(R.id.mBtnPostStatus); edtPost = (EditText) findViewById(R.id.post_text); edtPost.setText(messageToPost); btnPostStatus.setOnClickListener(new OnClickListener() { @SuppressWarnings("deprecation") public void onClick(View arg0) { facebook = new Facebook(APP_ID); restoreCredentials(facebook); messageToPost = edtPost.getText().toString(); if (!facebook.isSessionValid()) { loginAndPostToWall(); } else { postToWall(messageToPost); } } }); } @SuppressWarnings("deprecation") public boolean saveCredentials(Facebook facebook) { Editor editor = getApplicationContext().getSharedPreferences(KEY, Context.MODE_PRIVATE).edit(); editor.putString(TOKEN, facebook.getAccessToken()); editor.putLong(EXPIRES, facebook.getAccessExpires()); return editor.commit(); } @SuppressWarnings("deprecation") public boolean restoreCredentials(Facebook facebook) { SharedPreferences sharedPreferences = getApplicationContext() .getSharedPreferences(KEY, Context.MODE_PRIVATE); facebook.setAccessToken(sharedPreferences.getString(TOKEN, null)); facebook.setAccessExpires(sharedPreferences.getLong(EXPIRES, 0)); return facebook.isSessionValid(); } @SuppressWarnings("deprecation") public void loginAndPostToWall() { facebook.authorize(this, PERMISSIONS, Facebook.FORCE_DIALOG_AUTH, new LoginDialogListener()); } @SuppressWarnings("deprecation") public void postToWall(String message) { Bundle parameters = new Bundle(); parameters.putString("message", message); parameters.putString("description", "topic share"); try { facebook.request("me"); Str…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20883518
tagged with: java
type: Question

http://stackoverflow.com/comment/31531566
score: 0
type: QuestionComment
has text: Not allowed to use any String method other than length and charAt, otherwise i would have used it instead
comment on: http://stackoverflow.com/q/20984862
type: Comment

http://stackoverflow.com/q/20970980
has title: Abstract class extends concrete class
upvote count: 33
possible better answer: http://stackoverflow.com/a/23416148
score: 33
downvote count: 0
has body: I earlier learned that abstract class can extend concrete class. Though I don't see the reason for it from Java designers, but it is OK. I also learned that abstract class that extends concrete class can make overridden methods abstract. Why? Is there a use case where it is useful? I am trying to learn design patterns and I do not want to miss anything. Here is example: public class Foo { public void test() { } } public abstract class Bar extends Foo { @Override public abstract void test(); }
has answer: http://stackoverflow.com/a/20971293
favorite count: 0
has answer: http://stackoverflow.com/a/29948291
answer count: 5
has answer: http://stackoverflow.com/a/20971257
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20971068
tagged with: java
accepted answer: http://stackoverflow.com/a/20971293
tagged with: design-patterns
has answer: http://stackoverflow.com/a/23416148
type: Question

http://stackoverflow.com/comment/31525531
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20978739
has text: vance, so it is a provider? I don't need to use OPENJPA or Hibernate? Or does it still require a provider while implementing those methods?

http://stackoverflow.com/comment/31407419
type: AnswerComment
score: 0
has text: @MarkoTopolnik: Unfortunately we don't really have enough context to know that... the OP's comments suggests they *do* want compile-time safety, but it's all a bit vague.
type: Comment
comment on: http://stackoverflow.com/a/20919442

http://stackoverflow.com/a/20851089
has comment: http://stackoverflow.com/comment/31361805
has comment: http://stackoverflow.com/comment/31284577
score: 1
has comment: http://stackoverflow.com/comment/31295589
has body: When starting your batch from command line use -Dfile.encoding=UTF-8 instead of UTF-8. In other words you have somewhere or you are doing it from a command line: java UTF-8 -Xmx4G -Xms4G MainClass and you should change it to java -Dfile.encoding=UTF-8 -Xmx4G -Xms4G MainClass
accepted answer of: http://stackoverflow.com/q/20851062
has comment: http://stackoverflow.com/comment/31290418
answers question: http://stackoverflow.com/q/20851062
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31291791
type: Answer
has comment: http://stackoverflow.com/comment/31279610
downvote count: 0
has comment: http://stackoverflow.com/comment/31388383

http://stackoverflow.com/comment/31543201
score: 0
type: AnswerComment
type: Comment
has text: It still results in `0` for all of them. would this work with imagebutton or only imageview?
comment on: http://stackoverflow.com/a/20991760

http://stackoverflow.com/comment/31318273
comment on: http://stackoverflow.com/q/20869384
has text: Please, please follow java conventions about capitalizing class names (type names) and writing method names with first small letter. Every tutorial for beginners explains this for sake of better readability.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/20927735
duplicate of: http://stackoverflow.com/q/6729605
tagged with: class
has comment: http://stackoverflow.com/comment/31423664
has comment: http://stackoverflow.com/comment/31423833
has body: I have been given data that is water stream quality in Ontario. Any time station is mentioned I am refering to a place at which data was taken. Any time result is mentioned I am refering to the data that had been collected. I have an array with the following: String[] stationArray = {1049, 05/12/2004, 13:50}; //{station id, date, time} I would like to make this into an object. If I knew what the station id would be all the time, I would do this (assuming I have a station class): String date = "05/12/2004; String time = "13:50"; Station 1049 = new Station(date, time); But I don't know what the station id will be as I have 2000+ stations (and 100 000+ results) and I don't want to hard code the numbers into the program. So how can I do something that accomplishes this: String date = "05/12/2004"; String time = "13:50"; String station_id = stationArray[0]; //this way I can pop each array into a function to create the Station object for me Station station_id = new Station(date, time); If I was able to do this, I would send the array to a function and create the objects that way because I could change the station_id variable for each object. The reason I want to do this is because I have another class Result which has several properties including the station id the data was gathered at (which is of type Station). This may not be the best way to use the data but I must show a has-a relationship and this is the only opportunity I can find to use it. At the end of it all, I was hoping I could use something like... result.station_id.location //where station_id is of type Station ...to find where a set of data was taken. If station_id is a String, I would have to take it and compare it to an array of Station's then find the location that way.
has comment: http://stackoverflow.com/comment/31423634
downvote count: 0
has comment: http://stackoverflow.com/comment/31423708
favorite count: 0
has title: Name the object the value of a string?
type: UnansweredQuestion
tagged with: properties
tagged with: dynamic
answer count: 0
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/31423498
has comment: http://stackoverflow.com/comment/31423299
type: Question
tagged with: object
linked to: http://stackoverflow.com/q/6729605
has comment: http://stackoverflow.com/comment/31423472
has comment: http://stackoverflow.com/comment/31423415

http://stackoverflow.com/comment/32038578
score: 0
type: AnswerComment
type: Comment
has text: For scoring, you can put it in Game with something like homeScore and awayScore.
comment on: http://stackoverflow.com/a/20975396

http://stackoverflow.com/a/20930276
has comment: http://stackoverflow.com/comment/31431525
has comment: http://stackoverflow.com/comment/31431471
has comment: http://stackoverflow.com/comment/31432042
accepted answer of: http://stackoverflow.com/q/20929786
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31538189
type: Answer
has comment: http://stackoverflow.com/comment/31431833
score: 2
answers question: http://stackoverflow.com/q/20929786
has comment: http://stackoverflow.com/comment/31553152
upvote count: 2
has comment: http://stackoverflow.com/comment/31432064
has body: I am trying to do a similar thing at the moment, but I am deploying my application to CloudBees. This article explains how to deploy a Spring MVC application to a number of PaaS hosting providers (CloudBees, CloudFoundry, Heroku, Windows Azure, OpenShift, Elastic Beanstalk and Google AppEngine). It was of some help to me. Maybe it will be useful to you too. You could also have a look at this article which compares all these services. If you decide to go with CloudBees, note that they will host your application on Tomcat 6 by default. If you need another server (Tomcat 7, JBoss, GlassFish, etc.) you can switch it easily, but you need to download their SDK and deploy your application with the bees app:deploy command-line tool which is a part of the SDK. They have simple and detailed instructions on deployment, DB configuration etc. UPDATE: This answer is not relevant any longer, as CloudBees are going to stop providing application hosting services (both free and paid). I received an email from them which says that they discontinue free accounts on 24 September 2014.

http://stackoverflow.com/comment/31339311
score: 0
type: Comment
type: QuestionComment
has text: Do you want the number to be formatted the same way in any language? I mean... should it be `123,456,789.90` regardless of the current locale?
comment on: http://stackoverflow.com/q/20883402

http://stackoverflow.com/q/20927902
possible better answer: http://stackoverflow.com/a/20928197
answer count: 3
has title: How to upload bufferedImage without storing it in user's system?
accepted answer: http://stackoverflow.com/a/20927987
tagged with: php
type: AnsweredQuestion
tagged with: java
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/20927987
has answer: http://stackoverflow.com/a/20927979
has answer: http://stackoverflow.com/a/20928197
has body: I am a beginner in java, and I am trying to write a simple screen-capture program. I wrote a simple SWING desktop app with a button and a text-field, and what I am trying to do is, when a user clicks that button the app takes a snapshot of the screen using awt.Robot, and sends that image and the text to a PHP script on my server. My snapshot function so far is: private void takeSnapShot(){ try { Robot robot = new Robot(); Rectangle area = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()); BufferedImage bufferedImage = robot.createScreenCapture(area); //Try to save the captured image try { File file = new File("screenshot_full.png"); ImageIO.write(bufferedImage, "png", file); } catch (IOException ex) { Logger.getLogger(ScrCaptFrm.class.getName()).log(Level.SEVERE, null, ex); } } catch (AWTException ex) { Logger.getLogger(ScrCaptFrm.class.getName()).log(Level.SEVERE, null, ex); } } As you can see it's fairly simple so far, however I am not sure how to send that image to my PHP script without actually storing the image on user's PC. Oh and I am using apache httpClient library for communicating to the web server. For the text I guess I can pass it in the URL as a get query, but I am not sure what to do about the image.
score: 0

http://stackoverflow.com/a/26920121
type: AcceptedAnswer
downvote count: 1
has comment: http://stackoverflow.com/comment/58578450
accepted answer of: http://stackoverflow.com/q/21006136
type: Answer
has comment: http://stackoverflow.com/comment/65717904
answers question: http://stackoverflow.com/q/21006136
has comment: http://stackoverflow.com/comment/82594430
has comment: http://stackoverflow.com/comment/81101671
has comment: http://stackoverflow.com/comment/100943055
score: 120
upvote count: 121
has comment: http://stackoverflow.com/comment/82752752
has body: If nothing of this helps (my case), you can set it in your pom.xml, like this: &lt;properties&gt; &lt;maven.compiler.source&gt;1.7&lt;/maven.compiler.source&gt; &lt;maven.compiler.target&gt;1.7&lt;/maven.compiler.target&gt; &lt;/properties&gt; As this cool guy mentioned here: https://stackoverflow.com/a/25888116/1643465

http://stackoverflow.com/a/20981096
type: Answer
has body: you can set the index of the EditText as id. for(int i=0;i&lt;max;i++){ EditText et=new ExitText(this); //......... et.setId(i); } And call findViewById(0); and so on
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/20981029
downvote count: 0

http://stackoverflow.com/comment/31456660
score: 0
has text: @JonathanQuant Please, put a breakpoint, or simply Log.d value of all extracted double variables : `var1`, `var2`, `var3` that are used to calculate double `solution` and post what you've got.
comment on: http://stackoverflow.com/a/20937601
type: AnswerComment
type: Comment

http://stackoverflow.com/a/20884925
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/31342295
has body: I don't know about this particular software but limiting JVM heap size to 512Mb max may be insufficient. Try setting initial heap size to 512 Mb and maximum to 2 Gb with -Xms512m -Xmx2g
answers question: http://stackoverflow.com/q/20884717
downvote count: 0

http://stackoverflow.com/a/20980341
has body: This is most likely an issue with the 0.5.0.M6 version and the Tomcat version you are using. It does work with Spring Boot 0.5.0.M7 and Tomcat 7.0.47.
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/20854585
answers question: http://stackoverflow.com/q/20854585
has comment: http://stackoverflow.com/comment/59589092
upvote count: 4
score: 4

http://stackoverflow.com/q/20897704
answer count: 1
type: UnansweredQuestion
has body: I tried many things to gzip the request(in json) using camel, we are calling rest web services using camel. The request will be in the body as we are sending it in POST request I tried with adding content encoding as gzip, it does not worked I tried to add a new data format gzip and giving but none of these worked. Is there any way to gzip the input request, our need is to call a web service with the request as gzipped. I couldn't get much support from google, please help Regards Hari
type: Question
has title: Gzip Camel request
tagged with: java
tagged with: apache-camel
has answer: http://stackoverflow.com/a/20897953
score: 0
tagged with: apache

http://stackoverflow.com/a/38192627
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20891494
upvote count: 1
score: 1
has body: Although Parameterized extends Suite, it behaves totally different - in disrespect of the Liskov substitution principle. This is because normally the constructor Suite(Class&lt;?&gt;, RunnerBuilder) processes the @SuiteClasses annotation. But Parameterized(Class&lt;?&gt;) replaces this behaviour with a processing of @Parameters. If you want to combine the behaviour of Suite and Parameterized you have to look outside of JUnit 4. E.g. you could implement your own Runner like Adam Hawkes already mentioned in another post here. I did the same by myself and cobbled a library together that provides you with a ParameterizedSuite Runner: https://github.com/PeterWippermann/parameterized-suite A parameterized test suite looks like this: @RunWith(ParameterizedSuite.class) @SuiteClasses({OneTest.class, TwoTest.class}) public class MyParameterizedTestSuite { @Parameters(name = "Parameters are {0} and {1}") public static Object[] params() { return new Object[][] {{'A',1}, {'B',2}, {'C',3}}; }

http://stackoverflow.com/comment/31369532
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20882189
has text: @lu4242, this is a very useful information for me. Thank you for your effort to check this.

http://stackoverflow.com/a/20880646
type: Answer
answers question: http://stackoverflow.com/q/20880545
accepted answer of: http://stackoverflow.com/q/20880545
has body: Define like below, Since Enums are constant, you need to pass your array list in compilation time. public enum SomeEnum{ String name; ArrayList data; SomeEnum(String name, ArrayList data) { this.name = name; this.data=data; } ADDRESS("someData", new ArrayList()); // pass your arraylist here }
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/20943527
has body: Methods are invoked by looking at object. In your case the object is of class Poly2 so in both the case it will invoke Poly2 class's print_a method. Addition Execution of constructor matters here. sequence of execution of constructor is first base class constructor and then derived class constructor.
has comment: http://stackoverflow.com/comment/31453812
has comment: http://stackoverflow.com/comment/31453825
score: 0
answers question: http://stackoverflow.com/q/20943378
type: Answer
has comment: http://stackoverflow.com/comment/31453736

http://stackoverflow.com/comment/31529248
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20982789
has text: I would like very much so, but I do not know how. Could not find any reference on how to call NDK from Delphi. Hence the detour.
type: Comment

http://stackoverflow.com/comment/31496005
has text: @peeskillet - Events are output to a JTextArea in the GUI. If a Terminate event is read from the file then I want the program to stop and no more events read from the file. I want the GUI to stay open so I can make a restart button that will restart the program.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20966118

http://stackoverflow.com/comment/31485938
comment on: http://stackoverflow.com/q/20960487
type: QuestionComment
score: 0
has text: @RichardTingle What do they have then? That's what I'm most probably looking for
type: Comment

http://stackoverflow.com/a/20904118
type: Answer
score: 0
has body: A practical example List&lt;String&gt; list; list = thereIsMuchData ? new ArrayList&lt;&gt;() : new LinkedList&lt;&gt;(); public void f(List&lt;String&gt; strings) { ... } List being an Interface, ArrayList and LinkedList implementing classes. You can see the following: The implementation is your choice, based on technical knowledge. In this java distinghuishes itself from simple languages where there is one-fit-all List. Usage of list is not overspecific. The method f can handle all kind of lists.
answers question: http://stackoverflow.com/q/20903983

http://stackoverflow.com/comment/31456784
type: Comment
has text: continuing on this, the first one appears to be creating an authenticated session object which then allows actions to be performed. this is good.
score: 0
comment on: http://stackoverflow.com/a/20945389
type: AnswerComment

http://stackoverflow.com/q/20934314
score: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/20934348
has title: byte casting when use NOT operator
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/20934345
has answer: http://stackoverflow.com/a/20934348
has answer: http://stackoverflow.com/a/20934345
type: Question
upvote count: 2
answer count: 2
tagged with: casting
tagged with: types
favorite count: 0
has body: Why I need to use variable casting in this example? byte b = -123; b = (byte) ~b; When I am trying to compile it without casting, I get: NotDemo.java:17: error: possible loss of precision

http://stackoverflow.com/comment/31450262
type: QuestionComment
has text: You know there are pre-written XML parsers for Java, but you wish to write your own in this case correct?
comment on: http://stackoverflow.com/q/20941650
score: 0
type: Comment

http://stackoverflow.com/q/20886960
upvote count: 1
favorite count: 0
tagged with: light
has comment: http://stackoverflow.com/comment/31366887
downvote count: 0
answer count: 0
type: UnansweredQuestion
type: Question
tagged with: lighting
tagged with: libgdx
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31537983
has comment: http://stackoverflow.com/comment/31388024
tagged with: box2d
has body: I am using LibGDX, and Box2D ( with the addon Box2D Light ). I wanted to put my player ( with the light ) in the middle. It didn't work. I though by just moving the OrthographicCamera and updating my rayHandler's CombinedMatrix it would work. But it doesnt: Pic1 or Mirror My player gets drawn in the center. but i couldn't get my light to be in the center and the whole Box2D scene around it I tried multiple things but all failed badly. So i have no idea what i can do now. I am trying to acheive this: Pic1 or Mirror As you can see, the light is on the player, and it moves with him also, and they are both in the middle ( made in Game Maker ) Edit : Ok, so i got it working, but i still have no idea why, 'lvlControl.mat.camera.position.set(MazeStartX+player.PlayerX-16, MazeStartY+player.PlayerY-16, 0); lvlControl.mat.camera.update(); light.setPosition(MazeStartX+(player.PlayerX),MazeStartY+(player.PlayerY)); rayHandler.setCombinedMatrix(lvlControl.mat.camera.combined); rayHandler.updateAndRender();' But i have an issue with that, It might increase lag alot more on android because it updates two times the camera ( one before so i can render my sprite batch correctly. ) So yeah, i'll test it but i don't think this is a permenant solution, I will try to have a better solution, but for now it works :) Aniway thanks everybody!
has title: Sort of Fixed : Box2D Light, Player in center ( LibGDX )

http://stackoverflow.com/comment/31281628
comment on: http://stackoverflow.com/q/20852900
type: Comment
type: QuestionComment
score: 0
has text: If you've written your own JDBC driver, how would you use it except with JDBC? How are you attempting to use it, and why are you trying to cast to your specific `Connection` type... that doesn't sound like `JDBC` to me.

http://stackoverflow.com/q/20987398
has title: showing error for struts2 select in netbeans
has comment: http://stackoverflow.com/comment/31535984
tagged with: netbeans
has comment: http://stackoverflow.com/comment/32372057
linked to: http://stackoverflow.com/q/5939413
tagged with: java
tagged with: select
type: Question
has comment: http://stackoverflow.com/comment/31536145
has comment: http://stackoverflow.com/comment/31535998
has comment: http://stackoverflow.com/comment/31536161
tagged with: struts2
score: 0
has comment: http://stackoverflow.com/comment/31536284
has body: when I use the below code in Netbeans IDE, I'm getting error indication in Netbeans. but the code works fine. Can anyone please tell me why I'm getting error warning in Netbeans. is there any solution for this The error warning is in list="#{'01':'Jan', '02':'Feb'}" &lt;s:select label="Months" name="months" headerKey="-1" headerValue="Select Month" list="#{'01':'Jan', '02':'Feb'}" value="selectedMonth" required="true" /&gt; The error indication message is given below Encountered ":" at line 1, column 7. Was expecting one of: "}" ... "." ... "[" ... "&gt;" ... "gt" ... "&lt;" .....
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21452489

http://stackoverflow.com/a/21016816
has comment: http://stackoverflow.com/comment/31636643
has comment: http://stackoverflow.com/comment/31719733
score: 0
has body: Perhaps it could be achieved by: Deploying the applet using Java Web Start. Specifying the Jars as lazy download. Starting a number of Thread instances, that.. Use the DownloadService (or related services) of the JNLP API. OTOH, I suspect the real bottleneck is the bandwidth of the user's connection. 70-80 Jars seems enormous! Have you considered obfuscating the code? I often denounce the ability of obfuscation software to prevent people from stealing code (if they are really determined, nothing will stop them), but doing so can often compress standard Jars by a further 50-60%. Another thing to look into is Pack-200, which might also give benefits in dropping the size of the required download.
answers question: http://stackoverflow.com/q/21016422
has comment: http://stackoverflow.com/comment/31637772
type: Answer

http://stackoverflow.com/comment/61681394
score: 0
comment on: http://stackoverflow.com/q/20923372
type: Comment
type: QuestionComment
has text: just remember that facebook uses php

http://stackoverflow.com/q/21017502
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31590797
accepted answer: http://stackoverflow.com/a/21021768
has answer: http://stackoverflow.com/a/21022711
has comment: http://stackoverflow.com/comment/31591918
has comment: http://stackoverflow.com/comment/31590569
has answer: http://stackoverflow.com/a/60300378
has comment: http://stackoverflow.com/comment/31591697
has answer: http://stackoverflow.com/a/44157306
downvote count: 1
type: Question
score: 31
has comment: http://stackoverflow.com/comment/31591670
tagged with: java
has comment: http://stackoverflow.com/comment/31590577
has comment: http://stackoverflow.com/comment/31592752
has comment: http://stackoverflow.com/comment/31592790
tagged with: date
has comment: http://stackoverflow.com/comment/31593386
has comment: http://stackoverflow.com/comment/31590840
linked to: http://stackoverflow.com/q/38922754
has answer: http://stackoverflow.com/a/21021768
answer count: 7
has comment: http://stackoverflow.com/comment/31592096
has answer: http://stackoverflow.com/a/60313374
has answer: http://stackoverflow.com/a/21034052
favorite count: 0
has comment: http://stackoverflow.com/comment/31590835
has comment: http://stackoverflow.com/comment/31591481
has body: Have a function that creates a time-only Date object. (why this is required is a long story which is irrelevant in this context but I need to compare to some stuff in XML world where TIME (i.e. time-only) is a valid concept). private static final SimpleDateFormat DF_TIMEONLY = new SimpleDateFormat("HH:mm:ss.SSSZ"); public static Date getCurrentTimeOnly() { String onlyTimeStr = DF_TIMEONLY.format(new Date()); // line #5 Date onlyTimeDt = null; try { onlyTimeDt = DF_TIMEONLY.parse(onlyTimeStr); // line #8 } catch (ParseException ex) { // can never happen (you would think!) } return onlyTimeDt; } There are probably at least a couple other ways to create a time-only Date in Java (or more precisely one where the date part is 1970-01-01) but my question is really not about that. My question is that this piece of code starts randomly throwing NumberFormatException on line #8 after having run in production for long time. Technically I would say that this should be impossible, right ? Here's an extract of random NumberFormatExceptions that come from above piece of code: java.lang.NumberFormatException: multiple points java.lang.NumberFormatException: For input string: ".11331133EE22" java.lang.NumberFormatException: For input string: "880044E.3880044" java.lang.NumberFormatException: For input string: "880044E.3880044E3" First of all I hope we can agree that formally this should be impossible? The code uses the same format (DF_TIMEONLY) as output and then input. Let me know if you disagree that it should be impossible. I haven't been able to re-produce the problem in a standalone environment. The problem seems to come when the JVM has run for a long time (>1 week). I cannot find a pattern to the problem, i.e. summer time / winter time, AM/PM, etc. The error is sporadic, meaning that one minute it will throw NumberFormatException and the next minute it will run fine. I suspect that there's some kind of arithmetic malfunction somewhere in either the JVM or perhaps even in the …
has answer: http://stackoverflow.com/a/38654501
possible better answer: http://stackoverflow.com/a/21034052
upvote count: 32
has comment: http://stackoverflow.com/comment/31593521
has title: NumberFormatException while parsing date with SimpleDateFormat.parse()

http://stackoverflow.com/comment/31516538
type: Comment
score: 0
type: AnswerComment
has text: What happens if I draw to a `BufferedImage` or from an implementation of `java.awt.print.Printable.print()`? Do I need to special-case the painting code for each of these cases?
comment on: http://stackoverflow.com/a/20973653

http://stackoverflow.com/comment/31402750
has text: It is absolutely `legal` to do this.
score: 0
comment on: http://stackoverflow.com/q/20916172
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20950147
downvote count: 0
has title: why is it a bad practise to not initialize primitive fields in a class?
tagged with: initialization
favorite count: 0
has answer: http://stackoverflow.com/a/20950585
type: Question
has answer: http://stackoverflow.com/a/20950382
upvote count: 6
has answer: http://stackoverflow.com/a/20950326
tagged with: java
has body: Java primitives always have a default value in the memory of O (booleans are false = 0). So why is it considered as a bad practise to not initialize them, if they even have a predefined value because of this mechanic? And in arrays, even with initialization of a new int[8], all the values in it arent really initialized, but that isnt frowned upon...
has answer: http://stackoverflow.com/a/20950251
tagged with: primitive
answer count: 5
score: 6
possible better answer: http://stackoverflow.com/a/20950227
has answer: http://stackoverflow.com/a/20950227
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20950251

http://stackoverflow.com/a/20970654
type: Answer
answers question: http://stackoverflow.com/q/20970236
upvote count: 5
score: 5
downvote count: 0
has body: Since your XML document is namespace qualified (see xmlns attribute in the project element): &lt;project xmlns="http://maven.apache.org/POM/4.0.0" ... You will need to set an implementation of javax.xml.namespace.NamespaceContext on your XPath object. This is used to return the namespace information for an individual step in the XPath. // SET A NAMESPACECONTEXT xpath.setNamespaceContext(new NamespaceContext() { @Override public Iterator getPrefixes(String namespaceURI) { return null; } @Override public String getPrefix(String namespaceURI) { return null; } @Override public String getNamespaceURI(String prefix) { if("pom".equals(prefix)) { return "http://maven.apache.org/POM/4.0.0"; } return null; } }); You need to change your XPath to include the prefixes used in the NamespaceContext. Now you are just not looking for an element called project, you are looking for a namespace qualified element with local name project, the NamespaceContext will resolve the prefix to match the actual URI you are looking for. Node node = (Node)xpath.evaluate("/pom:project/pom:parent/pom:version/text()", source, XPathConstants.NODE);

http://stackoverflow.com/q/20914804
has answer: http://stackoverflow.com/a/20914893
tagged with: java
has answer: http://stackoverflow.com/a/20914891
has title: Simple syntax error in my while loop
answer count: 4
tagged with: infinite-loop
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20914867
tagged with: while-loop
upvote count: 0
favorite count: 0
has body: Hi doing some revising for an exam and came upon this past question. Write a while loop to print the odd numbers between 0 and 10. I've been toying about and trying to Google but its such a simple thing and its confusing me. I know its a simple syntax error somewhere. I have tried moving the x++ about, tried moving the print statement about, just not getting it. can somebody shine light on this please. I would normally use a for loop as it would be easier but the question asks for a while loop. public class OddNumbersWhile { public static void main (String[]args){ int x = 0; while (x &lt;10){ if (x % 2 !=0) { x++; System.out.println(x); }} }}
has answer: http://stackoverflow.com/a/20914866
type: Question
downvote count: 2
score: -2

http://stackoverflow.com/q/20874896
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20874966
tagged with: authentication
tagged with: http
tagged with: java
type: Question
score: 0
tagged with: apache-httpclient-4.x
tagged with: rest
has answer: http://stackoverflow.com/a/20874965
has comment: http://stackoverflow.com/comment/31324029
has answer: http://stackoverflow.com/a/20875002
has body: http://developer.dnb.com/docs/2.0/common/authentication-process The authentication process of the service I am trying to access is explained in the url above. It is a simple REST authentication process wherein the user-id and password are passed in as follows: POST https://maxcvservices.dnb.com/rest/Authentication x-dnb-user: MyUsername x-dnb-pwd: MyPassword I have tried the following code but am receiving HTTP/1.1 400 ERROR. I am unable to figure out what I am doing wrong as I am very new to Java and HttpClient in particular. Any help would be much appreciated. I have thus far tried the following code: public static void main(String[] args) throws Exception { CloseableHttpClient httpclient = HttpClients.createDefault(); try { HttpPost httpPost = new HttpPost("https://maxcvservices.dnb.com/rest/Authentication"); List &lt;NameValuePair&gt; nvps = new ArrayList &lt;NameValuePair&gt;(); nvps.add(new BasicNameValuePair("x-dnb-user", "myusername")); nvps.add(new BasicNameValuePair("x-dnb-pwd", "mypassword")); httpPost.setEntity(new UrlEncodedFormEntity(nvps)); CloseableHttpResponse response2 = httpclient.execute(httpPost); try { System.out.println(response2.getStatusLine()); HttpEntity entity2 = response2.getEntity(); // do something useful with the response body // and ensure it is fully consumed EntityUtils.consume(entity2); } finally { response2.close(); } } finally { httpclient.close(); } }
has answer: http://stackoverflow.com/a/20876330
has title: I am trying to make a simple authentication request using HTTPClient but am receiving an error
answer count: 4

http://stackoverflow.com/a/20940604
answers question: http://stackoverflow.com/q/20940488
has body: Try this: Date now = new Date(); Date[] datesFromUser = new Date[10]; List&lt;Date&gt; newDatesList = new ArrayList&lt;Date&gt;(); for(Date d: datesFromUser){ if(d.getTime() &gt; now.getTime()){ newDatesList.add(d); } } Date[] dates = new Date[newDatesList.size()]; int index = 0; for(Date d: newDatesList){ dates[index++] = d; }
type: Answer
score: 0

http://stackoverflow.com/comment/31539977
type: AnswerComment
has text: Such a tool is called an _XSLT processor_ and you have two options. **1**: It is fairly certain that an XSLT processor is implemented in your browser (IE, Chrome, Firefox...). To make it work, you have to reference the stylesheet in your XML file (google it). **2**: Or use a tool that is independent of a browser and that is e.g. run from the command line. A prominent one is _Saxon_.
comment on: http://stackoverflow.com/a/20971384
type: Comment
score: 0

http://stackoverflow.com/comment/31547474
score: 0
has text: Unrelated: Please learn java naming conventions and stick to them.
comment on: http://stackoverflow.com/q/20985622
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31303368
has text: Here's the manual entry explaining everything (3.11.5): http://docs.spring.io/spring/docs/3.0.x/reference/beans.html#beans-java-further-information-java-config
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20863888
type: Comment

http://stackoverflow.com/comment/94188547
comment on: http://stackoverflow.com/a/20938132
type: AnswerComment
has text: @KorayTugay if the object reference is changed, the reference itself is not changed.
score: 0
type: Comment

http://stackoverflow.com/comment/31585000
type: Comment
has text: Again, thats not my point. its like, _"Q:Tiger, lion, and giraffe are in which animal category?"_. _"A:Tiger, lion, giraffe and kangaroo are mammals"_ where the proper answer expected is _"Tiger, lion and giraffe are mammals."_ or if you want to add something, _"Tiger, lion and giraffe are mammals. For your information, kangaroo is also a mammals"_. See the difference. I am sorry for arguing with just a small matter maybe, but it really bother me just now. I didn't mean to argue your answer, but just the way you present it. Peace
comment on: http://stackoverflow.com/a/21012651
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31537141
comment on: http://stackoverflow.com/q/20987910
score: 0
type: Comment
type: QuestionComment
has text: @SaurabhSharma OP seems to want them at run time.

http://stackoverflow.com/comment/31457993
score: 1
comment on: http://stackoverflow.com/q/20946128
type: Comment
type: QuestionComment
has text: This would help. http://www.thejavageek.com/2013/06/17/sorting-user-defined-objects-part-1/

http://stackoverflow.com/a/20883170
downvote count: 1
accepted answer of: http://stackoverflow.com/q/20883080
type: Answer
score: 1
has body: Reading input in java is very slow if you use Scanner. You can pass only problems with really small input using it. You should use BufferedReader and BufferedWriter if you think the input can be larger. The rest of your algorithm is correct(although this problem is meant for testing own implementation of big integer numbers instead of built-in types). EDIT: you are getting WA because of all the helper output you print to system.out. In programming competitions you should write nothing but the answer on the standard output. Thus you need to print only the result of the multiplication. Use the example. Your output should be precisely the same for your solution to pass.
answers question: http://stackoverflow.com/q/20883080
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/31533583
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20967744
type: Comment
has text: Thanks Piyush, it looks like initialization was the problem, but since I'm still learning, I'm glad to get the exact code from @laalto. Thank you though.

http://stackoverflow.com/comment/31340961
type: Comment
has text: Okay, this makes sense. The question, then, would be how do I access the array which is actually in the Main class instead of the one initialized in the instance of OtherClass? Because the array in the Main class needs to be constantly changing!
comment on: http://stackoverflow.com/a/20884369
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31348005
has text: Worst case would be a list with N zeroes and the goal of zero. In such a case, every subset is also a solution.
type: AnswerComment
comment on: http://stackoverflow.com/a/20887295
score: 0
type: Comment

http://stackoverflow.com/q/20969513
has comment: http://stackoverflow.com/comment/31502515
has comment: http://stackoverflow.com/comment/31502088
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31502150
tagged with: jsf
has comment: http://stackoverflow.com/comment/31502614
has answer: http://stackoverflow.com/a/31685898
tagged with: localhost
type: Question
has title: java httpRequest getRemoteAddr allways return 127.0.0.1
upvote count: 5
tagged with: java
tagged with: httprequest
has body: Hello everybody and thanks for your help, I am developing a web application using JSF and for security reasons i need to capture the user's IP when he does the log in. I am using the following code: HttpServletRequest request=(HttpServletRequest) context.getExternalContext().getRequest(); remoteAddress=request.getRemoteAddr(); The thing is that when I check my app logs to check the ip address it always returns 127.0.0.1. [INFO] 07/01/2014 11:04:22 --> User xxx connected from 127.0.0.1 [INFO] 07/01/2014 11:27:43 --> User xxx connected from 127.0.0.1 For more detail: I am using tomcat 7 My server works inside a debian virtual machine I am connecting to the server from a different pc from the one containing the VM. I have searched in internet and read about using: request.getHeader("X-FORWARDED-FOR"); But It did not solved my problem. I am quite lost at the moment, any ideas why is this happening?
score: 5
has comment: http://stackoverflow.com/comment/31502747
downvote count: 0
answer count: 1
tagged with: tomcat
favorite count: 0

http://stackoverflow.com/comment/32922769
comment on: http://stackoverflow.com/a/20973700
score: 0
type: AnswerComment
has text: @AnkurSharma ~"i have to resolve all the checkstyle issues". Why?
type: Comment

http://stackoverflow.com/a/20922489
score: 7
has body: After textField.setVisible(true); you need to call revalidate() and repaint() methods of container which contains your JTextField, if you try to show/hide components of visible container. So just add next lines to your code and all will be work: EditCourse.this.revalidate(); EditCourse.this.repaint();
type: Answer
accepted answer of: http://stackoverflow.com/q/20922442
upvote count: 7
answers question: http://stackoverflow.com/q/20922442
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/31331142
has text: I have added more of the Logcat, sorry, some of it didnt copy properly before.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20878799

http://stackoverflow.com/comment/31494189
type: Comment
type: QuestionComment
has text: I dont have a main jar file that wraps the others. I am signing JNLP file as described here:[link](https://blogs.oracle.com/thejavatutorials/entry/signing_a_jnlp_file) - Is there any other way I can try to sign my jar?
score: 0
comment on: http://stackoverflow.com/q/20947154

http://stackoverflow.com/a/20948124
has comment: http://stackoverflow.com/comment/31474677
type: Answer
has comment: http://stackoverflow.com/comment/31500522
has comment: http://stackoverflow.com/comment/31465403
has body: Change your code to following: DisplayBitmap function public Void DisplayBitmap(String url,IAsyncFetchListener listener) { Bitmap bitmap=memoryCache.get(url); if(bitmap!=null) listener.onComplete(bitmap); else { queueBitmap(url,listener); listener.onComplete(BitmapFactory.decodeResource(context.getResources(), stub_id)); } } queueBitmap function private void queueBitmap(String url,IAsyncFetchListener listener) { BitmapToLoad p=new BitmapToLoad(url); executorService.submit(new BitmapsLoader(p,listener)); } BitmapsLoader constructor IAsyncFetchListener listener; BitmapsLoader(BitmapToLoad bitmapToLoad,IAsyncFetchListener listener){ this.bitmapToLoad=bitmapToLoad; this.listener=listener; } Run method @Override public void run() { try{ Bitmap bmp=getBitmap(bitmapToLoad.url); memoryCache.put(bitmapToLoad.url, bmp); BitmapDisplay bd=new BitmapDisplay(bmp, bitmapToLoad); bd.setListener(listener); handler.post(bd); }catch(Throwable th){ th.printStackTrace(); } } And finally call this: imageLoader.DisplayBitmap("",new IAsyncFetchListener() { @Override public void onComplete(Bitmap bitmap) { photoView.setImageBitmap(bitmap); } });
has comment: http://stackoverflow.com/comment/31465754
has comment: http://stackoverflow.com/comment/31479690
answers question: http://stackoverflow.com/q/20947268
score: 0

http://stackoverflow.com/comment/31465111
type: Comment
type: QuestionComment
has text: BarGraph is a customView, it's this one. It extends from View.
score: 0
comment on: http://stackoverflow.com/q/20949010

http://stackoverflow.com/comment/31539265
has text: I had a look at this, it is probably a clean and meaningful way of doing things, but in my case it feels like it is too complicated for the purpose. I just need some create/read/update/delete interface to access my data, regardless of the way they are stored (json and xml files, database...) I will have to write the different adapters, but I'm ok with that. Anyway, my question is more about the way to implement an appropriate design pattern to persist java objects. Thanks for having answered.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20973175
type: Comment

http://stackoverflow.com/comment/31484360
comment on: http://stackoverflow.com/q/20959056
type: Comment
type: QuestionComment
score: 0
has text: As a side note, using a `stop_flag` like this just to avoid using `break` statements is not very Pythonic; it adds extra verbosity, and extra places to get something wrong. While there are arguable reasons to avoid `break` in some other languages (like pre-C99 C), in Python `break` is the idiomatic way to break out of a loop, and there are no down-sides to using it. (And giving the flag a name that implies the opposite sense from its actual use doesn't help…)

http://stackoverflow.com/a/21014437
score: -4
upvote count: 1
has body: It is not possible, if you compile things in newer Java version they'll be un executable.
downvote count: 5
has comment: http://stackoverflow.com/comment/31585249
type: Answer
answers question: http://stackoverflow.com/q/21014338

http://stackoverflow.com/comment/31376937
score: 0
comment on: http://stackoverflow.com/q/20875158
type: Comment
type: QuestionComment
has text: Thats it, I just had to use these lines `target=android-19 renderscript.target=18 renderscript.support.mode=true sdk.buildtools=19.0.1` and target therefore API 19. In eclipse also the android library changed from _Android 2.2_ to _Android 4.2.2_ and it still works. Now post your answer please, so I can mark this question as solved!

http://stackoverflow.com/comment/31424449
score: 1
has text: +1 for FlowPane. Or TilePane if you want the nodes to be all the same size.
type: AnswerComment
comment on: http://stackoverflow.com/a/20927271
type: Comment

http://stackoverflow.com/comment/47635126
comment on: http://stackoverflow.com/a/21076722
score: 1
type: AnswerComment
has text: do you know of any way to change it globally instead of changing for each object manually ?
type: Comment

http://stackoverflow.com/q/21006124
tagged with: python
accepted answer: http://stackoverflow.com/a/47142579
type: AnsweredQuestion
tagged with: java
tagged with: jpype
type: Question
upvote count: 4
has body: I'm trying to get a very simple example of using JPype (Version: 0.5.4.6) to instantiate a custom java class from within Python. It loosely follows an example: http://hustleplay.wordpress.com/2010/02/18/jpype-tutorial/ and is related to: JPype Headaches here's the python code (in /Users/me/jpypeTest/testjpype.py): from jpype import * cpopt="-Djava.class.path=%s" % ("/Users/me/jpypeTest") startJVM(getDefaultJVMPath(),"-ea",cpopt) print "JVM path:",getDefaultJVMPath() print "classpath:",cpopt java.lang.System.out.println("Hello World!!") testPkg = JPackage('pkg') Test = testPkg.Test Test.speak("hi") shutdownJVM() and here's the java code (in /Users/me/jpypeTest/pkg/Test.java): package pkg; public class Test { private String msg; public Test() { msg = "nothing so far..."; } public static void speak(String msg) { System.out.println(msg); } } compiled using: javac Test.java to produce /Users/me/jpypeTest/pkg/Test.class without errors (I have also tried putting Test.class in working directory) running the python code gives: &gt; python testjpype.py JVM path: /System/Library/Frameworks/JavaVM.framework/JavaVM classpath: -Djava.class.path=/Users/me/jpypeTest Hello World!! Traceback (most recent call last): File "testjpype.py", line 9, in &lt;module&gt; Test.speak("hi") File "/Users/me/dev/lib/python2.7/site-packages/jpype/_jpackage.py", line 53, in __call__ raise TypeError, "Package "+self.__name+" is not Callable" TypeError: Package pkg.Test.speak is not Callable System is a mac running Mavericks with: &gt; java -version java version "1.7.0_45" Java(TM) SE Runtime Environment (build 1.7.0_45-b18) Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode) &gt; javac -version javac 1.7.0_45 &gt; python --version Python 2.7.5 &gt; python -c 'import sys;print("%x" % sys.maxsize, sys.maxsize &gt; 2**32)' ('7fffffffffffffff', True) A JPype method for listing the imported java classes would also be very useful Many thanks for looking at this!
score: 4
has comment: http://stackoverflow.com/comment/70826706
has answer: http://stackoverflow.com/a/47142579
answer count: 1
downvote count: 0
has title: using custom java classes with JPype: package not callable error
favorite count: 0
has comment: http://stackoverflow.com/comment/70778039

http://stackoverflow.com/comment/31540420
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20990077
has text: What's the GAVC that you are looking for?
type: Comment

http://stackoverflow.com/q/20988244
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/20988258
has answer: http://stackoverflow.com/a/20988258
has comment: http://stackoverflow.com/comment/31538252
has answer: http://stackoverflow.com/a/20988278
has title: For 64 bit windows we need to use 64 bit java
upvote count: 2
has answer: http://stackoverflow.com/a/20988276
accepted answer: http://stackoverflow.com/a/20988278
tagged with: java
has body: Whether we need to use 64 bit java version for 64 bit windows os (will it work for RSA IDE for Java development)
tagged with: windows-7-x64
answer count: 4
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20988348
downvote count: 0

http://stackoverflow.com/q/20937055
score: 0
answer count: 1
tagged with: junit
accepted answer: http://stackoverflow.com/a/20937113
has title: easymock how to mock / set public final variable
has answer: http://stackoverflow.com/a/20937113
type: AnsweredQuestion
tagged with: java
tagged with: easymock
tagged with: unit-testing
type: Question
tagged with: testing
has body: I have class following class to test with mock objects. public class FordFulkerson { FlowNetwork network; Search searchMethod; public FordFulkerson (FlowNetwork network, Search method) { this.network = network; this.searchMethod = method; } public boolean compute () { boolean augmented = false; while (searchMethod.findAugmentingPath(network.vertices)) { processPath(network.vertices); augmented = true; } return augmented; } protected void processPath(VertexInfo []vertices) { int v = network.sinkIndex; // Determine the amount. Goal is to find the smallest int delta = Integer.MAX_VALUE; while (v != network.sourceIndex) { int u = vertices[v].previous; // Over a forward edge, int flow; if (vertices[v].forward) { flow = network.edge(u, v).capacity - network.edge(u, v).flow; } else { flow = network.edge(v, u).flow; } if (flow &lt; delta) { delta = flow; } v = u; // follow reverse path to source } // push minimal increment over the path v = network.sinkIndex; while (v != network.sourceIndex) { int u = vertices[v].previous; if (vertices[v].forward) { network.edge(u, v).flow += delta; } else { network.edge(v, u).flow -= delta; } v = u; // follow reverse path to source } Arrays.fill(network.vertices, null); // reset for next iteration. } } My tests: public class FordFulkersonMockTest { private FordFulkerson classUnderTest; private FlowNetwork mockNetwork; private Search mockSearch; @Before public void setUp() { mockNetwork = createMock(FlowNetwork.class); mockSearch = createMock(Search.class); classUnderTest = new FordFulkerson(mockNetwork, mockSearch ); } @Test public void test01() { expect(mockSearch.findAugmentingPath(null)).andReturn(false); replay(mockSearch); boolean res = classUnderTest.compute(); assertEquals(false, res); verify(mockSearch); } @Test public void test02() { expect(mockSearch.findAugmentingPath(null)).andReturn(true); try{ Field f = mockNetwork.getClass().getDeclaredField("sinkIndex"); f.setAccessible(true); f.set(mockNetwork, 0); f = mockNetwork.getClass…

http://stackoverflow.com/comment/31338822
type: QuestionComment
has text: you need the **btn5** to be perform some actions when the **start** button is clicked
type: Comment
score: 0
comment on: http://stackoverflow.com/q/20883238

http://stackoverflow.com/q/20853424
linked to: http://stackoverflow.com/q/15361175
tagged with: java
tagged with: hibernate
type: Question
has body: I have developed one application using struts2 and hibernate, which is integrated with Life-ray portal. When ever I am trying to run that application using j-boss5 server then am getting following error. ERROR [STDERR] SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" ERROR [STDERR] SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. I am not able to load HibernateSessionFactory class. Please let me know the solution for that. Thanks in advance.
has answer: http://stackoverflow.com/a/20853463
tagged with: struts2
score: 0
answer count: 1
has title: ERROR [STDERR] SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder"
has comment: http://stackoverflow.com/comment/31900667
type: UnansweredQuestion

http://stackoverflow.com/a/20936367
has comment: http://stackoverflow.com/comment/31464795
has comment: http://stackoverflow.com/comment/31465252
answers question: http://stackoverflow.com/q/20908316
score: 2
has body: Where did you put parent last, in which window of the console? Because there are two places in the console where to put parent last, one at the application level, and the other at the WAR level and that is the one that you want to choose. Put 'Class loader for each WAR file in application' and I believe from inside the screen where you chose that option, click the WAR and set the classloader policy at the WAR level to parent last: I think the path is this (don't have a console now): Application -- > Enterprise Application --> application_instance --> Web Module --> Web Module_instance Have a look at this to see that are two places to set classloader policies, and let me know if you found the setting and if it worked, or a new error is thrown. Sometimes when we switch the setting we find new errors because other jars where being read from the server and not the WAR, such as bean validation errors etc. If you get a different error non javassist related, it might be caused by that and you can always post it in a new question.
upvote count: 2
has comment: http://stackoverflow.com/comment/31462232
has comment: http://stackoverflow.com/comment/31464858
has comment: http://stackoverflow.com/comment/31470126
type: Answer
downvote count: 0

http://stackoverflow.com/a/21015167
has body: Go to the destination where atomikos logs are getting generated. Over there you will observe various 0 byte lock files which need to be deleted. This issue is observed when the last time the application was run it was shut down incorrectly. Once you delete the lck files and then try deploying the application the issue would be resolved
score: 2
answers question: http://stackoverflow.com/q/21014964
downvote count: 0
type: Answer
upvote count: 2

jogl
tag name: jogl
tags question: http://stackoverflow.com/q/21001778
tags question: http://stackoverflow.com/q/20929119
tags question: http://stackoverflow.com/q/20937840
tags question: http://stackoverflow.com/q/21014739
tags question: http://stackoverflow.com/q/20897544
type: Tag
tags question: http://stackoverflow.com/q/20940520
tags question: http://stackoverflow.com/q/20914085

http://stackoverflow.com/a/20917619
accepted answer of: http://stackoverflow.com/q/20917088
has body: From the perspective of just the declaration of the stack variable, public class ListStack&lt; E &gt; implements Stack&lt; E &gt; { private final java.util.List&lt; E &gt; stack; ... } and import java.util.List; public class ListStack&lt; E &gt; implements Stack&lt; E &gt; { private final List&lt; E &gt; stack; ... } are, for all intents and purposes, identical. You usually see fully qualified type declarations show up in variable declarations when there is something coming in on the imports that conflicts with the thing being declared. Consider if I've got my own org.rekdev.List that I want to use for something else in ListStack but I need the regular java.util.List for the stack itself. Now what? If I try to just do the imports the compiler complains. import org.rekdev.List; import java.util.List; public class ListStack&lt; E &gt; implements Stack&lt; E &gt; { private List&lt; E &gt; stack; private List&lt;E&gt; myOwnList; } ListStack.java:2: org.rekdev.List is already defined in a single-type import import java.util.List; ^ 1 error If I try to wildcard the problem away, the compiler complains more. import org.rekdev.*; import java.util.*; public class ListStack&lt; E &gt; implements Stack&lt; E &gt; { private List&lt; E &gt; stack; private List&lt;E&gt; myOwnList; } ListStack.java:5: reference to List is ambiguous, both class java.util.List in java.util and class org.rekdev.List in org.rekdev match private List&lt; E &gt; stack; ^ ListStack.java:6: reference to List is ambiguous, both class java.util.List in java.util and class org.rekdev.List in org.rekdev match private List&lt;E&gt; myOwnList; ^ 2 errors The compiler is a cruel, cruel mistress that only accepts perfection. Because there is more than one List in the compiler's scope, it is up to me to "disambiguate" the variable type declarations. I could forget the imports and be all verbose everywhere... public class ListStack&lt; E &gt; implements Stack&lt; E &gt; { private java.util.List&lt; E &gt; stack; pr…
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/20917088
has comment: http://stackoverflow.com/comment/31404302

http://stackoverflow.com/comment/31442411
type: QuestionComment
has text: Post the actual error message/logcat/stacktrace, whatever you got.
comment on: http://stackoverflow.com/q/20937656
score: 0
type: Comment

http://stackoverflow.com/a/20856773
has body: The best solution (which is also cross-platform IMO) is the answer given here: https://stackoverflow.com/a/2269242/1973164 I don't exactly trust reading the os.arch system variable. While it works if a user is running a 64bit JVM on a 64bit system. It doesn't work if the user is running a 32bit JVM on a 64 bit system. The following code works for properly detecting Windows 64-bit operating systems. On a Windows 64 bit system the environment variable "Programfiles(x86)" will be set. It will NOT be set on a 32-bit system and java will read it as null. boolean is64bit = false; if (System.getProperty("os.name").contains("Windows")) { is64bit = (System.getenv("ProgramFiles(x86)") != null); } else { is64bit = (System.getProperty("os.arch").indexOf("64") != -1); } For other operating systems like Linux or Solaris or Mac we may see this problem as well. So this isn't a complete solution. For mac you are probably safe because apple locks down the JVM to match the OS. But Linux and Solaris, etc.. they may still use a 32-bit JVM on their 64-bit system. So use this with caution.
score: 3
upvote count: 4
has comment: http://stackoverflow.com/comment/69783045
answers question: http://stackoverflow.com/q/20856694
has comment: http://stackoverflow.com/comment/69800791
type: Answer
downvote count: 1

http://stackoverflow.com/comment/31426954
score: 1
has text: That is a completely different question from the one you actually asked.
comment on: http://stackoverflow.com/q/20928669
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25271421
type: Answer
has body: Here a little guide on how to update javassist in WAS. This was tested with WAS 8.0.0.1. The javassist.jar in WAS_HOME/plugins has to be replaced by the jar from: http://search.maven.org/remotecontent?filepath=org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA.jar Keep the old one as backup. Invoke WAS_HOME/profiles/PROFILE_NAME/bin/osgiCfgInit.sh and then WAS_HOME/profiles/PROFILE_NAME/bin/clearClassCache.sh or the *.bat files on windows machines. Thanks to this post I found out how to do it: http://ramirezag.wordpress.com/2014/02/27/hibernate-4-2-8-and-websphere-8-5-5-1-issues/
answers question: http://stackoverflow.com/q/20908316
score: 0

exception
tags question: http://stackoverflow.com/q/20898293
tags question: http://stackoverflow.com/q/20871763
tags question: http://stackoverflow.com/q/20875846
tags question: http://stackoverflow.com/q/20963575
tags question: http://stackoverflow.com/q/20914319
tags question: http://stackoverflow.com/q/20995722
type: Tag
tags question: http://stackoverflow.com/q/20889718
tags question: http://stackoverflow.com/q/20857496
tags question: http://stackoverflow.com/q/20931900
tags question: http://stackoverflow.com/q/20978922
tags question: http://stackoverflow.com/q/20871703
tags question: http://stackoverflow.com/q/20998196
tags question: http://stackoverflow.com/q/21011199
tags question: http://stackoverflow.com/q/20902212
tags question: http://stackoverflow.com/q/20991918
tags question: http://stackoverflow.com/q/20999438
tags question: http://stackoverflow.com/q/21018277
tags question: http://stackoverflow.com/q/20900819
tags question: http://stackoverflow.com/q/20957536
tags question: http://stackoverflow.com/q/20997248
tags question: http://stackoverflow.com/q/20958455
tags question: http://stackoverflow.com/q/21004935
tags question: http://stackoverflow.com/q/21002025
tags question: http://stackoverflow.com/q/20989055
tags question: http://stackoverflow.com/q/20932464
tags question: http://stackoverflow.com/q/20955627
tag name: exception
tags question: http://stackoverflow.com/q/20899306
tags question: http://stackoverflow.com/q/20995854
tags question: http://stackoverflow.com/q/20988304
tags question: http://stackoverflow.com/q/20965712
tags question: http://stackoverflow.com/q/20962209
tags question: http://stackoverflow.com/q/20912843
tags question: http://stackoverflow.com/q/21008696
tags question: http://stackoverflow.com/q/20884592
tags question: http://stackoverflow.com/q/20967299
tags question: http://stackoverflow.com/q/20991860
tags question: http://stackoverflow.com/q/20932496
tags question: http://stackoverflow.com/q/20876028
tags question: http://stackoverflow.com/q/20971844

http://stackoverflow.com/comment/31354065
type: QuestionComment
comment on: http://stackoverflow.com/q/20891117
has text: On the other Hand I think you will have a ClassCastException here: httppost.setURI((java.net.URI) URI);
score: 0
type: Comment

http://stackoverflow.com/comment/109353121
type: AnswerComment
has text: This has nothing to do with converting string representations of `java.time` objects into `XMLGregorianCalendar`.
type: Comment
comment on: http://stackoverflow.com/a/45121704
score: 2

http://stackoverflow.com/a/20880376
answers question: http://stackoverflow.com/q/20879858
score: 0
type: Answer
has body: That's a lot of code. I don't really know what you want people to look at. In reference to your question, to check for a spot already taken: if(board[x][y] == 'X' || board[x][y] == 'O') { //choose another spot }

http://stackoverflow.com/q/20854108
tagged with: java
tagged with: methods
has body: I'm new to java/android and would really appreciate help with this. I would like my java method to be able to take in more than one type for the parameter. For example the variable myButton could be an ImageButton or just a Button. The code inside myFunction is valid for whether myButton is an ImageButton or a Button. if (condition) { ImageButton myButton = (ImageButton) findViewById(R.id.myButtonID); myFunction(myButton); } else { Button myButton = (Button) findViewById(R.id.myButtonID); myFunction(myButton); } public void myFunction(Button or ImageButton myButton) { ....identical code for myButton which could be an ImageButton or Button.... } I could obviously write out 2 funcions for parameter type and call it when applicable but that seems like a waste and there must be a quicker way. How can I do this? Thanks for your help.
type: Question
has comment: http://stackoverflow.com/comment/31283438
linked to: http://stackoverflow.com/q/16131410
has answer: http://stackoverflow.com/a/20854216
has comment: http://stackoverflow.com/comment/31283458
has title: Android java method - Can a parameter be more than one type?
score: 0
has comment: http://stackoverflow.com/comment/31283375
answer count: 3
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/20854130
has comment: http://stackoverflow.com/comment/31283487
has answer: http://stackoverflow.com/a/20854171

http://stackoverflow.com/a/20936664
upvote count: 4
downvote count: 0
has body: My guess is that you expect BufferedReader.readLine() to return the line, including its ending EOL character sequence. That's not the case. readLine() returns the line without its ending line break. So you need to explicitely append a newline to the text area: textArea.append(line); textArea.append("\n");
answers question: http://stackoverflow.com/q/20936500
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20936500
score: 4
type: Answer

http://stackoverflow.com/comment/31500329
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20966205
has text: Whether you update this question or elect to ask a new question, please include an [sscce](http://sscce.org/) that exhibits the problem you describe and the approach taken.
score: 0

http://stackoverflow.com/comment/31469061
type: Comment
has text: you are very smart it worked. It work better than using a switch statement
type: AnswerComment
comment on: http://stackoverflow.com/a/20951685
score: 0

http://stackoverflow.com/q/20857735
has body: I'm programming a game in android where an enemy ship needs to fire in a star pattern around itself. Basically, for any X number of shots I set the enemy ship to fire, I want it to divide 360 degrees around itself by the number of shots and fire the shots off at exactly equilateral angles. So, 3 shots would be fired off with the first shot at 360 degrees, the second shot at 120 degrees and the third shot at 240 degrees. 4 shots would be 360,90,180,270 and so on. Then each shot will travel outwards in a diagonal line until it hits the edge of the screen (or something else on the way). So far so good. Here is my code - I'm obviously doing something wrong, because although four shots will fire in four equal directions (north, south, east and west), 3 shots or 6 shots or 8 shots (etc) will fire in the wrong directions. The angles just aren't correct. I'd appreciate any help on this as I've been struggling with it for quite a while now. In the below example iShotNumber is the number of shots being fired in a salvo. Distance is the distance in pixels the shot will travel in one 'tick'. The shots are added around the circumference of the ship in an array, which is then run through every 'tick' to advance the shots one more step outwards. Logic for drawing the shots around the circumference of the ship: public void addShot(Context ctx, int iShotNumber, float distance) { for (int iShot=1; iShot&lt;=iShotNumber; iShot++) { double dAngle =0, //angle of the shot dCosFactor=0, //factor on the x-axis dSinFactor=0; //factor on the y-axis float fNewX = 0, //new position on the x-axis fNewY =0; //new position on the y-axis dAngle = 360/iShotNumber; dAngle = dAngle*iShot; if (iShotNumber == 1) {dAngle=180;} //if there's only one shot then fire straight down if (dAngle!=360 &amp;&amp; dAngle!=180) //if its 360 or 180 then fire straight up or straight down - no need for X { fNewX = (float) (getShipRadius()*Math.cos(Math.toRadians(dAngle))); if (dAngle&lt;=180) {fNewX=fNewX+distance;} e…
has answer: http://stackoverflow.com/a/20859366
has comment: http://stackoverflow.com/comment/31290498
has title: Calculate points around a circle in android
score: 0
answer count: 2
tagged with: trigonometry
tagged with: space
has comment: http://stackoverflow.com/comment/31295109
has comment: http://stackoverflow.com/comment/31293720
type: UnansweredQuestion
tagged with: android
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20858008

http://stackoverflow.com/comment/31327017
comment on: http://stackoverflow.com/a/20876425
type: Comment
has text: Sorry, I do need the encryption.
score: 0
type: AnswerComment

http://stackoverflow.com/a/21023803
downvote count: 0
has comment: http://stackoverflow.com/comment/31611002
has comment: http://stackoverflow.com/comment/31602115
type: Answer
answers question: http://stackoverflow.com/q/21005849
score: 1
has comment: http://stackoverflow.com/comment/31602946
has body: Update Also can you make sure you have jstl-xx.jar in your class-path? Why can't I use JSTL-style EL expressions in Struts tags? As of Struts version 2.0.9 the JSTL/JSP expression language (EL) has been disabled for Struts tag attributes which evaluate OGNL. This is a precaution against security vulnerabilities that can result from the double-evaluation that occurs when an attribute is first processed as a JSTL/JSP EL expression and then the result is processed as an OGNL expression. The solution is to express all dynamic attribute values in Struts tags using OGNL expressions directly. http://struts.apache.org/release/2.3.x/docs/using-struts-and-xwork-with-jsp-20-and-jstl-11.html But you could try this: http://struts.apache.org/release/2.3.x/docs/using-struts-and-xwork-with-jsp-20-and-jstl-11.html
upvote count: 1

http://stackoverflow.com/q/20926657
answer count: 2
tagged with: frameworks
tagged with: game-engine
has comment: http://stackoverflow.com/comment/31421956
favorite count: 0
has answer: http://stackoverflow.com/a/20929190
tagged with: android
has comment: http://stackoverflow.com/comment/31421764
has comment: http://stackoverflow.com/comment/31421736
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31421594
has comment: http://stackoverflow.com/comment/31421334
has title: How do you learn a framework without tutorials
has answer: http://stackoverflow.com/a/20927112
accepted answer: http://stackoverflow.com/a/20929190
downvote count: 1
has comment: http://stackoverflow.com/comment/31421366
type: Question
score: 3
tagged with: libgdx
possible better answer: http://stackoverflow.com/a/20927112
tagged with: java
has body: I have been trying to learn more about Android Game Development this past month. I read the only book I could find about libGDX, and it definitely helped me get started, but there are literally no other tutorials that I have found. My question is, how do you learn to create games using libGDX if there are no good tutorials out there? I hear a lot of people talk about documentation of libGDX and have no clue what that means. I guess to generalize it in the most simple way possible, where do I go from here? Suppose the developer just dropped the framework on the Internet today and you were to begin trying to learn how to use it without any help. What route would you take? I'm afraid I've come to a dead end after being so excited finishing the book.
has comment: http://stackoverflow.com/comment/31421155
upvote count: 4

http://stackoverflow.com/comment/31413831
type: Comment
comment on: http://stackoverflow.com/q/20922534
type: QuestionComment
has text: Yes @Patrick but I fail to solve :(
score: 0

http://stackoverflow.com/comment/31538693
score: 0
type: Comment
type: QuestionComment
has text: ya Agreed and corrected myself
comment on: http://stackoverflow.com/q/20988946

http://stackoverflow.com/a/20889942
type: Answer
answers question: http://stackoverflow.com/q/20885968
score: 0
has body: I think you class package name or manifest package name changed when you set it into the IDE. The error show as there is a mismatch with the class name which is used in manifest file with the class file.

lwjgl
tags question: http://stackoverflow.com/q/21010430
tags question: http://stackoverflow.com/q/20979673
tags question: http://stackoverflow.com/q/20946198
tag name: lwjgl
tags question: http://stackoverflow.com/q/20851799
tags question: http://stackoverflow.com/q/20872419
tags question: http://stackoverflow.com/q/20910593
tags question: http://stackoverflow.com/q/20987140
tags question: http://stackoverflow.com/q/20956042
tags question: http://stackoverflow.com/q/20943800
tags question: http://stackoverflow.com/q/21013873
tags question: http://stackoverflow.com/q/20896694
tags question: http://stackoverflow.com/q/20986180
type: Tag
tags question: http://stackoverflow.com/q/20898280
tags question: http://stackoverflow.com/q/20979282
tags question: http://stackoverflow.com/q/20857723

http://stackoverflow.com/comment/31402890
type: QuestionComment
has text: It's "legal". Not always advisable, but legal. (But, in particular, the use of the `x++` idiom in such cases is so firmly established that it's useless to lobby against it,.)
comment on: http://stackoverflow.com/q/20916172
score: 0
type: Comment

http://stackoverflow.com/comment/31412010
has text: @Raghunandan Don't you think that this's the purpose of onCreateView()?
comment on: http://stackoverflow.com/q/20918424
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20921589
has comment: http://stackoverflow.com/comment/31411378
has comment: http://stackoverflow.com/comment/31411248
upvote count: 1
answer count: 1
has body: Ok, so I recently asked about how to get access to individual columns of an array in java, and I got an answer that worked perfectly. I then however intended to calculate things such as the maximum value in this column, and the average. However, I came across an issue. In order to access each value, I assume this column needs to be treated as an array also. However, the way I got access to each column was by storing it into a double. Therefore, I have no idea how to take each column and calculate things. Can anyone help me please? I'm sorry for posting so much that probably seems like nothing here, but we had no teacher for 12 weeks and are expected to turn in this work by just teaching ourselves, and I'm just really stuck. import java.awt.EventQueue; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.JTextField; import javax.swing.JLabel; import java.awt.Font; import javax.swing.JButton; import java.awt.TextArea; import java.awt.event.ActionListener; import java.awt.event.ActionEvent;//Importing any required tools. import java.io.BufferedReader; import java.io.File; import java.io.FileReader; public class CSVFiles extends JFrame { //Class, inherits properties of the JFrame. private JPanel contentPane; //Create a container for the GUI. //Create other components used in the GUI private JTextField maxTxtVCC; private JTextField maxTxtTemp; private JTextField maxTxtLight; private JTextField minTxtLight; private JTextField avTxtLight; private JTextField minTxtTemp; private JTextField avTxtTemp; private JTextField minTxtVCC; private JTextField avTxtVCC; private JButton btnMax; private JButton btnMin; private JButton btnAv; private JTextField opnTxt; private JButton btnOpn; private TextArea textArea; private JFileChooser fc; private String content = ""; String [] contentCSV = new String [53000]; //String array to hold the dat…
downvote count: 0
has comment: http://stackoverflow.com/comment/31411684
accepted answer: http://stackoverflow.com/a/20921883
favorite count: 0
tagged with: http://stackoverflow.com/tag/csv
has answer: http://stackoverflow.com/a/20921883
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/31411499
tagged with: java
tagged with: file
has title: calculating average of values in column of an array?
type: Question
tagged with: arrays

http://stackoverflow.com/comment/31480068
comment on: http://stackoverflow.com/a/20957413
type: Comment
has text: @SamJaved: Unless they invented a new one since I went to college, there are only three significant units for temperature: Celsius, Fahrenheit, and Kelvin. Each is a short word, even shorter if you stick with the single-letter abbreviations. The user should not need a gesture to be able to see the various options. Moreover, some combinations are silly (converting Kelvin to Kelvin). If you're open to third-party code, this seems like a great place for a segmented radio button (e.g., https://github.com/vinc3m1/android-segmentedradiobutton).
score: 1
type: AnswerComment

http://stackoverflow.com/comment/31277468
type: QuestionComment
comment on: http://stackoverflow.com/q/20850578
score: 0
has text: You could provide a cleaner example demonstrating your issue..
type: Comment

http://stackoverflow.com/a/20886827
has comment: http://stackoverflow.com/comment/31345816
has comment: http://stackoverflow.com/comment/31346352
has comment: http://stackoverflow.com/comment/31345749
accepted answer of: http://stackoverflow.com/q/20886795
has comment: http://stackoverflow.com/comment/31346507
answers question: http://stackoverflow.com/q/20886795
upvote count: 9
has comment: http://stackoverflow.com/comment/31346689
score: 9
has comment: http://stackoverflow.com/comment/31346018
type: AcceptedAnswer
downvote count: 0
has body: Use the below. You can use a for loop and populate your ingredientsList. The below is just a example List&lt;Ingredient&gt; ingredientsList= new ArrayList&lt;Ingredient&gt;(); Ingredient i= new Ingredient("foo"); ingredientsList.add(i); Ingredient i1= new Ingredient("bar"); ingredientsList.add(i1); Then ListView lv = (ListView) findViewById(R.id.listview); // initialize listview lv.setAdpater(new CustomAdapterArrayAdapter(ActivityName.this,ingredientsList)); // set the custom adapter to listview You can use a CustomAdapterArrayAdapter inflate a custom layout public class CustomAarrayAdapter extends ArrayAdapter { List&lt;Ingredient&gt; ingredientsList; public CustomArrayAdapter(Context context, List&lt;Ingredient&gt; list) { super(context,0,list); ingredientList = list; } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { convertView = mInflater.inflate(R.layout.row,parent,false); // inflate custom layout called row holder = new ViewHolder(); holder.tv =(TextView) convertView.findViewById(R.is.textView1); // initialize textview convertView.setTag(holder); } else { holder = (ViewHolder)convertView.getTag(); } Ingredient in = (Ingredient)ingredientsList.get(position); holder.tv.setText(in.name); // set the name to the text; return convertView; } static class ViewHolder { TextView tv; } } http://developer.android.com/training/improving-layouts/smooth-scrolling.html ViewHolder is for smooth scrolling and performance row.xml &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="28dp" android:text="TextView" /&gt; &lt;/RelativeLayout&gt; Edit: Without using custom adapter class Ingredie…
has comment: http://stackoverflow.com/comment/31346460
has comment: http://stackoverflow.com/comment/31346571
has comment: http://stackoverflow.com/comment/31345988
type: Answer

http://stackoverflow.com/comment/31486148
has text: How are you compiling?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20960653

http://stackoverflow.com/comment/31535911
has text: @ Kamlesh Arya Failed to create the project.
comment on: http://stackoverflow.com/q/20987346
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20856298
tagged with: pinchzoom
has title: How do i Implement Graphs in Android and change scale on using pinch zoom
answer count: 1
has answer: http://stackoverflow.com/a/20856348
has comment: http://stackoverflow.com/comment/31288138
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31287763
tagged with: android
has comment: http://stackoverflow.com/comment/31287843
upvote count: 0
tagged with: java
has body: graph should have pinch to zoom functionality which should change graph from Month to Week and then on further zooming to days. below image shows the highest level of zoom i.e in hours so essentially zooming out using pinch should change the scale to days, further zoom out leads to weeks, and finally to Month... Is this possible without any external libraries in native android (java). Need Help and fast!!! Image: https://i.sstatic.net/vbMsl.png
has comment: http://stackoverflow.com/comment/31288375
type: Question
tagged with: graph
tagged with: android-graphview
score: -2
downvote count: 2

http://stackoverflow.com/comment/31393754
type: AnswerComment
type: Comment
has text: If you are trying to copy a file that requires root permissions yes, otherwise no, that's why it might work on some phones because some vendors might have different permissions stated
comment on: http://stackoverflow.com/a/20911063
score: 0

http://stackoverflow.com/comment/37350028
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20951027
has text: [Content Providers and Content Resolvers](http://www.androiddesignpatterns.com/2012/06/content-resolvers-and-content-providers.html)

http://stackoverflow.com/comment/35776071
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21003914
type: Comment
has text: Problem is that I don't have control on that other module, it's coded by colleague and will take a while before any change. Excluding sub-directories leave the main directory build as excluded ans so doesn't help in getting the directory I need as source root. The only solution for now is to remove build directory from the excluded one and mark the generated as source root after the build (gradle cleanIdea idea delete this configuration so I have to do it after each build. Gradle module for Intellij being too slow for our big project I have no other choice). Anyway thank you for your time :-)

http://stackoverflow.com/a/20972955
upvote count: 1
has body: You want: File f = new File(txtPath.getText()); instead of: File f = new File(txtPath); Otherwise you are feeding the File constructor an object reference, not the text contained in the JTextField object.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20972730

http://stackoverflow.com/q/20950060
tagged with: numbers
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/20950370
has comment: http://stackoverflow.com/comment/31465358
linked to: http://stackoverflow.com/q/2721390
type: Question
has comment: http://stackoverflow.com/comment/31465744
tagged with: sum
answer count: 6
has answer: http://stackoverflow.com/a/20950397
score: 4
tagged with: iterable
has answer: http://stackoverflow.com/a/20950388
has answer: http://stackoverflow.com/a/20950528
has answer: http://stackoverflow.com/a/20950284
favorite count: 0
has answer: http://stackoverflow.com/a/20950816
linked to: http://stackoverflow.com/q/4970024
has title: Java 1.7: Sum of Iterable<T extends Number>
type: UnansweredQuestion
upvote count: 4
has comment: http://stackoverflow.com/comment/31465626
has body: I need to create a helper method which allows to create a sum of any Iterable&lt;? extends Number&gt;, because we have many vectors and require a fast method to determine the sum, so I created the following method: static Integer sum(Iterable&lt;Integer&gt; it) { Integer result = 0; for(T next : it) { result += next; } return result; } This method only works for ints however, but we also have doubles and longs. Because you can't have two methods with the same signature (Our compiler thinks Integer sum(Iterable&lt;Integer&gt;) has the same signature as Double sum(Iterable&lt;Double&gt;).) I tried to write one method with generics. private static &lt;T extends Number&gt; T sum(Iterable&lt;? extends T&gt; it) { T result; for(T next : it) { result += next; } return result; } However this method will not compile (reason: the operator += is undefined for Object, Object). What can I do here? I know in C++ you can overload operators, but not in Java. But every class which extends Number does overload the += operator. What can I do here? Thank you in advance.

http://stackoverflow.com/q/20985136
tagged with: java
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20985187
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/31532008
score: 0
answer count: 1
has body: I currently have a FragmentActivity named PlayActivity. PlayActivity contains 5 child Fragments. In the onStart() method of PlayActivity, I am trying to reference an ImageView inside of one of the child fragments using findViewById(R.id.avatarView), however, it is coming up null. Code in PlayActivity: public void updateAvatar(Bitmap avatar) { ImageView avatarViewer = (ImageView) findViewById(R.id.avatarView); avatarViewer.setImageBitmap(avatar); } XML of child fragment: &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=".PlayerActivity" &gt; &lt;ImageView android:id="@+id/avatarView" android:layout_width="90dp" android:layout_height="90dp" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="34dp" android:layout_marginTop="62dp" android:src="@drawable/energy_icon" /&gt;
accepted answer: http://stackoverflow.com/a/20985187
has title: FragmentManager children and findViewById NullPointer
tagged with: android

http://stackoverflow.com/q/20896586
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31428203
has comment: http://stackoverflow.com/comment/31449505
has comment: http://stackoverflow.com/comment/31452004
type: UnansweredQuestion
tagged with: java
has body: I want to sort the returned result for each JSP page(100 items each page),not a global sort. DBObject sort = new BasicDBObject(); DBObject exist = new BasicDBObject(); DBObject query= new BasicDBObject(); exist.put("$exists",1); query.put("sortKey":exist);//sortKey is not indexed sort.put("sortKey",1); DBCursor cursor = dbcollection.find(query).limit(100).sort(sort); while(cursor.hasNext()){ System.out.println(cursor.next()); } But in fact ,the sort is stilled processed for all the documents in the collection,namely ,it is a global sort even though I use function limit(100) .Since the collection is very large-scale , the sort function will take quite a long time.So , I wonder if mongodb java driver has a feature which will perform a local(just sort for the returned 100 documents) instead of global sort?
has answer: http://stackoverflow.com/a/20896639
type: Question
has title: java mongodb sort() and limit() function
upvote count: 5
has answer: http://stackoverflow.com/a/41168254
tagged with: sorting
tagged with: mongodb
answer count: 2
score: 5
has comment: http://stackoverflow.com/comment/31449948
has comment: http://stackoverflow.com/comment/31451899

http://stackoverflow.com/a/20930081
has comment: http://stackoverflow.com/comment/31427860
score: 5
has comment: http://stackoverflow.com/comment/31428014
has body: In an executing program, text is (typically1) represented in UTF-16. But in a ".class" file, text in the constant pool (i.e. String literals, identifiers, and so on) is encoded in UTF-8 to save space. (Encoding of constant pool entries in UTF-8 is mandated by the JVM spec - Section 4.4 ... and is nothing to do with default character sets.) When the class file is loaded, the UTF-8 constant pool entries are transcoded to UTF-16 by the classloader. 1 - An application could be written to encode text in a myriad different ways. The UTF-16 encoding we are talking about here is the natural encoding scheme for text data in Java; i.e. the encoding you get when you store text a String or any other subtype of CharacterSequence.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20930017
has comment: http://stackoverflow.com/comment/31428056
has comment: http://stackoverflow.com/comment/31428108
upvote count: 5

http://stackoverflow.com/comment/31533437
comment on: http://stackoverflow.com/q/20985872
has text: Wait, what color, do you want the combo box background? The color or the dark gray panel or white?
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21002649
downvote count: 0
has comment: http://stackoverflow.com/comment/31563272
has comment: http://stackoverflow.com/comment/31563710
has comment: http://stackoverflow.com/comment/31566910
type: Answer
has body: Is Java a client-side and server-side language? It is a language. It is not specifically client side or server side and it can be used in Blu-ray players and many other devices where there is no client or server. Is it more a client-side or server-side, if both are applicable? It is use more widely on the server side. Why does it perform so poorly either way? It doesn't perform so poorly. It is less popular on the client as it can require a large download and has suffered some security concerns lately. It also doesn't run on every device whereas Javascript is more widely supported. JavaScript is a client-side language. Not true, Javascript can be used in Java and is used on the server side stand alone. see Node.js
score: 9
answers question: http://stackoverflow.com/q/21002537
has comment: http://stackoverflow.com/comment/31567484
upvote count: 9
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21002537

http://stackoverflow.com/comment/31491722
has text: Thanks for the answer! Did u see my PrintScr? I have downloaded the last EclipseLink and have created the file named jaxb.properties. What could it be wrong?
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/20962124

http://stackoverflow.com/comment/31419514
comment on: http://stackoverflow.com/a/20925824
score: 0
type: AnswerComment
has text: So, A has to be a Spring bean too ?
type: Comment

http://stackoverflow.com/q/20955226
has answer: http://stackoverflow.com/a/20955466
possible better answer: http://stackoverflow.com/a/20955466
tagged with: selenium-webdriver
type: AnsweredQuestion
score: 3
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/20976955
downvote count: 1
type: Question
tagged with: javascript
has comment: http://stackoverflow.com/comment/31475260
has comment: http://stackoverflow.com/comment/31475430
upvote count: 4
answer count: 2
accepted answer: http://stackoverflow.com/a/20976955
has body: I need to click on particular element of an dynamically loaded page.Web element generated when we scroll the page.It similar like an jabong webpage. I try to do that on jabong webpage this is my code WebDriver driver = new FirefoxDriver(); driver.manage().window().maximize(); driver.navigate().to("http://www.jabong.com/men/clothing/" + "?source=topnav"); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); System.out.println("Close the modal popup"); driver.findElement(By.id("jab-vchr-cls")).click(); driver.manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS); /** * while(true) loop is required to search the * element until element found.We put find * element within try-catch and if it get * exception it scroll the page and again * try to find the element. */ while(true) { ((JavascriptExecutor)driver).executeScript("window.scrollBy(0,100)", ""); try { WebElement element = driver.findElement(By.xpath("//*[@id='http: //static3.jassets.com/p/The-Indian-Garage-Co.-Checks-Red-Casual-Shirt-2889-679124-1-catalog.jpg']/img")); Wait&lt;WebDriver&gt; wait_element=new WebDriverWait(driver, 10); wait_element.until(ExpectedConditions.elementToBeClickable(element)); element.click(); System.out.println("!!!!!!!!!!!!!!At Last Get Success!!!!!!!!!!!!!!!!"); break; } catch (Exception ex) { Logger.getLogger(Test.class.getName()).log(Level.SEVERE, null, ex); System.out.println(ex.getMessage()); } } } } My question is 1.Is there any better way to do this things? 2.How to make this script faster?
has title: Click on element of a dynamic loaded page using Selenium WebDriver java
favorite count: 0

http://stackoverflow.com/a/20999680
has body: Given I don't have any class variable, is it thread safe if I call objectA.foo(new Customer()) from different threads? Of course it is. Your foo() method doesn't change any state of the A object (since it doesn't have any) and the object you pass, new Customer(), as an argument to the method is not available to any other thread. What if I change foo to static and call A.foo(new Customer()) from different threads? is it still thread safe? As long as you don't have any mutable static state, you're still good.
upvote count: 6
has comment: http://stackoverflow.com/comment/31558386
downvote count: 1
has comment: http://stackoverflow.com/comment/31558033
has comment: http://stackoverflow.com/comment/31558210
has comment: http://stackoverflow.com/comment/31557961
score: 5
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20999625
has comment: http://stackoverflow.com/comment/31557937
answers question: http://stackoverflow.com/q/20999625
type: Answer

http://stackoverflow.com/a/20950889
has body: According to the Sping Reference, The RequestToViewNameTranslator interface determines a logical View name when no such logical view name is explicitly supplied. (That is when your controller method returns Model, Map or void.) You could implement this interface, but I think in your example the best thing you can do is defining a constant as CodeChimp has suggested.
type: Answer
has comment: http://stackoverflow.com/comment/31467927
accepted answer of: http://stackoverflow.com/q/20950151
answers question: http://stackoverflow.com/q/20950151
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/28972829
upvote count: 5
answers question: http://stackoverflow.com/q/21004786
downvote count: 0
type: Answer
score: 5
has body: This happened to me as I had defined XmlAdapter implementations that were in a different JAR and not on the classpath. When trying to create the JAXBContext, it needs these adapters used by the JAXB type. Now that I figured this out, the message makes more sense, but is still very cryptic. XmlJavaTypeAdapter is the annotation interface and the code fails to call the value() method of the annotation as it returns Class&lt;? extends XmlAdapter&gt;, a class type which is not defined on the classpath. If you look at the code that throws the exception, this is impossible: public Class More ...getClassValue(Annotation a, String name) { try { return (Class)a.annotationType().getMethod(name).invoke(a); } catch (IllegalAccessException e) { // impossible throw new IllegalAccessError(e.getMessage()); } catch (InvocationTargetException e) { // impossible throw new InternalError(e.getMessage()); } catch (NoSuchMethodException e) { throw new NoSuchMethodError(e.getMessage()); } } Would be nice if the cause of the exception was not lost.

http://stackoverflow.com/comment/31386715
type: Comment
has text: Is it still possible to do?
comment on: http://stackoverflow.com/a/20907455
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31611391
score: 0
type: AnswerComment
has text: Can you expand on "doesn't get sent"? Do you get an exception? Which one? Does the server accept the message but never deliver it? Have you checked your "spam" folder? Have you tried sending to a different recipient? What version of JavaMail are you using? What does the debug output show?
comment on: http://stackoverflow.com/a/21016429
type: Comment

http://stackoverflow.com/a/44857523
answers question: http://stackoverflow.com/q/20869229
type: Answer
score: 0
has body: If Netbeans is blocked by Firewall this happens. Make sure your Antivirus firewall is not blocking NetBeans. Grant NetBeans full access to act as a server (This is also asked when you start NetBeans). Then you should be able to start your server through NetBeans

http://stackoverflow.com/comment/31509413
score: 0
comment on: http://stackoverflow.com/q/20973513
type: QuestionComment
has text: Afaik, cql3 is case insensitive by default unless you quote all stuff.
type: Comment

http://stackoverflow.com/a/20899781
has comment: http://stackoverflow.com/comment/31370243
answers question: http://stackoverflow.com/q/20899689
score: 0
has body: You are getting StackOverFlowError due to the recursive call you make in your code. i.e. static void heapSort(double [] a,int node, int index, boolean upcheck) calls itself recursively. You need to make use of break; in this kind of recursive method calls when the work is done From the documentation, public class StackOverflowError extends VirtualMachineError Thrown when a stack overflow occurs because an application recurses too deeply. Please read this link to know more about the error. The accepted answer explains it all
type: Answer

nlp
tags question: http://stackoverflow.com/q/20907909
tags question: http://stackoverflow.com/q/20936896
tags question: http://stackoverflow.com/q/20985604
tags question: http://stackoverflow.com/q/20931154
tag name: nlp
type: Tag

http://stackoverflow.com/a/60674822
answers question: http://stackoverflow.com/q/21013399
has body: Run the below cammand mvn clean install sonar:sonar
downvote count: 1
type: Answer
upvote count: 0
score: -1

hudson
type: Tag
tag name: hudson
tags question: http://stackoverflow.com/q/20997462

variables
tag name: variables
tags question: http://stackoverflow.com/q/20878862
tags question: http://stackoverflow.com/q/20870353
tags question: http://stackoverflow.com/q/20891551
tags question: http://stackoverflow.com/q/21012749
tags question: http://stackoverflow.com/q/20911990
tags question: http://stackoverflow.com/q/20970565
tags question: http://stackoverflow.com/q/20919112
tags question: http://stackoverflow.com/q/20891117
tags question: http://stackoverflow.com/q/20884251
tags question: http://stackoverflow.com/q/20961762
tags question: http://stackoverflow.com/q/20905301
tags question: http://stackoverflow.com/q/20982639
tags question: http://stackoverflow.com/q/20863989
tags question: http://stackoverflow.com/q/20890361
tags question: http://stackoverflow.com/q/20906739
tags question: http://stackoverflow.com/q/20973988
tags question: http://stackoverflow.com/q/20903726
type: Tag
tags question: http://stackoverflow.com/q/20924970
tags question: http://stackoverflow.com/q/20917179
tags question: http://stackoverflow.com/q/20930109
tags question: http://stackoverflow.com/q/20914728
tags question: http://stackoverflow.com/q/20956185
tags question: http://stackoverflow.com/q/20872563
tags question: http://stackoverflow.com/q/20942423
tags question: http://stackoverflow.com/q/20926039

http://stackoverflow.com/q/20921817
score: -3
has comment: http://stackoverflow.com/comment/31411635
has body: I'm new in java. I need to write a function that gets array A (The array size is n) and return true only if: A[x]>A[y]-10 (While 0≤x<n 0≤y<n x≠y) for example this array return true: A={1, 2, 5, 7, 9, 3} Ok so here's my code, I'm trying to call the function "checkIfLargebyTen" but it doesn't work. what's wrong? package Ass2; public class Part0 { public static boolean forAllExists(int[] A) { boolean ans = true; for(int i=0; i<A.length; i++) { if(checkIfLargebyTen(A,i)==false) { ans=false; }//if }//for //Boolean function that check if A[x]>A[y]-10 boolean checkIfLargebyTen(int[] arr, int x) { boolean ans=false; for(int y=0; y<arr.length && ans==false; y++) { if (x!=y && arr[x]>arr[y]-10) { ans=true; }//if }//for return ans; }//CheckFunction return ans; }//AllExixstsFunction }//class
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/31411699
accepted answer: http://stackoverflow.com/a/20921890
has comment: http://stackoverflow.com/comment/31411587
tagged with: java
downvote count: 3
type: Question
has answer: http://stackoverflow.com/a/20921941
has answer: http://stackoverflow.com/a/20921890
answer count: 2
has comment: http://stackoverflow.com/comment/31411683
favorite count: 0
possible better answer: http://stackoverflow.com/a/20921941
has title: How to call to function

http://stackoverflow.com/comment/31446467
score: 0
type: QuestionComment
has text: Andrew G :the problem is each of the Panels in the code, so dont know how to simplify...
type: Comment
comment on: http://stackoverflow.com/q/20939553

http://stackoverflow.com/q/20883964
has answer: http://stackoverflow.com/a/20887293
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20884912
tagged with: database
possible better answer: http://stackoverflow.com/a/20884912
favorite count: 0
accepted answer: http://stackoverflow.com/a/20887293
tagged with: postgresql
answer count: 3
tagged with: batch-processing
tagged with: jdbc
has body: I have a list and that list increasing continuously. I am doing add batch depend on the list size. I forgot to put limit for do executeBatch in specified size. Program is working for hours. I dont want to stop, fix and start again for now. My questions, what decides size of the adding batch? What is the max capacity of the batch to do executeBatch() in a one time? How many time I can use addBatch without do executeBatch()?
has title: What is the max JDBC batch size?
has comment: http://stackoverflow.com/comment/31340739
score: 16
downvote count: 1
linked to: http://stackoverflow.com/q/12639118
upvote count: 17
has answer: http://stackoverflow.com/a/24123205
type: AnsweredQuestion

http://stackoverflow.com/comment/31413156
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20922621
has text: I just copy code snippets from tutorial. But i can find another xml files from folder `res/menu` useing `R.menu.`.
score: 0

http://stackoverflow.com/a/20992632
answers question: http://stackoverflow.com/q/20975945
type: Answer
has body: Unfortunately, there is (currently, as of jOOQ 3.2) no way to typesafely dereference the I column from your derived table e, as there is no way the Java compiler can know that there is an I column. You will have to resort to unsafe methods: // Enforcing typesafety using coercion: .join(e) .on(s.NAME.equal(e.field("I").coerce(String.class)) // Circumventing typesafety using raw types .join(e) .on(s.NAME.equal((Field) e.field("I"))) A bit more typesafety can be achieved by reusing the I field as such: Source s = SOURCE.as("s"); Field&lt;String&gt; I = SOURCE.ID.as("I"); TableLike&lt;?&gt; e = create.select() .from(SOURCE) .where(SOURCE.NAME.isNotNull()) .asTable().as("e"); create.selectCount() .from(s) .join(e) .on(s.NAME.equal(e.field(I))) .fetchOne().value1();
upvote count: 4
has comment: http://stackoverflow.com/comment/31552491
downvote count: 0
has comment: http://stackoverflow.com/comment/77845647
score: 4
has comment: http://stackoverflow.com/comment/31552974
has comment: http://stackoverflow.com/comment/77855005
accepted answer of: http://stackoverflow.com/q/20975945
type: AcceptedAnswer

http://stackoverflow.com/comment/31461813
has text: @StarSky 's answer works, but I think this is the real answer I'm looking for. The most efficient as well. Thanks @blackbelt!
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20948050

http://stackoverflow.com/comment/31579067
has text: Thanks for the suggestions, I've updated my question with the code containing the solution.
type: Comment
comment on: http://stackoverflow.com/a/20997256
score: 0
type: AnswerComment

http://stackoverflow.com/q/20992841
has answer: http://stackoverflow.com/a/20997216
accepted answer: http://stackoverflow.com/a/20999537
downvote count: 0
has body: I have a panel with 2 buttons. When I click on the button 1, I'd simply like to read an audio file (a .WAV in that case). Then, when I click on the button 2, I'd like to stop the music. I do some research, but I'm a little confused about the different methods. Which one is the best in my case ? Can someone explains the difference between AudioClip, JavaSound and JavaMediaFramework please ? I've also try an example, but it contains errors. Here is my Main.class : import java.io.ByteArrayInputStream; import java.io.InputStream; public class Main { public static void main(String[] args) { SoundPlayer player = new SoundPlayer("C:/Documents and Settings/All Users/Documents/Ma musique/Échantillons de musique/Symphonie n° 9 de Beethoven (scherzo).wma"); InputStream stream = new ByteArrayInputStream(player.getSamples()); player.play(stream); } } Here is my SoundPlayer.class : import java.io.DataInputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; import javax.sound.sampled.*; public class SoundPlayer { private AudioFormat format; private byte[] samples; /** * * @param filename le lien vers le fichier song (URL ou absolute path) */ public SoundPlayer(String filename) { try { AudioInputStream stream = AudioSystem.getAudioInputStream(new File(filename)); format = stream.getFormat(); samples = getSamples(stream); } catch (UnsupportedAudioFileException e){e.printStackTrace();} catch (IOException e){e.printStackTrace();} } public byte[] getSamples() { return samples; } public byte[] getSamples(AudioInputStream stream) { int length = (int)(stream.getFrameLength() * format.getFrameSize()); byte[] samples = new byte[length]; DataInputStream in = new DataInputStream(stream); try { in.readFully(samples); } catch (IOException e){e.printStackTrace();} return samples; } public void play(InputStream source) { int bufferSize = format.getFrameSize() * Math.round(format.getSampleRate() / 10); byte[] buffer = new byte[bufferSize]; SourceDataLine line; try …
favorite count: 0
tagged with: javasound
has answer: http://stackoverflow.com/a/20992980
answer count: 4
tagged with: jmf
tagged with: audio
type: AnsweredQuestion
upvote count: 3
tagged with: java
has title: How to read an audio file? Which method should I use?
has answer: http://stackoverflow.com/a/20999537
type: Question
score: 3
has answer: http://stackoverflow.com/a/21010263
possible better answer: http://stackoverflow.com/a/20997216

http://stackoverflow.com/comment/31450473
type: Comment
has text: Yes, but if the elements and/or attributes are not unique to the road names, then I would use a XML parser. Otherwise the regular expression will keep getting more and more complex, and ... well, I don't think regex will remain the right approach for this task then.
type: AnswerComment
comment on: http://stackoverflow.com/a/20941712
score: 0

http://stackoverflow.com/comment/31366890
score: 1
has text: When you were posting this question a whole list of other questions asking this same thing popped up. There is also a list of them on the right of your screen. Please don't ask questions that have already been answered.
comment on: http://stackoverflow.com/q/20898176
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20937867
score: 2
accepted answer of: http://stackoverflow.com/q/20937667
downvote count: 0
answers question: http://stackoverflow.com/q/20937667
upvote count: 2
type: AcceptedAnswer
has body: You can do so just by instantiating object from your DatabaseHandler class like this: DabataseHandler dbHandler; dbHandler = new DatabaseHandler(getApplicationContext()); And then you can use methods in your Databasehandler class using dbHandler. For example: Task myTask = new Task(); dbHandler.addTask(myTask);
type: Answer

http://stackoverflow.com/comment/31447978
comment on: http://stackoverflow.com/q/20939491
type: Comment
type: QuestionComment
has text: That is indeed what is happening! I've updated the question with a pastee-link to the full .xhtml document!
score: 0

http://stackoverflow.com/a/20911420
has body: //PROBLEM SOLVED ;) import java.util.*; public class ManagementExams{ public static void main(String[] args){ Scanner sc= new Scanner(System.in); System.out.println("MANAGEMENT EXAMS \n"); System.out.print("Indicate how many exams do you want to insert: "); int dim = ScannerUtility.readInt(); int nexams = 1; Exam [] a = new Exam[dim]; for(int i=0; i&lt;a.length; i++){ System.out.println(""); System.out.print("Insert the name of the exam " + nexams +":"); String coursetitle = sc.nextLine(); System.out.print("Insert the day of the exam: "); int day = ScannerUtility.readInt(); System.out.print("Insert the month of the exam: "); String month = sc.nextLine(); System.out.print("Insert the year of the exam: "); int year = ScannerUtility.readInt(); System.out.print("Insert the hour of the exam: "); int hourexam = ScannerUtility.readInt(); Exam b = new Exam(coursetitle,day,month,year,hourexam); a[i] = b; nexams++; } System.out.print("The number of exams inserted are: " + (nexams-1)+ "\n\n"); System.out.println("Print Exams: \n"); for(int i=0; i&lt;a.length; i++){ System.out.println(a[i].toString()); } System.out.print("Do you want to change the day of certain exams?: "); String selection = sc.nextLine(); if (selection.equals("yes")){ System.out.print(""); System.out.print("Insert the name of the exam you want to search: "); String search = ScannerUtility.readString(); boolean var = false; for(int i=0; i &lt; a.length; i++){ if(search.equals(a[i].getCourseTitle()) ){ var = true; System.out.println("I found the following exam: \n" + a[i].toString() ); System.out.print("Change the day: "); int newday = ScannerUtility.readInt(); a[i].setDay(newday); } } if(var == false ){ System.out.println("No exam was found "); System.exit(0); } System.out.println(""); for(int j=0; j &lt; a.length; j++){ System.out.println("Exams updated: \n" + a[j].toString() + "\n"); } System.exit(0); }else if(selection.equals("no")){ System.exit(0); } } }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20890023

http://stackoverflow.com/q/20910986
tagged with: desktop
upvote count: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/31391432
has title: Get Desktop directory OS-independent
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31391642
has comment: http://stackoverflow.com/comment/31391626
has body: Of course I could use File desktop = new File(System.getProperty("user.home") + "/Desktop")); but this would only work OS-independent if the OS is set to English locale... On Windows the Desktop is named Desktop in every language it was translated to, but e.g. on Ubuntu the Desktop name gets translated (On my German system it's Arbeitsfläche). So I'm looking for an OS- and Locale-independent way of getting a File object representing the desktop directory.
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/31391488
tagged with: cross-platform
type: Question
score: 3
tagged with: java

http://stackoverflow.com/q/20969956
favorite count: 0
has title: i/o file writing code error
type: AnsweredQuestion
upvote count: 0
has body: Following is the code which works fine when it is in main() method. Compiles and gives .jasper file as an output package com; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JasperCompileManager; public class JasperCompile { public static void main(String args[]) throws JRException { JasperCompileManager.compileReportToFile("C:\\temp.jrxml", "C:\\temp.jasper"); } } But when I embed following line from main() method to servlet's doGet method then it doesn't work JasperCompileManager.compileReportToFile("C:\\temp.jrxml", "C:\\temp.jasper"); Following is the stack trace. Jan 7, 2014 4:19:21 PM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [JasperReportsBrowserDemoServlet] in context with path [/PDFReports] threw exception [Servlet execution threw an exception] with root cause java.lang.NoSuchMethodError: org.apache.commons.digester.Digester.addSetProperties(Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/StringV at net.sf.jasperreports.components.ComponentsXmlHandler.addListRules(ComponentsXmlHandler.java:117) at net.sf.jasperreports.components.ComponentsXmlHandler.configureDigester(ComponentsXmlHandler.java:104) at net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.addComponentRules(JRXmlDigesterFactory.java:514) at net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.configureDigester(JRXmlDigesterFactory.java:493) at net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.createDigester(JRXmlDigesterFactory.java:1324) at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:207) at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:172) at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:156) at net.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:108) at com.JasperReportsBrowserDemoServlet.createJRXML(JasperReportsBrowserDemoServlet.java:136) at com.JasperReportsBrowserDemoServlet.doGet(JasperReportsBr…
tagged with: java
has comment: http://stackoverflow.com/comment/31503031
type: Question
tagged with: jasper-reports
score: -1
has comment: http://stackoverflow.com/comment/31505206
tagged with: servlets
has answer: http://stackoverflow.com/a/20970068
accepted answer: http://stackoverflow.com/a/20970068
downvote count: 1
answer count: 1

http://stackoverflow.com/q/21014198
score: -3
tagged with: facebook
accepted answer: http://stackoverflow.com/a/21014610
has answer: http://stackoverflow.com/a/21014299
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31592028
tagged with: java
has title: Selenium With Eclipse IDE Making Small BOT
downvote count: 3
tagged with: selenium
tagged with: eclipse
has body: I am a new student of Computer Science, excuse if I sound n00b. What I am trying to do is I am trying to make a simple BOT which can login into the facebook and post a Status. I am doing this with the help of Selenium and Eclipse IDE in JAVA. The problem is although successfully logs in, But as my Facebook account is not verified it lands into a verification page. What I want to do is I want to create an IF condition, such that IF the program finds Verification Page it must click on "Not Now" button ELSE if the account is already verified it can post status from home page. How do I do this?
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/21014610
answer count: 2
favorite count: 0
possible better answer: http://stackoverflow.com/a/21014299

http://stackoverflow.com/a/20981088
answers question: http://stackoverflow.com/q/20969371
has body: Save it in a header and restore it. from("direct:foo") .to("direct:doSomething") // 1 (POJO on the exchange body) .setHeader("old_body", body()) // save body .to("direct:storeInHazelcast") // 2 (destroys my pojo! it gets -1) .setBody(header("old_body")) // RESTORE the body .removeHeader("old_body") // cleanup header .to("direct:doSomethingElse") // 3 (Where is my POJO??) ; This is a fairly common paradigm for destructive components.
score: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/31539192
has comment: http://stackoverflow.com/comment/31536915
type: Answer
upvote count: 4

http://stackoverflow.com/q/20868374
has answer: http://stackoverflow.com/a/20868622
tagged with: java
has body: I wish to draw a chart by using androidplot.jar lib in android. How can I convert double array into Number array in java? XYSeries series1 = new SimpleXYSeries(Arrays.asList(number1), SimpleXYSeries.ArrayFormat.Y_VALS_ONLY, "Series1"); In above case: number1 is a Number[] but if it is a double[] or an ArrayList, what can o do?
type: Question
tagged with: arrays
downvote count: 0
answer count: 2
has answer: http://stackoverflow.com/a/20868450
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: android
has title: convert double[] into Number[] in android
score: 2

http://stackoverflow.com/comment/31337085
comment on: http://stackoverflow.com/q/20881819
has text: No, it's looking good now. :) Noise deleted..
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20957596
type: Question
has comment: http://stackoverflow.com/comment/31479895
accepted answer: http://stackoverflow.com/a/20959087
has comment: http://stackoverflow.com/comment/31479836
tagged with: java
upvote count: 6
possible better answer: http://stackoverflow.com/a/20957700
has answer: http://stackoverflow.com/a/20957700
has answer: http://stackoverflow.com/a/20959087
has body: I'm writing an integration test that is passing a complex order by to PostgreSQL and then checking that the data comes back in the correct order. I'm writing this integration test in Java and its String.compareTo method appears to sort things differently from PostgreSQLs. I ran this on my PostgreSQL database: SELECT regexp_split_to_table('D d a A c b', ' ') ORDER BY 1; It responded with this: a A b c d D I then created this unit test to compare that to the way Java sorts things: import com.google.common.collect.Lists; import com.google.common.collect.Ordering; import org.junit.Test; import java.util.List; import static junit.framework.Assert.assertEquals; public class PostgresqlSortOrderTest { @Test public void whenJavaSortsStringsThenItIsTheSameAsWhenPostgresqlSortsStrings() { List&lt;String&gt; postgresqlOrder = Lists.newArrayList("a", "A", "b", "c", "d", "D"); Ordering&lt;String&gt; ordering = new Ordering&lt;String&gt;() { @Override public int compare(String left, String right) { return left.compareTo(right); } }; List&lt;String&gt; javaOrdering = ordering.sortedCopy(postgresqlOrder); assertEquals(postgresqlOrder, javaOrdering); } } This failed with this output: Expected :[a, A, b, c, d, D] //postgresql Actual :[A, D, a, b, c, d] //java I'm very ignorant of the terminology here. I'd like to know the names of these different String sorts so I can communicate better. But more importantly, how can I make Java sort like PostgreSQL does?
answer count: 3
has answer: http://stackoverflow.com/a/51242347
tagged with: string
tagged with: sorting
favorite count: 0
tagged with: postgresql
has title: How can I build a comparator that sorts Strings the same way that PostgreSQL does?
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/31480212
score: 6

http://stackoverflow.com/q/20934565
possible better answer: http://stackoverflow.com/a/20934692
tagged with: android
has answer: http://stackoverflow.com/a/20934692
linked to: http://stackoverflow.com/q/12052570
has title: Runtime added View does not know it's location
type: AnsweredQuestion
tagged with: java
type: Question
has body: I am adding a View to a RelativeLayout at runtime, which is working fine, but now I would like to display a TextView just to left of this View but I am unable to retrieve the Top or Left of this View in order to calculate the TextView's position. The code I have is private void displayGuitar() { for (GuitarString guitarString: guitar.getGuitarStrings()) { GuitarStringView guitarStringView = new GuitarStringView(context, attributeSet, guitarString); this.addView(guitarStringView); // Add Note name TextView noteNameView = new TextView(context); RelativeLayout.LayoutParams noteParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); noteParams.addRule(LEFT_OF, guitarStringView.getId()); Log.w("string top", String.valueOf(guitarStringView.getTop())); Log.w("string left", String.valueOf(guitarStringView.getLeft())); noteParams.setMargins(0, 0, 2, 0); noteNameView.setLayoutParams(noteParams); noteNameView.setText(guitarString.getTunedNote().getNoteName(0)); this.addView(noteNameView); } } This results in the TextViews all appearing on top of each other (in the correct X position) but I can't set the Top margin as both of the Log statements return 0. How can I determine what the Top position of the GuitarStringView is? EDIT Following advice from laalto I have now generated ID for the guitarStringView and confirmed it's being assigned. However, if I use LEFT_OF, RIGHT_OF etc the TextViews are not displayed, but if I use ALIGN_PARENT_RIGHT they're displayed fine? Code is now as follows private void displayGuitar() { for (GuitarString guitarString: guitar.getGuitarStrings()) { GuitarStringView guitarStringView = new GuitarStringView(context, attributeSet, guitarString); int viewId = guitarStringView.generateViewId(); guitarStringView.setId(viewId); this.addView(guitarStringView); // Add Note name TextView noteNameView = new TextView(context); RelativeLayout.LayoutParams noteParams = new RelativeLayout.LayoutParams(Vie…
has answer: http://stackoverflow.com/a/20934671
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/20934671

http://stackoverflow.com/q/20973365
accepted answer: http://stackoverflow.com/a/20973892
tagged with: build
type: AnsweredQuestion
tagged with: java
tagged with: gradle
type: Question
tagged with: testing
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/20973892
has body: I am using gradle as my builder. After running all of my test I want to execute additional task. If there are no test failures test.doLast { /*my task*/ } works fine. But if there is at least one test failure my task does not execute. Is there a way to execute my task even if some of my test failed.
upvote count: 30
score: 30
favorite count: 0
has title: Gradle execute task after test phase even if test has failed

http://stackoverflow.com/a/21050079
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20918286
type: Answer
answers question: http://stackoverflow.com/q/20918286
score: 0
has body: just include all javax.* jars under %WEBLOGIC_HOME%/Modules

http://stackoverflow.com/comment/31425571
score: 0
type: Comment
has text: Yes, but I think the best solution on this case is a Map.
comment on: http://stackoverflow.com/a/20928771
type: AnswerComment

http://stackoverflow.com/comment/31545846
has text: you have to add two different path 1 for JDK and 1 for JRE, C:\Program Files (x86)\Java\jdk1.6.0\ C:\Program Files (x86)\Java\jre6 i shared 1 reference document you can follow and try the same..
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20988072

http://stackoverflow.com/q/20879841
has body: my snmp string is snmptrap -Ci -Ls 7 -r1 -t10 -v 2c -c 100.100.100.104 00000 NET-SNMP-EXAMPLES-MIB::netSnmpExampleHeartbeatNotification UCD-DEMO-MIB::ucdDemoPublicString s {"m":"17","time":"1388559297","date":"1388559297"} how can i send this string uning SNMP4j library please help me to call this in java i have this code what change need to do for sending above string try { // Create Transport Mapping TransportMapping transport = new DefaultUdpTransportMapping(); transport.listen(); // Create Target CommunityTarget comtarget = new CommunityTarget(); comtarget.setCommunity(new OctetString(community)); comtarget.setVersion(SnmpConstants.version2c); comtarget.setAddress(new UdpAddress("100.100.100.104" + "/" + 162)); comtarget.setRetries(2); comtarget.setTimeout(5000); // Create PDU for V2 PDU pdu = new PDU(); // need to specify the system up time long sysUpTime = 111111; pdu.add(new VariableBinding(SnmpConstants.sysUpTime, new TimeTicks(sysUpTime))); pdu.add(new VariableBinding(SnmpConstants.snmpTrapOID, new OID(trapOid))); pdu.add(new VariableBinding(SnmpConstants.snmpTrapAddress, new IpAddress(ipAddress))); // variable binding for Enterprise Specific objects, Severity (should be defined in MIB file) //pdu.add(new VariableBinding(new OID(trapOid), new OctetString("NET-SNMP-EXAMPLES-MIB::netSnmpExampleHeartbeatNotification"))); //pdu.add(new VariableBinding(new OID(trapOid), new OctetString("UCD-DEMO-MIB::ucdDemoPublicString"))); pdu.setType(PDU.NOTIFICATION); Snmp snmp = new Snmp(transport); System.out.println("Sending V2 Trap to " + ipAddress + " on Port " + port); snmp.send(pdu, comtarget); snmp.close(); } catch (Exception e) { System.err.println("Error in Sending V2 Trap to " + ipAddress + " on Port " + port); System.err.println("Exception Message = " + e.getMessage()); }
score: 1
tagged with: java
tagged with: snmp4j
type: Question
has comment: http://stackoverflow.com/comment/31333186
tagged with: net-snmp
upvote count: 1
favorite count: 0
tagged with: snmp
answer count: 0
type: UnansweredQuestion
has title: How to do SNMP using SNMP4J with incuding MIBS?
downvote count: 0

http://stackoverflow.com/q/20888331
type: AnsweredQuestion
type: Question
score: 0
has body: TreeModel and TreeSelectionModel are both Types of models. You can acquire those be using tree.getModel(); and tree.getSelectionModel(); where tree is an Object of the type JTree. There are also setter-methodes for both of them. My Question is: If I'm right in concluding that tree has two models (the TreeModel und the TreeSelectionModel), how does this go together with the MVC-Pattern?
answer count: 1
has answer: http://stackoverflow.com/a/20893301
has title: Are there views with multiple models in swing? (TreeModel and TreeSelectionModel)
tagged with: model-view-controller
accepted answer: http://stackoverflow.com/a/20893301
tagged with: java
tagged with: swing

http://stackoverflow.com/a/20899499
has body: There is no inner class in your code. Since it is a method that doesn't have a return value, you can tell that it is a constructor, that is used to initialize your class. You pass in the value when you create a new instance of WeightedQuickUnionUF, for example like this: WeightedQuickUnionUF weightedQuickUnionUF = new WeightedQuickUnionUF(3);
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/20899467
downvote count: 0

gridview
tags question: http://stackoverflow.com/q/20964338
tags question: http://stackoverflow.com/q/20977210
tag name: gridview
tags question: http://stackoverflow.com/q/20963115
tags question: http://stackoverflow.com/q/20964584
type: Tag
tags question: http://stackoverflow.com/q/21000654
tags question: http://stackoverflow.com/q/20982317
tags question: http://stackoverflow.com/q/20851092
tags question: http://stackoverflow.com/q/20888069

http://stackoverflow.com/comment/31977488
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20899132
has text: In web.xml,you will find the config jsp org.apache.jasper.servlet.JspServlet JspServlet will precompile jsp file and process request with servlet while the jsp file compiled.
type: AnswerComment

http://stackoverflow.com/a/20921034
accepted answer of: http://stackoverflow.com/q/20917839
answers question: http://stackoverflow.com/q/20917839
has body: Your JavaFX application will run on a Windows tablet (e.g. Windows 8 tablet like a Surface Pro); it will not run on Windows RT. Supported JavaFX 2.x platforms are listed on Oracle's support site. There are ongoing community efforts to port JavaFX to run on Android and iOS (based on OpenJDK, OpenJFX and RoboVM or Dalvik), but no current efforts to port JavaFX to run on Windows RT.
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/31362823
type: QuestionComment
comment on: http://stackoverflow.com/q/20895723
has text: Shouldn't that be `final URL url = new URL(serverURL + str); // I think... what is URL and serverURL`?
score: 0
type: Comment

http://stackoverflow.com/a/21008917
type: Answer
answers question: http://stackoverflow.com/q/21008459
has body: When you define an HTTP proxy to an application or browser, either: There will be a preceding CONNECT request to form a tunnel, that tells you the target host:port, or The entire target URL is placed in the middle of the GET/POST/... request line. Normally, without a proxy, this is just a relative URL, relative to the host:port of the TCP connection.
score: 0
has comment: http://stackoverflow.com/comment/31601389

http://stackoverflow.com/q/20864868
has comment: http://stackoverflow.com/comment/31305002
has comment: http://stackoverflow.com/comment/31323112
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/20865245
tagged with: undefined
has comment: http://stackoverflow.com/comment/31304787
has comment: http://stackoverflow.com/comment/31305434
has comment: http://stackoverflow.com/comment/31304976
has comment: http://stackoverflow.com/comment/31304960
type: UnansweredQuestion
has title: Creating an object in a Method by using another Method to do it. But I can't get the object
has body: I am currently trying to to write a method that uses another method which in turn creates a new object from another class constructor. But I am somehow not able to get the object that I created. When I try to print the object in the method (that used the method which creates the object) it tells me the object is undefined. I am confused over how I should solve this problem. The reason I have this other method is because there is a bit too much code in one place, so I tried to make it cleaner. Anyhow, I decided to post two codes. The first one is my try on making it shorter and easier for you guys to read. But perhaps, just perhaps it might not have something that I missed in my original code. So I am posting that and my constructor class as well. Hopefully it fits here! Any help would be greatly appreciated! Here is the first "example" sample of what I am trying to do: public static void GameStart(){ //The print method if (Player1){ playerVäljKort(true); int val = readInt("Spara val = 1\nRedigera val = 2"); if (val == 2){ //This is where I am trying to print the object. I've tried doing this in several ways. System.out.println(player1Kortlek()); } } } public static void playerVäljKort(boolean playerTurn){ //I fail to define this outside the method. Kortlek player1Kortlek = new Kortlek(kort) Public class Kortlek{ private static int NewKortlek public Kortlek(int kort){ NewKortlek = kort; } Public String toString(){ return "Number of cards = " + Kortlek + "."; } } So if that looks perfectly correct, perhaps there is something I cannot see in my real code. Hopefully this won't kill the entire webpage. Here is the second and real code sample trying to do the same thing as above: The Constructor Class: public class Kortlek { private static int KortlekRedCard1; private static int KortlekRedCard2; private static int KortlekRedCard3; private static int KortlekRedCard4; private static int KortlekRedCard5; //private static int KortlekredCard6; private static int KortlekYellowC…
tagged with: java
tagged with: methods
has comment: http://stackoverflow.com/comment/31323305
type: Question
tagged with: object
has comment: http://stackoverflow.com/comment/31304831
has comment: http://stackoverflow.com/comment/31304903

http://stackoverflow.com/q/21000330
has body: I will start developing GATE as web services based on my saved applications in Java. Is it possible? At the moment, my saved application includes ANNIE Plugin. I researched on GATE and found that there was one plugin called "NeOn" and the web services for NeOn are not supported. Should i write the GateListener as a Servlet? I do not have any idea for how I can develop it in my program. Can you help me please? Here is an article that I have found that addresses my problem.
tagged with: service
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21002998
score: 2
tagged with: java
tagged with: gate
type: Question
has title: Gate embedded as web service
answer count: 1
downvote count: 0
tagged with: web

http://stackoverflow.com/q/20899331
answer count: 2
tagged with: firefox
downvote count: 0
has title: Need to capture network traffic using proxy in selenium webdriver code
linked to: http://stackoverflow.com/q/29081290
favorite count: 0
tagged with: proxy
has answer: http://stackoverflow.com/a/55202333
has body: Need capture network traffic using proxy in selenium webdriver code.. I've tried with below code but after opening browser google.com is not loading getting the error "proxy server that is refusing connections" public class Test_One { /** * @param args * @throws Exception */ public static void main(String[] args) throws Exception { // TODO Auto-generated method stub ProxyServer server = new ProxyServer(8090); server.start(); server.setCaptureHeaders(true); server.setCaptureContent(true); server.newHar("test"); DesiredCapabilities capabilities = new DesiredCapabilities(); Proxy proxy = server.seleniumProxy(); FirefoxProfile profile = new FirefoxProfile(); profile.setAcceptUntrustedCertificates(true); profile.setAssumeUntrustedCertificateIssuer(true); profile.setPreference("network.proxy.http", "localhost"); profile.setPreference("network.proxy.http_port", 8090); profile.setPreference("network.proxy.ssl", "localhost"); profile.setPreference("network.proxy.ssl_port", 8090); profile.setPreference("network.proxy.type", 1); profile.setPreference("network.proxy.no_proxies_on", ""); profile.setProxyPreferences(proxy); capabilities.setCapability(FirefoxDriver.PROFILE,profile); capabilities.setCapability(CapabilityType.PROXY, proxy); WebDriver driver = new FirefoxDriver(capabilities); driver.get("http://www.google.com"); Har har1 = server.getHar(); server.stop(); driver.quit(); } }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20984973
linked to: http://stackoverflow.com/q/10755480
has comment: http://stackoverflow.com/comment/37806685
tagged with: selenium-webdriver
score: 3
upvote count: 3
tagged with: java
type: Question

http://stackoverflow.com/comment/31382328
has text: @TimB Actually, each method deemed to be thread-safe was documented as such in its Javadoc: http://docs.oracle.com/javase/6/docs/api/javax/swing/JTextPane.html#replaceSelection(java.lang.String) You never have to look any further than that for a definitive answer.
comment on: http://stackoverflow.com/a/20906034
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/20918411
has body: You need to add index++; before acct_no++; statement. And you need to add the following function. private void withdrawAccountInfo(int an) { for(int s=0;s&lt;=9;s++) { if(savings[s].getAcct_No()==an) { // do your withdrawal process here with variable "s"; not "index" savings[s].setWithdraw(Integer.parseInt(JOptionPane.showInputDialog("Enter amount to withdraw"))); JOptionPane.showMessageDialog(null,"Your balance is: " + (savings[s].getBalanceW())); savings[s].setAmount(savings[s].getBalanceW()); // do more process break; } } } In the actionPerformed(ActionEvent e) function - inside the if(source==withdrawB) block - call the withdrawAccountInfo(int an) function
type: Answer
answers question: http://stackoverflow.com/q/20917944
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31405623
score: 0
accepted answer of: http://stackoverflow.com/q/20917944

http://stackoverflow.com/comment/31436587
type: QuestionComment
comment on: http://stackoverflow.com/q/20934382
score: 0
has text: Wait, which label are you talking about? I see a MenuOption but not another label except for the "Version" but that doesn't say anyting relative to the question.
type: Comment

http://stackoverflow.com/comment/31754245
type: AnswerComment
has text: Thanks Sir. Actually I find out another way ie. Windows PowerShell commands **get-process notepad | select-object description**. Therefore, I am using command line to get descriptions of currently running process.Similarly for Services **get-service | where {$_.status -eq 'running'}**.Kindly provide your suggestion.
type: Comment
comment on: http://stackoverflow.com/a/21099582
score: 0

http://stackoverflow.com/q/20958651
accepted answer: http://stackoverflow.com/a/20959416
tagged with: spring-security
has body: I've been having some trouble figuring this one out. I've got an multitenant system where users are organized into organizations. Within that organization the usernames must be unique. Otherwise, two organizations can have the same user name. I've got spring security hooked up with the jdbc-user-service and all that works fine. My problems start when I'm trying to get the current user. I took a look at a link that leverages spring 3 and the Principal object as a method parameter. This works great, except a Principal doesn't have enough information! First, usernames aren't unique in my usecase, also having easy access to the organization that the user belongs to would be great. A little more searching dug up this awesome answer. The problem with this is the same problem as before. It relies on the Principal object, which just doesn't have enough info. (here's the magic) @Override public Object resolveArgument(MethodParameter methodParameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception { if (this.supportsParameter(methodParameter)) { Principal principal = webRequest.getUserPrincipal(); return (User) ((Authentication) principal).getPrincipal(); } else { return WebArgumentResolver.UNRESOLVED; } } Is there a good way to override the User object to use my own? Am i stuck writing a custom UserDetailService? Is there a better approach than continuing to walk down this path? Thanks
has answer: http://stackoverflow.com/a/20959416
downvote count: 0
has title: Spring Secuiry Database Authentication casting Spring User to Domain User
tagged with: spring
type: AnsweredQuestion
score: 1
tagged with: java
favorite count: 0
type: Question
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/62471621
comment on: http://stackoverflow.com/a/20979762
type: Comment
has text: @user1156544. Not on older versions of Windows. Also, some windows applications refuse to accept `/` even now.
score: 0
type: AnswerComment

http://stackoverflow.com/q/20988843
tagged with: report
answer count: 0
type: UnansweredQuestion
type: Question
tagged with: pentaho
tagged with: java
tagged with: eclipse
tagged with: designer
has body: We had developed an application using java-swing. In that application reports are designed using Pentaho Report Designer. In 1280x1024 Resolution Pentaho Report is displayed when running the application. In 1280x800 Resolution Pentaho Report is not displayed when running the application. Please help me to get view the Reports in lower Resolution.
score: 0
has comment: http://stackoverflow.com/comment/31541009
has comment: http://stackoverflow.com/comment/31544499
has title: Pentaho Report is not displayed only in lower resolution?

http://stackoverflow.com/q/20991641
has body: I'm using the Jasper built-in SUM function in a cell of a table. It should sum the content of other cells (in the example I'm using a single cell, but the output is pretty much the same adding multiple cells). The jrxml is: &lt;jr:column width="49" uuid="e6595bc8-b46e-4bbe-85a2-7ea9526fce83"&gt; &lt;property name="local_mesure_unitwidth" value="pixel"/&gt; &lt;jr:columnHeader style="Table 2_CH" height="20"&gt; &lt;staticText&gt; &lt;reportElement x="2" y="0" width="47" height="20" uuid="af5e8305-5cdf-41ad-b827-80f0ca14771c"/&gt; &lt;textElement textAlignment="Center" verticalAlignment="Middle"/&gt; &lt;text&gt;&lt;![CDATA[Nr. Prest.]]&gt;&lt;/text&gt; &lt;/staticText&gt; &lt;/jr:columnHeader&gt; &lt;jr:detailCell style="Table 2_TD" height="30"&gt; &lt;textField&gt; &lt;reportElement x="0" y="0" width="49" height="30" uuid="8cc69012-6972-470a-92f4-e735f8d006d8"/&gt; &lt;textFieldExpression&gt;&lt;![CDATA[SUM($F{1})]]&gt;&lt;/textFieldExpression&gt; &lt;/textField&gt; &lt;/jr:detailCell&gt; &lt;/jr:column&gt; In Jasper Studio is working correctly, but when I try to compile the report using maven plugin or using the JasperCompileManager it returns these errors net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file: 1. The method SUM(Integer) is undefined for the type report1_dataset1_1389172627824_411632 value = SUM(((java.lang.Integer)field_j49.getValue())); //$JR_EXPR_ID=41$ &lt;-&gt; 2. The method SUM(Integer) is undefined for the type report1_dataset1_1389172627824_411632 value = SUM(((java.lang.Integer)field_j49.getOldValue())); //$JR_EXPR_ID=41$ &lt;-&gt; 3. The method SUM(Integer) is undefined for the type report1_dataset1_1389172627824_411632 value = SUM(((java.lang.Integer)field_j49.getValue())); //$JR_EXPR_ID=41$ &lt;-&gt; 3 errors net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:204) net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.j…
has answer: http://stackoverflow.com/a/20995249
has comment: http://stackoverflow.com/comment/31543042
has comment: http://stackoverflow.com/comment/31544169
has comment: http://stackoverflow.com/comment/31543949
tagged with: jasper-reports
has comment: http://stackoverflow.com/comment/31545418
answer count: 3
has answer: http://stackoverflow.com/a/23354672
downvote count: 0
has comment: http://stackoverflow.com/comment/31543750
favorite count: 0
has comment: http://stackoverflow.com/comment/31546476
linked to: http://stackoverflow.com/q/28990505
has comment: http://stackoverflow.com/comment/31549402
upvote count: 3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31544846
type: Question
score: 3
has title: Jasper compiler error when using SUM method
has answer: http://stackoverflow.com/a/20993082
tagged with: java

http://stackoverflow.com/q/20976490
tagged with: drools
has title: Getting Error : SEVERE: Unknown KieSession name: in drool 6.0.0
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33387519
has comment: http://stackoverflow.com/comment/33387518
answer count: 0
has body: I compiled the drool project using ant. I tried to run it with java -cp .:../../lib/* com.myproject.sample.MomAlertApp I am getting an error: SEVERE: Unknown KieSession name: MomAppKs Exception in thread "main" java.lang.NullPointerException at com.myproject.sample.MomAlertApp.testMe(MomAlertApp.java:28) at com.myproject.sample.MomAlertApp.main(MomAlertApp.java:38) As I already set the pom.properties as: groupId=com.myproject artifactId=drool version=0.1 Project Directory: test_project: ----src ---com.myproject.sample ---trigger ---drool ---facts --Person.java ---rules --rule.drl ---META-INF ---kmodule.xml ---maven ---pom.properties ----test ---src ---com.myproject.test ---myProjectTest.java ---lib I do not want to use maven as whole product demand ant build for now. Thanks in advance
type: UnansweredQuestion
tagged with: drools-fusion
upvote count: 1
score: 1
tagged with: ant
tagged with: java
type: Question

http://stackoverflow.com/q/20882927
answer count: 2
upvote count: 1
has title: java.lang.OutOfMemoryError with large Matrix
favorite count: 0
tagged with: heap-memory
tagged with: out-of-memory
type: UnansweredQuestion
has body: I have int K as an input (K will be between 0 and 1000000 (one million), inclusive) and I would like then to create a matrix of integers with height and width 2 times longer than K number, plus 1 element more. Example if K=3, my matrix would be matrix[3*2+1][3*2+1]=matrix[7][7] if K=178754, my matrix would be matrix[357503][357503] I got an java.lang.OutOfMemoryError: Java heap space exception in thread "main" int height; int width; int [][] matrix; public int getKthNumber(int N, int K, String direction) { this.height = (K * 2) + 1; this.width = (K * 2) + 1; ****matrix = new int[this.width][this.height];**** // error here Does anyone knows how to solve this little problem since I believe that the whole other code is OK ??
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20883033
type: Question
has answer: http://stackoverflow.com/a/20882990

http://stackoverflow.com/comment/31315678
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20870679
has text: Always copy/paste error & exception output.

http://stackoverflow.com/comment/31527797
score: 0
type: Comment
has text: Thanks for answer, but it didnt work. Still, when I type different letters, the rest stays in the same place.
comment on: http://stackoverflow.com/a/20982323
type: AnswerComment

http://stackoverflow.com/comment/31345679
score: 0
has text: I believe you mean CREATE TABLE newest_user and not CREATE_PROCEDURE newest_user ?
comment on: http://stackoverflow.com/q/20886851
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31486610
type: AnswerComment
has text: Thanks. What you said made sense. I change ptrn2 = Pattern.compile ("//b.*//b/t"); and still when I test it with the statement: println(matcher2.matches()); I get "false" as a result for every string ending with tab. I still don't know why I should get false even with the previous pattern I used.
type: Comment
comment on: http://stackoverflow.com/a/20960592
score: 0

http://stackoverflow.com/a/20937115
score: 0
has comment: http://stackoverflow.com/comment/31543032
type: Answer
answers question: http://stackoverflow.com/q/20932107
has comment: http://stackoverflow.com/comment/31543774
has body: See this for Offline installation options: http://www.oracle.com/technetwork/java/javase/install-windows-141940.html Then adjust command line for executing jre/jdk installer from NSIS script. Good luck. Report back your progress, if you may. Thanks.

http://stackoverflow.com/comment/31523628
score: 0
type: AnswerComment
type: Comment
has text: @an Roberts :the code was running sucessfully for long and it ended up with some exception saying com.google.gson.JsonIOException: java.io.IOException: Premature EOF
comment on: http://stackoverflow.com/a/20960237

http://stackoverflow.com/a/20879118
has comment: http://stackoverflow.com/comment/31331482
score: 0
type: Answer
has body: In C++ the array references are const pointers but in Java they are neither pointers nor implicitly constant.
upvote count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/31331449
answers question: http://stackoverflow.com/q/20879108

http://stackoverflow.com/comment/31277688
score: 0
comment on: http://stackoverflow.com/q/20850591
type: Comment
type: QuestionComment
has text: Can you try to compile the java code in console, instead of using NetBeans? If it works in console, then this is a NetBeans configuration issue.

http://stackoverflow.com/comment/31293583
score: 0
type: Comment
type: QuestionComment
has text: it wasn't clear for me that "((class)obj).method()" and "class.obj.method" are intended for different things. i now know that i need a deeper understanding of typecasting. thanks!
comment on: http://stackoverflow.com/q/20859104

http://stackoverflow.com/a/21000833
has comment: http://stackoverflow.com/comment/31565068
upvote count: 3
has comment: http://stackoverflow.com/comment/31565554
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31564320
has body: If not logged in then redirect to LOGIN result. Then you should rewrite your interceptor something like public final String intercept(final ActionInvocation invocation) throws Exception { // before save original url Map session = invocation.getInvocationContext().getSession(); Object action = invocation.getAction(); if (!(action instanceof LoginAction)){ String queryString = request.getQueryString(); session.put("savedUrl", request.getRequestURI()+(queryString==null?"":("?"+queryString))); } else { return invocation.invoke(); } if (!processLogin(request, session)) { //return false if not authenticated session.put("isLogin", true); return Action.LOGIN; } else { savedUrl = (String) session.get("savedUrl"); boolean isLogin = (boolean)session.get("isLogin"); if (!StringUtils.isEmpty(savedUrl) &amp;&amp; isLogin) { session.put("isLogin", false); return "redirect"; } return invocation.invoke(); } }
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20993574
answers question: http://stackoverflow.com/q/20993574
score: 3

http://stackoverflow.com/comment/31423594
score: 0
type: Comment
has text: @ZouZou, I completely agree. I just was not sure if there was any other reasoning behind it.
comment on: http://stackoverflow.com/a/20927846
type: AnswerComment

http://stackoverflow.com/comment/31559574
has text: Have you taken a look at AsyncTask? It was built for things like this. If you are worried about allocating too many threads then you can create a thread-pool using the Executor classes.
comment on: http://stackoverflow.com/q/20973276
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/20946862
has title: Terminating a Java program without exit Matlab?
has comment: http://stackoverflow.com/comment/31459378
linked to: http://stackoverflow.com/q/12473083
accepted answer: http://stackoverflow.com/a/20953936
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31471102
has answer: http://stackoverflow.com/a/20953936
has comment: http://stackoverflow.com/comment/31460278
has comment: http://stackoverflow.com/comment/31460240
has comment: http://stackoverflow.com/comment/31459922
has comment: http://stackoverflow.com/comment/31459496
downvote count: 0
has body: So recently I have been working on a Java applet that will be executed from Matlab (Since matlab is an easy way to handle and parse large arrays). I have a problem in this context. In my Java program i usually handle exceptions and other mistakes by following: System.err.println("WARNING: [SOME ERROR MESSEAGE GOES HERE]"); System.exit(-1); What I seek is to receive the error message in Matlab and shutdown the Java applet. The problem is that the System.exit(-1) statements terminate both Matlab and Java and hence brings me back to my desktop. Do any of you have any recommendation on how to only shut down my Java applet and hereby remain Matlab open so that the user receives the error message.
has comment: http://stackoverflow.com/comment/31459936
tagged with: error-handling
tagged with: matlab
type: Question
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/31464659
tagged with: java

http://stackoverflow.com/a/20860588
downvote count: 0
upvote count: 8
has body: Replace all existing content with new content. new FileWriter(file); Keep the existing content and append the new content in the end of the file. new FileWriter(file,true); Example: FileWriter fileWritter = new FileWriter(file.getName(),true); BufferedWriter bufferWritter = new BufferedWriter(fileWritter); bufferWritter.write(data); bufferWritter.close();
answers question: http://stackoverflow.com/q/20860543
type: Answer
score: 8

http://stackoverflow.com/a/20934581
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20934491
type: Answer
accepted answer of: http://stackoverflow.com/q/20934491
score: 1
upvote count: 1
has body: You return null in getview. You should return a view instead Also i would suggest you parse you json before and add it to a list. pass the list to the constructor of adapter class. Your super(context, layoutResourceId); is wrong List&lt;type&gt; list public ContactArrayAdapter(Context context, int layoutResourceId, List&lt;type&gt; Contact, String bgColor,Typeface font) { super(context, layoutResourceId,Contact); this.list =Contact; this.bgColor = bgColor; myTypeFace = font; Log.v("CAA", " 1 = "); } Then use a ViewHolder Pattern public View getView(int position, View convertView, ViewGroup parent){ ViewHolder holder; if (convertView == null) { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.document_cell,parent,false); holder = new ViewHolder(); holder.docTitle = (TextView) v.findViewById(R.id.name); holder.docType = (TextView) v.findViewById(R.id.doctype); holder.docMod = (TextView) v.findViewById(R.id.modified); holder.docImage = (ImageView) v.findViewById(R.id.docicon); convertView.setTag(holder); } else { holder =(ViewHolder) convertView.getTag(); } // with list update ui here holder.docTitle.setTypeface(myTypeFace); holder.docTitle.setTextColor(Color.parseColor(bgColor)); holder.docType.setTypeface(myTypeFace); holder.docMod.setTypeface(myTypeFace); return convertView; } static class ViewHolder { TextView docTitle,docStyle,docType,docMod; ImageView docImage; }
has comment: http://stackoverflow.com/comment/31437994

http://stackoverflow.com/a/20855700
has comment: http://stackoverflow.com/comment/31286455
has body: You may not able to access folders in remote machine directly due to permission issues.
answers question: http://stackoverflow.com/q/20855677
score: 0
type: Answer

http://stackoverflow.com/comment/31602376
comment on: http://stackoverflow.com/a/21008502
score: 0
has text: Hopefully so. Else that will be really difficult to understand what is going on.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/20915217
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20914415
accepted answer of: http://stackoverflow.com/q/20914415
has body: Your instinct is correct - there are indeed opportunities for thread-based issues here: HashMap&lt;String,String&gt; map = null; ... // add some entries to the hash map ArrayList&lt;String&gt; info = Toolbox.extractInformation(map); If you meant: HashMap&lt;String,Object&gt; map = new HashMap&lt;String,Object&gt;(); ... // add some entries to the hash map ArrayList&lt;String&gt; info = Toolbox.extractInformation(map); in which case so long as you don't add the same object to the map in the two ... // add some entries to the hash map sections in the two threads then you're good. static final Object anObject = new Object(); ... HashMap&lt;String,Object&gt; map = new HashMap&lt;String,Object&gt;(); // Share anObject in many threads. map.put(anObject); ... // add some entries to the hash map ArrayList&lt;String&gt; info = Toolbox.extractInformation(map); However - since you are using String: HashMap&lt;String,String&gt; map = new HashMap&lt;String,String&gt;(); ... // add some entries to the hash map ArrayList&lt;String&gt; info = Toolbox.extractInformation(map); you should be safe from threading issues - except in very rare circumstances.
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/31401582

http://stackoverflow.com/a/20860390
score: 4
upvote count: 4
has body: You add it in paint, everytime you are updating you are applying a new Paint which should specify the textSize. Think of a typeface more of a font/set of characters. The Android documentation states: The Typeface class specifies the typeface and intrinsic style of a font. This is used in the paint, along with optionally Paint settings like textSize, textSkewX, textScaleX to specify how text appears when drawn (and measured). After reading this, I would suggest the following to be done. (Not sure if this would do what you want. But let me know) @Override public void updateMeasureState(TextPaint p) { p.setTypeface(mTypeface); // Note: This flag is required for proper typeface rendering p.setFlags(p.getFlags() | Paint.SUBPIXEL_TEXT_FLAG); p.setTextSize(25);//or what ever size you want } @Override public void updateDrawState(TextPaint tp) { tp.setTypeface(mTypeface); // Note: This flag is required for proper typeface rendering tp.setFlags(tp.getFlags() | Paint.SUBPIXEL_TEXT_FLAG); tp.setTextSize(25);//or what ever size you want }
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20859695
type: Answer
accepted answer of: http://stackoverflow.com/q/20859695

http://stackoverflow.com/a/20960592
score: 1
has comment: http://stackoverflow.com/comment/31509510
upvote count: 1
has comment: http://stackoverflow.com/comment/31509611
has comment: http://stackoverflow.com/comment/31486610
downvote count: 0
answers question: http://stackoverflow.com/q/20960386
has comment: http://stackoverflow.com/comment/31486254
has comment: http://stackoverflow.com/comment/31513047
has body: The pattern "\\s.*\\t" must match a single whitespace character (\s) followed by 0 or more characters (.*) followed by a single tab (\t). If you want to capture the last word and a trailing tab you should use the word boundary escape \b Pattern.compile("\\b.*\\b\t"); You could replace the . above to use \w or whatever your definition of a word character is if you don't want to match any character. Here's the code you'd use to match any word immediately before a tab: import java.util.regex.Matcher; import java.util.regex.Pattern; public class RegEx { public static void main(String args[]) { String text = "ab cd\t ef gh\t ij"; Pattern pattern = Pattern.compile("\\b(\\w+)\\b\t", Pattern.DOTALL); Matcher matcher = pattern.matcher(text); while (matcher.find()) { System.out.println(matcher.group(1)); } } } The above will output cd gh See the Regular Expression Tutorial, especially the sections on Predefined Character Classes and Boundary Matchers for more information. You can get more detail and experiment with this regular expression on Regex101.
type: Answer

http://stackoverflow.com/a/20871234
accepted answer of: http://stackoverflow.com/q/20870369
has comment: http://stackoverflow.com/comment/46984206
downvote count: 0
has comment: http://stackoverflow.com/comment/42821378
has body: public class TestHB4 { private static StandardServiceRegistry serviceRegistry; private static SessionFactory sessionFactory; public static void main(String[] args) { Person person = new Person(); person.setFirstName("Namal"); person.setLastName("Dinesh"); Configuration configuration = new Configuration().configure(); serviceRegistry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build(); sessionFactory = configuration.configure().buildSessionFactory(serviceRegistry); Session session = sessionFactory.openSession(); session.beginTransaction(); session.save(person); session.getTransaction().commit(); session.close(); }
has comment: http://stackoverflow.com/comment/36362542
upvote count: 8
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/20870369
score: 8

http://stackoverflow.com/comment/31525604
type: Comment
score: 2
comment on: http://stackoverflow.com/a/20967178
has text: That won't work with liquibase, because it does its own class scanning and requires a specific interface implementation to be in a specific package. See the other answer for more information.
type: AnswerComment

http://stackoverflow.com/a/20906671
type: Answer
has comment: http://stackoverflow.com/comment/31382698
score: 4
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/20906564
has body: The reason for this is that you are using a character class. Inside a character class, the order of characters does not really matter except if you're dealing with character ranges. So, [^br|^b|^i|^div|^strong] actually will match any character except those: bridvstrong|^ [Note that | and ^ are there too]. You could have used [^bridvstrong|^] and it would behave the same way. You might instead look into negative lookaheads.

http://stackoverflow.com/comment/31577222
type: QuestionComment
comment on: http://stackoverflow.com/q/21008837
has text: No, how does that work?
score: 0
type: Comment

http://stackoverflow.com/comment/31414341
comment on: http://stackoverflow.com/a/20923138
score: 0
type: AnswerComment
has text: Why do you need to implement your own list?
type: Comment

http://stackoverflow.com/comment/31443254
score: 0
has text: i have edited the code. this is the full code. I want the size of list which i need to use further in my code
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20937969

http://stackoverflow.com/a/50416069
answers question: http://stackoverflow.com/q/20969398
has body: Google Map Provides map snapshot option mRouteMap.snapshot(new GoogleMap.SnapshotReadyCallback() { @Override public void onSnapshotReady(Bitmap bitmap) { } });
score: 0
type: Answer

http://stackoverflow.com/comment/31580879
comment on: http://stackoverflow.com/a/21011709
type: Comment
has text: @Raghunandan yes dude, I have done in previous a little mistake. So I have been edited the full answer. It is the solved code. Thanks for your that correction.
score: 0
type: AnswerComment

http://stackoverflow.com/a/22621583
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21012781
type: Answer
has comment: http://stackoverflow.com/comment/34599259
has body: To do this, you would have your process create a job for the media file after the S3 uploads is complete: http://docs.aws.amazon.com/elastictranscoder/latest/developerguide/create-job.html You should have a pre-defined pipeline you're using to create the job. With regards to the output key/prefix, you should specify the prefix/"directory" as the output prefix, with all other output paths as relative to the output prefix you specify. An example of setting output prefix/paths can be found here: http://docs.aws.amazon.com/elastictranscoder/latest/developerguide/create-job.html#create-job-request-outputs
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/34626961
answers question: http://stackoverflow.com/q/21012781
type: AcceptedAnswer

http://stackoverflow.com/a/20884978
score: 0
answers question: http://stackoverflow.com/q/20884909
type: Answer
has body: This sounds familiar to me :P Try asking your operators if they have some automated 'cleansing' operation that just kills periodically open database connections automatically in order to prevent leaked connections to the database.

http://stackoverflow.com/comment/31554552
has text: that's what I found at Oracle web site
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20998122

http://stackoverflow.com/comment/31307047
has text: @Shayanpourvatan I tried adding `refreshingThread().unpause()` into `onResume()` just now, and the behaviour is the same.
type: QuestionComment
comment on: http://stackoverflow.com/q/20866021
score: 0
type: Comment

http://stackoverflow.com/q/20876336
type: Question
tagged with: video-streaming
upvote count: 0
has title: Customize Video Before Streaming
answer count: 1
has answer: http://stackoverflow.com/a/20877911
favorite count: 0
has body: I have encountered a very strange situation. I want to Customize Video by applying filters on it , Like if i want to Add Some Text or Lighting on the video and then stream it. So what approach do i take Get Raw VIDEO --> Compress --> Modify --> Encode Using H.264 --> Stream or Get Raw VIDEO --> Modify --> Compress --> Encode Using H.264 --> Stream I am using Java and some natives in my project. Currently i can video call but not able to Modify Video. Update 1 What did i ask wrong , someone down vote this question , may i know why ? Thanks
tagged with: video-processing
type: UnansweredQuestion
downvote count: 1
tagged with: video
tagged with: java
score: -1

http://stackoverflow.com/comment/31335551
type: Comment
has text: its same as i mention in the question. 2013-12-31T15:07:38.6875000-05:00
comment on: http://stackoverflow.com/a/20881303
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31398768
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20914680
has text: Sorry, but this answer does not help me in any way. What solution are you proposing?
score: 0

http://stackoverflow.com/a/20902554
has body: It sounds like you are wanting to use a cursor over your query results, generate a temporary table, and then select the contents of that temporary table to return from your stored procedure. You should be able to find plenty of examples online for cursors and temporary tables.
answers question: http://stackoverflow.com/q/20902455
score: 0
type: Answer

http://stackoverflow.com/a/20952235
type: Answer
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/20952160
answers question: http://stackoverflow.com/q/20952160
downvote count: 0
has body: You must invoke Field.get() with the TestMe object. TestMe obj = new TestMe(); .... Map&lt;String, SomeObject&gt; refMap = (HashMap&lt;String, SomeObject&gt;) = field.get(obj); Your code invokes Field.get() on a new instance of HashMap. field.get(new HashMap&lt;String, Object&gt;()); // This will not work in your case EDIT to comment: This is not working. I tried to figure out what could not be working. This is my test code and it works. public class TestMeTester { public static class TestMe { private Map&lt;String, String&gt; testMap = new HashMap&lt;String, String&gt;(); } public static void main(String[] args) throws IllegalArgumentException, IllegalAccessException, SecurityException, NoSuchFieldException { TestMe obj = new TestMe(); Class clazz = obj.getClass(); Field field = clazz.getDeclaredField("testMap"); field.setAccessible(true); Map&lt;String, String&gt; refMap = (HashMap&lt;String, String&gt;) field.get(obj); System.out.println("==&gt;" + refMap); } }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31471358

http://stackoverflow.com/comment/31347490
has text: Boolean (with uppercase B) is an Object wrapper around boolean. And so it can be null. I'll edit the code to add a Null Check.
comment on: http://stackoverflow.com/a/20886338
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/20944860
tagged with: struts-action
downvote count: 0
tagged with: struts2
has comment: http://stackoverflow.com/comment/31457202
tagged with: struts2-interceptors
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/20950645
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31457143
tagged with: url-parameters
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/31465883
has body: class SampleAction extends ActionSupport { private Map<String,String> circleIdNameMap; public String preprocess(){ --logic for populating value of MAP } --getters and setters } My problem is: when the page is loading, I call preprocess() function and populate the value of Map. After the page is submitted, another method is called, and during that, after some DB interaction, it redirects to JSP, but this time the value of Map is empty. I am using this Map for dropdown tag in Struts 2. My preprocess() is associated in the link like: href="/gma/preprocessConfigureTspThreshold?operatorId=5102&sessionId=12332"‌`​ So, only first time when the link is clicked the preprocess() is called, after that, when I redirect to my JSP, so it's not called then, the second time the value of Map is empty. Shall I put the map in a session, so that it will be retained? Or can do something else? I read that I shouldn't use preprocess() function, and use a Preparable interface instrad. But as per docs: The prepare() method will always be called by the Struts 2 framework's prepare interceptor whenever any method is called for the Action class. So, it will be called for every method. I want preprocess() to be called only when page loads.
has comment: http://stackoverflow.com/comment/31456174
type: Question
has title: How to prepare values of action variables in Struts 2?

http://stackoverflow.com/a/20907796
type: Answer
upvote count: 2
score: 2
has body: You have to use support library and code will something look like this: import android.support.v7.app.ActionBar public class YourActivity extends ActionBarActivity { ActionBar actionBar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); actionBar = getSupportActionBar(); // now do whatever you want to do with this action bar } @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) { switch (item.getItemId()) { case android.R.id.home: // code for your action when you click home icon on action bar break; default: break; } return true; } }
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20907438
answers question: http://stackoverflow.com/q/20907438

http://stackoverflow.com/q/20952193
score: 0
tagged with: colors
tagged with: android
downvote count: 1
accepted answer: http://stackoverflow.com/a/20956329
type: AnsweredQuestion
tagged with: internal
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20956329
linked to: http://stackoverflow.com/q/2353211
has body: i have got a simple color int like 0x8833aacc if i now use Color.colorToHSV to create HSV value of it, and then use Color.HSVToColor to get the int back, it is slightly different! the red value decreases by 1 but it does this not everytime, e.g. when using 0x8830aacc everythings ok, why? my example code to show this: final float[] current_hsv = new float[3]; float current_alpha = 1.0f; private int GetColor() { return Color.HSVToColor((int)(current_alpha * 255.0f), current_hsv); } private void SetColor(int color) { Color.colorToHSV(color, current_hsv); current_alpha = (float)Color.alpha(color) / 255.0f; } private void Test() { int color = 0x8833aacc; SetColor(color); int g = GetColor(); //convert to hex, you'll see the red value decreased by 1!!! Log.i("Test", "color: " + String.format("%08x", color) + " got color: " + String.format("%08x", g)); } how can i fix that?
upvote count: 1
has title: android Color class - strange behavior, internal rounding error?
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/31345570
type: Comment
type: QuestionComment
has text: @Duncan What do you mean by "not duplicates"? It is true that question subject is about breaking loop, but problem is in way OP compares strings. Also question is not about how to create infinite loop. Improving this part is optionally and can be done via comment.
comment on: http://stackoverflow.com/q/20886727
score: 0

http://stackoverflow.com/q/20982781
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/20983154
has title: Java/Selenium - how to eliminate white space before using assertequals
has body: I have a dropdown with multiple options. I want to get all of the available options in the dropdown, and then compare it with a list of values that I expect to be in there. Here is the HTML for the dropdown. Please Select... DEP900 DEP800 DEP700 DEP600 DEP400 DEP300 DEP200 DEP100 DEP500 DEP1000 I am using the below code to get all the text values in the dropdown, and then compare with what I expect the values to be. List<Element> options = driver.getElements(AppObjects.Basic1_Dropdown); for(Element opt : options){ String actualtext = opt.getText(); @SuppressWarnings("rawtypes") List listA = Arrays.asList("Please Select...", "DEP900", "DEP800", "DEP700", "DEP600", "DEP400", "DEP300", "DEP200", "DEP100", "DEP500", "DEP1000"); Assert.assertEquals(actualtext, listA); } This test fails for me because the returned text is on a different line. I get an error saying the actual text is (without the dashes): - DEP900 - DEP800 - DEP700 - DEP600 - DEP400 - DEP300 - DEP200 - DEP100 - DEP500 - DEP1000 but the expected text was DEP900, DEP800, DEP700, DEP600, DEP400, DEP300, DEP200, DEP100, DEP500, DEP1000 How can I change my code so that the expected text matches the actual text. Do I need to remove spaces from the actualtext variable, or add them to listA? I've also tried changing list A to below. I'm still not getting the actual and expected text to match, even though the actual and expected text in my error message look the same. List listA = Arrays.asList("Please Select... \nDEP900 \nDEP800 \nDEP700 \nDEP600 \nDEP400 \nDEP300 \nDEP200 \nDEP100 \nDEP500 \nDEP1000");
accepted answer: http://stackoverflow.com/a/20983154
possible better answer: http://stackoverflow.com/a/20983954
tagged with: selenium
has answer: http://stackoverflow.com/a/20983954

http://stackoverflow.com/q/20925481
has comment: http://stackoverflow.com/comment/31418637
has comment: http://stackoverflow.com/comment/31418608
score: 1
tagged with: java
has title: java.util.AbstractList$Itr.checkForComodification Error
upvote count: 1
has body: Whenever I try to remove one of my entities, the game gives me this error and I'm not sure why. This is the method that creates the error: public void render (Screen screen) { int xTile = 11; int yTile = 0; int scale = 1; screen.render (x, y, xTile + yTile * 32, colour, 0, scale); if (level.player != null) { int xd = level.player.x - x; int yd = level.player.y - y; if (xd * xd + yd * yd &lt; 8 * 8) { Font.render("Pick up", screen, x - 18, y - 17, Colours.get(-1, -1, -1, 555), 1); if (item == true) { Font.render("It's true!", screen, x - 18, y - 17, Colours.get(-1, -1, -1, 555), 1); level.removeEntity(this); } } } } This is the removeEntity method: public void removeEntity(Entity entity) { entities.remove(entity); }
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/20925518
accepted answer: http://stackoverflow.com/a/20925518
has comment: http://stackoverflow.com/comment/31418671
has comment: http://stackoverflow.com/comment/31418742
type: AnsweredQuestion
downvote count: 0
type: Question

http://stackoverflow.com/comment/31478200
type: AnswerComment
has text: can you please tell me which is the java version affected by this - this is what interests me the most right now...
type: Comment
score: 1
comment on: http://stackoverflow.com/a/20956837

http://stackoverflow.com/a/20951752
has body: Provided you app contains only Main and xml file which configures Camel's context then context will be destroyed (so your routes destroyed as well). Even if different context run JMS implementation on same JVM. Sergey link should help you. If you want just make it work to test things, add while(true) as a last line of your main. Note this is not the best approach :).
answers question: http://stackoverflow.com/q/20949079
upvote count: 1
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31469508
score: 1
has comment: http://stackoverflow.com/comment/31470011

http://stackoverflow.com/comment/31464930
type: Comment
comment on: http://stackoverflow.com/a/20949810
has text: do i have to create a new class for this imageloader?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31402245
comment on: http://stackoverflow.com/q/20897464
has text: Concatenating two `.avi`s may not result in expected results. There is extra data that you might not be considering for, just saying: [AVI File Format](http://www.alexander-noe.com/video/documentation/avi.pdf)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20853367
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20853348
has body: First Jsp : Set Value in First Page request.setAttribute("name",somevalue); Second Jsp : Retrieve it in Second page request.getAttribute("name")
has comment: http://stackoverflow.com/comment/31282574
has comment: http://stackoverflow.com/comment/31282445
has comment: http://stackoverflow.com/comment/31282361
has comment: http://stackoverflow.com/comment/31282538

http://stackoverflow.com/comment/31407391
score: 0
type: AnswerComment
has text: @MarkoTopolnik _signs of efforts_ indeed - makes me wonder (fruitless, but then ..) whether the effort isn't 100% succesful or they simply forgot to mark it as thread-safe?
type: Comment
comment on: http://stackoverflow.com/a/20908679

http://stackoverflow.com/comment/31557530
has text: CSVReader reader = new CSVReader(new FileReader(file), ',', '\'', 1); - this worked as expected. Can you please explain what is '\'' means? ================================================================= I have also tried to use list.remove(0). But it gives empty csv as output. for (Object object : list) { CSVData csvdataBean = (CSVData) object; System.out.println("inside List object" + csvdataBean.getTransferDate()); =----- It returns null value when I use list.remove(0) } Thanks
type: Comment
comment on: http://stackoverflow.com/a/20998838
score: 0
type: AnswerComment

http://stackoverflow.com/q/20983447
tagged with: java
tagged with: hibernate
upvote count: 4
answer count: 1
downvote count: 0
score: 4
favorite count: 0
has answer: http://stackoverflow.com/a/20985128
has body: I have a Doctor entity. Each doctor has a list of HealthInsurance which is another entity. My goal is to make a search system based on the HealthInsurance's the user select. I have to get all doctors that has at least 1 HealthInsurance contained in the user health insurance's list. Something like this: Criteria criteria = session.createCriteria(Doctor.class); criteria.add(Restrictions.in("healthInsurances", userHealthInsurances)); return criteria.list(); But this code is throwing the following exception: java.sql.SQLException: No value specified for parameter 1. Is there any way of doing this using Criteria?
has title: Hibernate: filter by list using criteria
accepted answer: http://stackoverflow.com/a/20985128
type: Question
type: AnsweredQuestion
tagged with: criteria

http://stackoverflow.com/tag/csv
type: Tag
tags question: http://stackoverflow.com/q/20887541
tags question: http://stackoverflow.com/q/20885149
tags question: http://stackoverflow.com/q/20856823
tags question: http://stackoverflow.com/q/20972109
tag name: csv
tags question: http://stackoverflow.com/q/20964466
tags question: http://stackoverflow.com/q/20923583
tags question: http://stackoverflow.com/q/20922553
tags question: http://stackoverflow.com/q/20988317
tags question: http://stackoverflow.com/q/20976683
tags question: http://stackoverflow.com/q/21005120
tags question: http://stackoverflow.com/q/20921589
tags question: http://stackoverflow.com/q/20905509
tags question: http://stackoverflow.com/q/21007485
tags question: http://stackoverflow.com/q/20993123
tags question: http://stackoverflow.com/q/20932470
tags question: http://stackoverflow.com/q/20908698

http://stackoverflow.com/a/20937113
has comment: http://stackoverflow.com/comment/31442039
has comment: http://stackoverflow.com/comment/31441645
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20937055
has body: You said you modified FlowNetwork's source, so you can do the following which will result in more robust design, and easier testablity: Encapsulate those two variables (i.e. private int sinkIndex and int getSinkIndex()) expect(mockNetwork.getSinkIndex()).andReturn(0).anyTimes(); Guess: mockNetwork.getClass() is returning a cglib EasyMock proxy which has no state (i.e. no fields), you can check it in the debugger. Hence getDeclaredField() is returning null. If you really want to use publics, you can try FlowNetwork.class.getDeclaredField instead.
answers question: http://stackoverflow.com/q/20937055
has comment: http://stackoverflow.com/comment/31441428
has comment: http://stackoverflow.com/comment/31441293
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/31442277

http://stackoverflow.com/q/20978739
answer count: 3
has comment: http://stackoverflow.com/comment/31525531
downvote count: 0
has title: How does Spring Data (JPA) relate to JPA persistence providers?
favorite count: 0
upvote count: 8
type: Question
has answer: http://stackoverflow.com/a/20978930
tagged with: spring
has answer: http://stackoverflow.com/a/49287834
has body: I'm trying to wrap my head around JPA and have learned quite a bit. JPA is a java specification and providers implement this spec. I Understand that part. What I don't understand is how Spring Data comes into the picture. Is Spring Data also a provider like Hibernate or OpenJPA? If not, what is it? How does Spring Data "make things easier"?
has answer: http://stackoverflow.com/a/21002625
tagged with: java
has comment: http://stackoverflow.com/comment/31520085
has comment: http://stackoverflow.com/comment/31524799
tagged with: spring-data
score: 8
tagged with: jpa
type: UnansweredQuestion
tagged with: spring-data-jpa
has comment: http://stackoverflow.com/comment/31521933

http://stackoverflow.com/a/20935106
score: 3
answers question: http://stackoverflow.com/q/20935058
upvote count: 3
has body: In your doInBackground method, you're adding two times the latitude in the latitude list, and just one time the longitude in the longitude list. latitudeList.add(latitude); longitude = coordinates.getString(1); Log.d("longitude: ", "&gt; " + longitude); latitudeList.add(latitude); //&lt;-- here why adding another time ? And after you're doing : latList = latitudeList; longList = longitudeList; I highly suspect that the latList is twice longer than the longList, and hence the IndexOutOfBoundsException in the line thelongtitude = longList.get(i); because you're looping from 0 to latList.size()(which is twice bigger than longList.size()). Remove one latitudeList.add(latitude); and that should work.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20935058
type: Answer
has comment: http://stackoverflow.com/comment/31437146

atomicinteger
tag name: atomicinteger
tags question: http://stackoverflow.com/q/20891176
type: Tag

classnotfoundexception
tags question: http://stackoverflow.com/q/20963550
tags question: http://stackoverflow.com/q/20912328
type: Tag
tags question: http://stackoverflow.com/q/20980946
tags question: http://stackoverflow.com/q/20972947
tags question: http://stackoverflow.com/q/20872563
tag name: classnotfoundexception
tags question: http://stackoverflow.com/q/20892921
tags question: http://stackoverflow.com/q/21001486
tags question: http://stackoverflow.com/q/20988254

http://stackoverflow.com/q/20981029
type: Question
has body: What I'm wanting to do is use the user's input to determine the size of a matrix, then create the appropriate amount of edit texts for them to fill out the elements. I think I know how to add in new edit texts dynamically, but I don't know how to address them, because they have no id since they are being made dynamically.
has title: How to dynamically add and use edit texts in android?
has answer: http://stackoverflow.com/a/20981096
has comment: http://stackoverflow.com/comment/31524171
score: 0
has comment: http://stackoverflow.com/comment/31524145
answer count: 1
type: UnansweredQuestion
tagged with: android
tagged with: java

http://stackoverflow.com/comment/31603055
has text: And how would I give the `Document doc` to the transformer?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21008413
type: Comment

http://stackoverflow.com/comment/31344171
comment on: http://stackoverflow.com/a/20886274
type: Comment
has text: It could be due to a lot of things. Note that any answer for which the only sentence is a question, is not a good candidate as an answer at all.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/31422456
has text: What do you think this `sum.doubleValue()` does?
comment on: http://stackoverflow.com/q/20927374
type: Comment
type: QuestionComment
score: 4

http://stackoverflow.com/q/20945486
tagged with: wicket
favorite count: 0
has body: I'm a new Guice user, having been a long-time user of Spring IoC. I have a number of @Singleton classes for my service tier, which I understand is roughly equivalent to Spring's default bean scope. However, when I am using @Inject in my Wicket pages a CGLib proxy of the target objects is created each time the page is constructed, thus creating new instances of my supposed-singletons. Note that I'm injecting concrete classes, not interfaces. How can I use @Inject and retrieve the single singleton instance of my Guice-injected objects? Updated: Solution as per Sven's accepted answer Inject interfaces in Wicket components rather than concrete classes. Despite much discussion on the subject in the linked thread, this appear to be the only practical solution.
downvote count: 0
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/20950509
has title: How to stop Wicket creating multiple instances of Guice-injected singletons?
tagged with: guice
answer count: 1
has answer: http://stackoverflow.com/a/20950509
upvote count: 1
tagged with: singleton

http://stackoverflow.com/comment/31538536
comment on: http://stackoverflow.com/a/20987385
has text: @ Gaurav katkamwar Getting this while setting the user settings in Window->preferences->maven->user settings Unable to parse user settings file; Non-parseable settings C:\Program Files\maven\conf\sett...G seen ...on in this list marked as active will be used.\n |-->\n <proxies>... @104:12
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31359275
has text: Sorry, meant edittext
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20891558
score: 0

http://stackoverflow.com/comment/31616493
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21013281
score: 0
has text: Are you counting empty string "" as whitespace? Because it isn't.

http://stackoverflow.com/q/20915277
tagged with: garbage-collection
score: 2
has answer: http://stackoverflow.com/a/20915354
tagged with: linked-list
tagged with: java
has title: Garbage Collection in 2.1 Cracking the Coding Interview
has answer: http://stackoverflow.com/a/20915330
has body: For this block of code (solution for 2.1 in Cracking the Coding Interview): when you do prev.next = n.next, would n get collected by garbage collector? Then how can you do n = n.next? The 2.1 question is: write code to remove duplicates from an unsorted linked list. Can someone explain to me how garbage collector works in this case? public static void removeDup (LinkedListNode del) { LinkedListNode prev = null; Hashtable myTable = new Hashtable(); while(del!= null) { // table does not have the key yet if (myTable.containsKey(del.data) == false) { myTable.put(del.data, true); prev = del; } // table has the duplicate else { prev.next = del.next; } del = del.next; } }
type: Question
has answer: http://stackoverflow.com/a/20915868
has answer: http://stackoverflow.com/a/20915344
has comment: http://stackoverflow.com/comment/31400454
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31400360
answer count: 4
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/a/23918813
type: Answer
has body: For anyone else that find this question, another possible problem is caused by your eclipse .classpath file. I needed to change this: <attribute name="owner.project.facets" value="java"/> to this:
score: 0
answers question: http://stackoverflow.com/q/20968507

http://stackoverflow.com/a/21039435
accepted answer of: http://stackoverflow.com/q/21014784
type: AcceptedAnswer
type: Answer
has body: I finally found what was blocking: there is a security option in Safari to indicate that the Java plugin can run in unsafe mode for a given server. Activating this solved my issue.
answers question: http://stackoverflow.com/q/21014784
score: 0

http://stackoverflow.com/q/21013726
has comment: http://stackoverflow.com/comment/31585765
has answer: http://stackoverflow.com/a/21015239
tagged with: java
has comment: http://stackoverflow.com/comment/31584473
has comment: http://stackoverflow.com/comment/31584384
score: -1
has comment: http://stackoverflow.com/comment/31584079
tagged with: alphabet
has comment: http://stackoverflow.com/comment/31584335
type: Question
has answer: http://stackoverflow.com/a/21014093
possible better answer: http://stackoverflow.com/a/21014030
has body: I came across a post showing how to arrange char array by alphabet order. seeing this can be done, I want to output the alphabetical order of each character of the input string, in order of the characters of the input string. I'm a bit stuck. I can get the string reordered alphabetically, but I don't know what to do next. example is 'monkey' to '354216' because 'ekmnoy' e is alphabetically first from the set of given characters so e = 1 , k is the second alpha char when sorted so k = 2, and so on. if you cannot understand I can provide more example to make things clear out. Code String str = "airport"; Character[] chars = new Character[str.length()]; for (int z = 0; z &lt; chars.length; z++) { chars[z] = str.charAt(z); } Arrays.sort(chars, new Comparator&lt;Character&gt;() { public int compare(Character c1, Character c2) { int cmp = Character.compare( Character.toLowerCase(c1.charValue()), Character.toLowerCase(c2.charValue())); if (cmp != 0) { return cmp; } return Character.compare(c1.charValue(), c2.charValue()); } }); StringBuilder sb = new StringBuilder(chars.length); for (char c : chars) { sb.append(c); } str = sb.toString(); System.out.println(sb); Output aioprrt expected output Orange -&gt; aegnOr 561432 - 123456 Monkey -&gt; ekMnoy 354216 -&gt; 123456
upvote count: 0
has answer: http://stackoverflow.com/a/21014030
accepted answer: http://stackoverflow.com/a/21014093
has comment: http://stackoverflow.com/comment/31585629
has comment: http://stackoverflow.com/comment/31586097
favorite count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/31584216
has title: Arrange char array in sequence
has comment: http://stackoverflow.com/comment/31584105
downvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/q/20883687
has body: I try to use session replication between 2 local instances (on same cluster, same node), using glassfish 4. I followed some tutorials and added following input in my web.xml file : I also checked "availability" enabled when deploying war file on my target (the cluster). My application is based on Spring + JSF2 (@ManagedBeans from javax.faces.bean). (Mojarra 2.2.4, which I also override from original javax.faces.jar in the GF/modules directory). No weld, no jboss, no conversation. Everything works fine when deployed on glassfish admin server, even when deployed on a single instance (other instance shut down). It also works with the 2 instances when I disable 'Availability' when deploying the war file. But when trying to use native session replication behavior I get following trace and my application doesn't display (or even the instance crashes). It seems to be a session deserialization issue. web.xml : javax.faces.STATE_SAVING_METHOD Same issue either with 'server' or 'client' I get following issue : java.lang.ClassCastException: cannot assign instance of org.jboss.weld.context.conversation.ConversationIdGenerator to field org.springframework.aop.framework.AdvisedSupport.advisorChainFactory of type org.springframework.aop.framework.AdvisorChainFactory in instance of org.springframework.aop.framework.ProxyFactory at java.io.ObjectStreamClass$FieldReflector.setObjFieldValues(ObjectStreamClass.java:2083) at java.io.ObjectStreamClass.setObjFieldValues(ObjectStreamClass.java:1261) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1995) at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:499) at org.springframework.aop.framework.AdvisedSupport.readObject(AdvisedSupport.java:550) at sun.reflect.GeneratedMethodAccessor127.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at java.io.ObjectStreamClass.invokeReadObject(ObjectSt…
score: 0
has answer: http://stackoverflow.com/a/20903527
tagged with: replication
type: UnansweredQuestion
tagged with: weld
tagged with: spring
tagged with: java
type: Question
answer count: 1
tagged with: glassfish
has title: Session replication issue between instances on Glassfish

http://stackoverflow.com/comment/31497203
has text: #### Java Web Start Error: #### The Java security settings have prevented this application from running. You may change this behavior in the Java Control Panel. Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException at com.sun.deploy.ui.DialogTemplate.imageAvailable(Unknown Source) at com.sun.deploy.ui.DialogTemplate.finalImageAvailable(Unknown Source) at com.sun.deploy.ui.ImageLoader$2.run(Unknown Source) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$200(Unknown Source)
score: 0
comment on: http://stackoverflow.com/q/20947154
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36796076
has text: Don't deface your question, doing so repeatedly will get your account suspended. Edits are meant to improve a question, not to hide its previous content - which you can't do anyways as the revision history is accessible to everyone.
score: 0
comment on: http://stackoverflow.com/q/20931882
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20884141
answer count: 3
tagged with: mybatis
has body: I am new to mybatis. I have a property in my class with java BigInteger. relevant mysql field type is BigInt. When i am going to insert a record to database with xml configuration file it gives an exception like 'There was no TypeHandler found for parameter id'. My xml insert query is, INSERT INTO xX_ ( id, date, name, connection) VALUES ( #{id}, #{date}, #{name}, #{connection} ) Please help me to fix this without changing the type on the DTO class.
tagged with: ibatis
tagged with: spring
has comment: http://stackoverflow.com/comment/31340917
has answer: http://stackoverflow.com/a/25017629
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31340521
has title: My Batis Type conversion error in insert parameter
type: Question
has answer: http://stackoverflow.com/a/24989778
has answer: http://stackoverflow.com/a/24990508
has comment: http://stackoverflow.com/comment/31340538
has comment: http://stackoverflow.com/comment/31371020
score: 0

enums
tags question: http://stackoverflow.com/q/20973221
tags question: http://stackoverflow.com/q/20945829
tags question: http://stackoverflow.com/q/20856176
tags question: http://stackoverflow.com/q/20951615
tags question: http://stackoverflow.com/q/20992279
tags question: http://stackoverflow.com/q/21005383
tags question: http://stackoverflow.com/q/20876254
tags question: http://stackoverflow.com/q/20861984
tags question: http://stackoverflow.com/q/21016623
tag name: enums
tags question: http://stackoverflow.com/q/20892249
tags question: http://stackoverflow.com/q/20996001
type: Tag
tags question: http://stackoverflow.com/q/20880545
tags question: http://stackoverflow.com/q/20963142
tags question: http://stackoverflow.com/q/20984603
tags question: http://stackoverflow.com/q/20965164
tags question: http://stackoverflow.com/q/20923753
tags question: http://stackoverflow.com/q/20874000

http://stackoverflow.com/q/20891558
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/31359275
tagged with: java
tagged with: background
has answer: http://stackoverflow.com/a/20891589
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/20891603
tagged with: android
has title: Android TextView line background
tagged with: textview
has body: I'd like to create a textview that contains a blue line as it's background just like in the image I provided. You can also find it in Google calendar when entering appointment info. I previously tried using 9patch images to stretch the line horizontally and keep the vertical scaling the same. But that does not work. I'd like to also use this in other view to provide my own background to other views. Any hints? Thanks you in advance!
has comment: http://stackoverflow.com/comment/31354947

http://stackoverflow.com/a/20921253
has comment: http://stackoverflow.com/comment/31411020
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31455765
has comment: http://stackoverflow.com/comment/31458930
has comment: http://stackoverflow.com/comment/31455290
has body: Do load a servlet on application start you need to edit the web.xml ****** ****** ****** 1
has comment: http://stackoverflow.com/comment/31411611
upvote count: 1
has comment: http://stackoverflow.com/comment/31423288
has comment: http://stackoverflow.com/comment/31411181
answers question: http://stackoverflow.com/q/20921238
has comment: http://stackoverflow.com/comment/31457283
type: Answer
has comment: http://stackoverflow.com/comment/31412122

http://stackoverflow.com/a/33137812
answers question: http://stackoverflow.com/q/20959505
has body: Regarding the "Couldn't open edu.umass.cs.mallet.base.util.MalletLogger resources/logging.properties file" error, encountered (e.g.) when running run.sh (or or other script or command) in BANNER Named Entity Recognition (uses MALLET). Solution: Copy 'logging.properties' from src/main/java/edu/umass/cs/mallet/base/util/resources/logging.properties to target/scala-2.11/classes/edu/umass/cs/mallet/base/util/resources/logging.properties [I am using the BANNER provided at https://github.com/clulab/banner ] Another error I encountered at the same time (... Logging configuration class "edu.umass.cs.mallet.base.util.Logger.DefaultConfigurator" failed) can be safely ignored: https://osdir.com/ml/ai.mallet.devel/2007-11/msg00008.html >> "I think this is a bug with the distribution but that it affects logging only. I've always ignored this warning." http://comments.gmane.org/gmane.comp.ai.mallet.devel/200 >> "This bug should not affect your output." http://courses.washington.edu/ling572/winter09/teaching_slides/1_08_Mallet.pptx >> Slide 20: "Please ignore this message." [Fei Xia, Jan 2009, 'Introduction to Mallet', Andrew McCallum's group at UMass (https://people.cs.umass.edu/~mccallum/)]
score: 0
type: Answer

http://stackoverflow.com/comment/31318735
has text: I think your previous statement is incorrect. If I made 1 tank object and pressed left, keysPressed[0] becomes true AND if I press A that same keysPressed[0] becomes true as well. The code to complete this is inside the tank class and is independent of which object you are working on at the time. Maybe I'm just too tired for this right now, sorry if I'm making it worse.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20871605

http://stackoverflow.com/a/20874061
answers question: http://stackoverflow.com/q/20874000
score: 0
type: Answer
has body: Normally, if you need enumerations of different types then just implement different enum types. The unsafe pattern with class with int-constants is not considered as good style (due to inherent unsafety). Another alternative might be the so-called type-safe enum pattern published by Joshua Bloch. As variation you even could construct type-hierarchies. But this is rather not for beginners. For example with regards to serialization you need special actions (use of readResolve-method). So standard enums are really quite easy to use and safe.

http://stackoverflow.com/a/20928803
downvote count: 0
has body: This is how i have done ListView with 2 different layout: public class Adapter extends BaseAdapter{ private static final int VIEW_TYPE_COUNT = 2; private static final int ITEM_1 = 0; private static final int ITEM_2= 1; private final int VIEWTYPES[] = {Item_1, ITEM_2}; private LayoutInflater mInflater; public Adapter(Context context){ // Cache the LayoutInflate to avoid asking for a new one each time. mInflater = LayoutInflater.from(context); } @Override public int getItemViewType(int position) { return VIEWTYPES[mPostList.get(position).getViewType()]; } @Override public int getViewTypeCount(){ return VIEW_TYPE_COUNT; } @Override public View getView(int position, View convertView, ViewGroup parent) { // A ViewHolder keeps references to children views to avoid unneccessary calls // to findViewById() on each row. ViewHolder holder; ViewHolder2 holder2; int type = getItemViewType(position); if (convertView == null) { holder = new ViewHolder(); holder2 = new ViewHolder2(); switch(type){ case ITEM_1: convertView = mInflater.inflate(R.layout.ITEM_1_LAYOUT, null); holder.text1 = (TextView)convertView.findViewById(); convertView.setTag(R.layout.ITEM_1_LAYOUT, holder); break; case ITEM_2: convertView = mInflater.inflate(R.layout.iTEM_2_LAYOUT, null); holder2.text2 = (TextView)convertView.findViewById(); convertView.setTag(R.layout.ITEM_2_LAYOUT, holder2); break; } } else{ // Get the ViewHolder back to get fast access to the TextViews holder = (ViewHolder) convertView.getTag(R.layout.ITEM_1_LAYOUT); holder2 = (ViewHolder2)convertView.getTag(R.layout.ITEM_2_LAYOUT); } switch(type){ case ITEM_1: holder.text1.setText("1"); break; case ITEM_2: holder.text2.setText("2"); break; } return convertView; } } static class ViewHolder { //Store layout1 views here TextView text1; } static class ViewHolder2{ //Store layout2 views here TextView text2; }
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/20928528

http://stackoverflow.com/comment/31478111
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20955673
has text: The code attribute should be the fully qualified class name. So if `TheaterApplet` is in `gui` package, then `gui.TheaterApplet` is entirely correct. Note that even Oracle's tutorials sometimes show it incorrectly as `gui.TheaterApplet.class`. While that is tolerated, it is not correct.
type: Comment

http://stackoverflow.com/q/20963366
has answer: http://stackoverflow.com/a/20963936
score: -4
possible better answer: http://stackoverflow.com/a/20963936
type: AnsweredQuestion
tagged with: java
tagged with: rgb
tagged with: image
has title: Error occurred while analyze pixel values on two similar images
type: Question
downvote count: 4
answer count: 2
has answer: http://stackoverflow.com/a/20965393
upvote count: 0
has comment: http://stackoverflow.com/comment/31491803
accepted answer: http://stackoverflow.com/a/20965393
has body: I am a beginner to Java. Currently I want to analyze two similar images and check whether the images have different pixel values at position 2 and 4. I already develop some codes but when running it, the code produces error and it doesn't looping and check for all pixel values on both images. For example, in the 9th pixel, image B pixel value at position 2 and 4 are not the same as image A pixel value. Then, whenever the code notices a differences between both images pixel value it will output the statement saying the pixel are not the same. Here's the code: public class getPixelRGB1 { private static String[][] img_hex2; private static String[][] img_hex4; private static String[][] img2_hex2; private static String[][] img2_hex4; public static void main(String[] args) throws IOException { FileInputStream image = null; FileInputStream image2 = null; getPixelData1 newPD = new getPixelData1(); compareHexaRGB hexRGB = new compareHexaRGB(); try { BufferedImage img, img2; File file = new File("eye1.jpg"); File file2 = new File("eye2.jpg"); image = new FileInputStream(file); image2 = new FileInputStream(file2); img = ImageIO.read(image); img2 = ImageIO.read(image2); int rowcol; int width = img.getWidth(); int height = img.getHeight(); hexRGB.compareHexaRGB(width, height); System.out.println("Image's Width: " + width); System.out.println("Image's Height: " + height); //hexRGB.check(); int[][] pixelData = new int[width * height][3]; System.out.println("Pixel Data: " + pixelData); int[] rgb; int count = 0; img_hex2 = new String[width][height]; img_hex4 = new String[width][height]; for(int i=0; i&lt;width; i++) { for(int j=0; j&lt;height; j++) { rgb = newPD.getPixelData(img, i, j); for(int k = 0; k &lt; rgb.length; k++) { pixelData[count][k] = rgb[k]; //img_hex2[i][j] = newPD.getHexa2(); //img_hex4[i][j] = newPD.getHexa4(); } img_hex2[width][height] = newPD.getHexa2(); img_hex4[width][height] = newPD.getHexa4(); System.out.println("Output: " + img_hex2[i][j]); System.out.printl…
favorite count: 0

http://stackoverflow.com/q/20999081
type: Question
linked to: http://stackoverflow.com/q/19388167
score: 0
tagged with: android
answer count: 1
tagged with: proguard
has body: Getting following error while exporting Android app on Eclipse. Proguard returned with error code 1. See console Note: there were 157 duplicate class definitions. You should check if you need to specify additional program jars. Error: Method must be overridden in [proguard.optimize.peephole.ClassMerger] if ever called Any idea what could cause this? Is the ClassMerger error messages related to the the duplicate class definitions warning above? As mentioned on What causes this error in Proguard: "Method must be overridden in [proguard.optimize.peephole.ClassMerger] if ever called"?, tried removing all -dontwarns, but it prints no further information.
type: UnansweredQuestion
has title: "Method must be overridden in [proguard.optimize.peephole.ClassMerger] if ever called" in Android
has answer: http://stackoverflow.com/a/21003492
tagged with: java
tagged with: eclipse

http://stackoverflow.com/comment/31585883
type: Comment
has text: it's still not working.All other command works but i don't know why above command is not working.
type: AnswerComment
comment on: http://stackoverflow.com/a/20992212
score: 0

http://stackoverflow.com/q/20998204
possible better answer: http://stackoverflow.com/a/20998846
has answer: http://stackoverflow.com/a/20998268
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20998268
tagged with: java
has body: I am trying to get rid of an "id" in URI paths and I can only use Java regex transformation. The paths look like this: /web/service/1223345/add /web/service/1223345/delete /web/service/v2/1223345/add /web/service/1223345 /web/service/do The id is always a series of numbers. In the example above it is "1223345". I have tried a couple of regexes but none of them worked. Here are my tries: (/\w.*)/?[0-9]*/(.*) ([^0-9]+){0,} (/.*/)[0-9]*(/.*) Thanks for your help
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/20998846
has title: How to remove an id out of a path using a Java Regex?
score: 0
tagged with: regex

http://stackoverflow.com/q/20955404
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31476065
tagged with: java
upvote count: 1
tagged with: android-sqlite
downvote count: 1
has comment: http://stackoverflow.com/comment/31475665
possible better answer: http://stackoverflow.com/a/20957106
type: Question
has answer: http://stackoverflow.com/a/20957106
linked to: http://stackoverflow.com/q/7201741
has body: I'm new in android programming. I'm writing simple application that should execute sql file, in first run. But it seems that this process take couple of seconds so I figure that application should show progressDialog while it will be executing sql file. But when I try to run application, dialog is showing with message "app has stopped ...". Please help me. @Override public void onCreate(SQLiteDatabase database) { String CREATE_BIBLE_TABLE = "CREATE TABLE bible (" + "id INTEGER PRIMARY KEY AUTOINCREMENT, " + "book INTEGER, " + "chapter INTEGER NOT NULL, " + "verse INTEGER NOT NULL, " + "content TEXT" + ")"; database.execSQL(CREATE_BIBLE_TABLE); new FirstLoadAsyncTask(database).execute(); } public class FirstLoadAsyncTask extends AsyncTask&lt;Void, Void, Void&gt; { private SQLiteDatabase database; private ProgressDialog progressDialog; public FirstLoadAsyncTask(SQLiteDatabase database) { this.database = database; } @Override protected void onPreExecute() { ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { progressDialog = ProgressDialog.show(context, "Loading...", ""); } }); } @Override protected Void doInBackground(Void... params) { try { InputStream inputStream = context.getAssets().open("bible.sql"); execSqlFile(database, inputStream); } catch(IOException e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(Void result) { progressDialog.dismiss(); } } Class extends SQLiteOpenHelper. Edit: Logcat: 01-06 18:27:53.221 14118-14118/pl.several27.Biblia_Warszawska E/Trace﹕ error opening trace file: No such file or directory (2) 01-06 18:27:53.891 14118-14118/pl.several27.Biblia_Warszawska I/Adreno200-EGL﹕ &lt;qeglDrvAPI_eglInitialize:299&gt;: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_JB_REL_2.0.3.04.01.02.21.081_msm7627a_JB_REL_2.0.3_CL2820657_release_AU (CL2820657) Build Date: 01/22/13 Tue Local Branch: Remote Branch: quic/jb_rel_2.0.3 Local Patches: NONE Reconstruct Branch: AU_LINUX_ANDROID_JB_REL_2.0.3.04.01.0…
tagged with: progressdialog
accepted answer: http://stackoverflow.com/a/20955641
linked to: http://stackoverflow.com/q/20955199
has comment: http://stackoverflow.com/comment/31475465
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31475988
favorite count: 0
has comment: http://stackoverflow.com/comment/31475996
tagged with: android
has comment: http://stackoverflow.com/comment/31476025
has title: Show ProgressDialog in SQLiteOpenHelper onCreate method
has answer: http://stackoverflow.com/a/20955641

http://stackoverflow.com/q/20958443
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31484061
downvote count: 0
has body: I'm developing what might become a pretty intense web application, which requires a large set of random numbers for cookie values, salt values, shared session identifiers and other similar sized (~ 20 bytes) items. The random numbers are typically required in response to user activity (such as registration, login, payment, etc.) Since the time of such activity is unpredictable, my premise is to try and use it to add entropy to the java.security.SecureRandom object in order to speed it up. I have developed a class that uses the last 8 bits of the current system time of every 10th call to the random number generator to add entropy to the random number generator. My question is: Will this strategy deliver higher performance than just using SecureRandom with default seeding. Please see the code below to see exactly how I'm doing this. Thanks in advance for any feedback. import java.security.SecureRandom; /** * Uses the lowest 8 bits of the time at which the call to get random bytes * is made to seed a SecureRandom object to generate more randomness. * This class can speed up the random number generator if: Each call to * nextBytes is of a limited length; * and the time at which nextBytes is called is unpredictable because it * is being done in response to user activity. * */ public class SRandFactory { private static final int BITLEN = 8; private static final int BITMASK = 0xFF; private static final int LONGLEN = 64; private static final int INTERVAL = 10; private static SecureRandom sr = new SecureRandom(); private static long nextSeed = 0L; private static int callCount = 0; private static int shiftBits = 0; private static void seedUp() { if (callCount++ &gt;= INTERVAL) { callCount = 0; long curTime = System.currentTimeMillis() &amp; BITMASK; nextSeed = nextSeed | (curTime &lt;&lt; shiftBits); shiftBits += BITLEN; if ( shiftBits &gt;= LONGLEN) { sr.setSeed(nextSeed); nextSeed = 0; shiftBits = 0; } } } public static synchronized void nextBytes(byte[] array) { seedUp(); …
has comment: http://stackoverflow.com/comment/31482502
tagged with: cryptography
favorite count: 0
has comment: http://stackoverflow.com/comment/31521605
answer count: 0
has comment: http://stackoverflow.com/comment/31496422
has title: Accelerating Java SecureRandom in a web environment
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/31520372
tagged with: performance
score: 1

http://stackoverflow.com/comment/31290178
comment on: http://stackoverflow.com/q/20857383
score: 0
type: Comment
type: QuestionComment
has text: @sᴜʀᴇsʜᴀᴛᴛᴀ I already changed into <c:if out="(${staff.staffRole}.equals("Owner"))">checked</c:if> .. But still cannot.

http://stackoverflow.com/a/20937199
type: Answer
answers question: http://stackoverflow.com/q/20936957
has body: if (a == 0) { break; } else { System.out.println(base+" is a prime number, so it has no factors"); break; } No matter what, you're breaking out of the loop on the first increment. Even if you removed the break; from the else block, you are still displaying whether or not the number is prime too early. You need to decide that after all of the iterations are completed. So, consider a boolean variable to keep track of whether or not the number has at least one factor in it: boolean isPrime = true; // true unless proven otherwise for (int i = 2; i &lt; base; i++) { int a = base % i; if (a == 0) { isPrime = false; // has factor so it's not prime break; } } if (isPrime) { System.out.println(base + " is a prime number, so it has no factors"); } else { System.out.println(base + " is a composite number: "); // say it's not prime // then display the factors for (int i = 3; i &lt; base; i++) { int res = base % i; if (res == 0) { int fac = base / i; System.out.println(i + " and " + fac + " are factors of " + base); } } } Here is a pastie to this entire class.
score: 0

http://stackoverflow.com/q/21004775
favorite count: 0
has comment: http://stackoverflow.com/comment/31567450
answer count: 5
has answer: http://stackoverflow.com/a/21004909
has title: How would you "compress" a list?
possible better answer: http://stackoverflow.com/a/21005014
has comment: http://stackoverflow.com/comment/31567545
score: 2
type: AnsweredQuestion
tagged with: list
upvote count: 2
has answer: http://stackoverflow.com/a/21004906
has body: For instance say I have a list with the following values {"A", null, null, "B", null, "C", null, "D", "E", null} What would be the most efficient way to compress that to {"A", "B", "C", "D", "E"} Is there a way to do this quickly and efficiently without creating a new list altogether. It would also be fine if the compressed list looked like {"A", "B", "C", "D", "E", null, null, null, null, null}
has answer: http://stackoverflow.com/a/21004822
accepted answer: http://stackoverflow.com/a/21004822
type: Question
tagged with: performance
tagged with: java
has comment: http://stackoverflow.com/comment/31567473
has answer: http://stackoverflow.com/a/21005014
has answer: http://stackoverflow.com/a/21004845
downvote count: 0

http://stackoverflow.com/comment/78616598
type: Comment
has text: @ManInMoon ... I had a go at this earlier in the week. If the value entered is outside the range, the `spinner.getValue()` remains whatever the last valid value was. So your calculations will be whatever they were after that last (valide) entry. As far as I can tell, the spinner ONLY gets updated when the user pressed `ENTER`. That said the underlying JTextField _holds on to_ the new and incorrect value. Probably for display purposes ... I wanted the display to reflect the _actual value_ of the model; but that didn't seem to work either. :-(
comment on: http://stackoverflow.com/q/20966239
score: 0
type: QuestionComment

http://stackoverflow.com/a/20982234
accepted answer of: http://stackoverflow.com/q/20982070
has body: This is to do with generic rules: in general if B extends A and you have a generic type G, then g&lt;a&gt; cannot be initialised to g&lt;B&gt;. This is because the following would then be possible: class Human and Dog extend class Animal public void makeNoise(List&lt;? extends Animal&gt; animalList) { for (Animal a: animalList) { //now you could call a.bark() or a.speakAsHuman() and there could not be any verification of whether this is a list of dogs or humans } } Have a look at: this SO Question
type: Answer
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20982070
type: AcceptedAnswer

http://stackoverflow.com/q/20900902
score: 0
tagged with: maven
has answer: http://stackoverflow.com/a/20900980
answer count: 1
has title: build project into different repositories with different jdks
tagged with: java
has body: I am facing problem where I need to build same project into different local repositories where each repository is based on different JDK version (1.6 and 1.7). Is it possible to configure for example settings.xml and its profiles to be able build projects this way? Modifying pom files is not a solution for me since there is quite large number of projects which should be prepared this way and I am not only one who works and updates pom files. I found only solution for switching repositories via mvn call http://jira.codehaus.org/browse/MNG-3588
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20900980
type: Question
has comment: http://stackoverflow.com/comment/31372645
tagged with: repository
has comment: http://stackoverflow.com/comment/31371841

http://stackoverflow.com/q/20945237
has title: sort array element in a ascending order in Core java?
has comment: http://stackoverflow.com/comment/31456554
has comment: http://stackoverflow.com/comment/31456865
has body: class Ascendingarray { public static void main(String[] args) { //Without using Arrays.sort function int i; int nos[] = {12,9,-4,-1,3,10,34,12,11}; System.out.print("Values before sorting: \n"); for(i = 0; i &lt; nos.length; i++) System.out.println( nos[i]+" "); //sort(nos, nos.length); System.out.print("Values after sorting: \n"); for(i = 0; i
tagged with: java
downvote count: 3
score: -1
type: Question
answer count: 2
tagged with: sorting
favorite count: 0
has answer: http://stackoverflow.com/a/20945654
has comment: http://stackoverflow.com/comment/31456538
has answer: http://stackoverflow.com/a/20945256
has comment: http://stackoverflow.com/comment/31457121
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/comment/31559142
type: QuestionComment
comment on: http://stackoverflow.com/q/21000390
score: 0
has text: No, i have just one List.
type: Comment

http://stackoverflow.com/a/20899232
accepted answer of: http://stackoverflow.com/q/20899117
has body: If you prefer to work with a script like tool there is also jvmtop that gives you the cpu usage per thread. Sample output bellow.
answers question: http://stackoverflow.com/q/20899117
type: Answer
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/q/20978614
has comment: http://stackoverflow.com/comment/31519494
tagged with: eclipse
type: Question
tagged with: debugging
has comment: http://stackoverflow.com/comment/31520095
has title: I can not debug in Eclipse
score: 0
has answer: http://stackoverflow.com/a/20979108
answer count: 1
has comment: http://stackoverflow.com/comment/31520025
has body: On my mac machine I can not debug java code and every time I got the following error in the console "ERROR: transport error 202: send failed: Invalid argument" I turn off firewall , restart machine and I still getting same problem
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31519779
has comment: http://stackoverflow.com/comment/31519283
tagged with: java

http://stackoverflow.com/comment/31408785
type: QuestionComment
comment on: http://stackoverflow.com/q/20920243
has text: Should not you add the line 'Scherm.openen.addActionListener( new Lezen() );' before pressing the button, instead of adding it when you press the button the first time?
score: 3
type: Comment

http://stackoverflow.com/comment/31488836
type: QuestionComment
comment on: http://stackoverflow.com/q/20961923
score: 0
type: Comment
has text: Is there any safe workaround? I see that compiler error is gone if I do typecasting suggested by eclipse but not sure if thats' right way to go. Was hoping to save duplicate code with this approach.

http://stackoverflow.com/comment/31591287
has text: do like this startActivity(new Intent(this, UI.class) .setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK));
score: 0
comment on: http://stackoverflow.com/q/21017873
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20888851
tagged with: password-encryption
possible better answer: http://stackoverflow.com/a/52877782
favorite count: 0
upvote count: 9
has comment: http://stackoverflow.com/comment/79896665
linked to: http://stackoverflow.com/q/38125254
has body: I am writing a simple app to encrypt my message using AES / CBC (mode). As my understanding CBC mode requires IV parameter but I don't know why my code work without IV parameter used. Anyone can explain why? Thanks. The encrypted message printed: T9KdWxVZ5xStaisXn6llfg== without exception. public class TestAES { public static void main(String[] args) { try { byte[] salt = new byte[8]; new SecureRandom().nextBytes(salt); SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1"); KeySpec keySpec = new PBEKeySpec("myPassword".toCharArray(), salt, 100, 128); SecretKey tmp = keyFactory.generateSecret(keySpec); SecretKeySpec key = new SecretKeySpec(tmp.getEncoded(), "AES"); Cipher enCipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); enCipher.init(Cipher.ENCRYPT_MODE, key); // enCipher.init(Cipher.ENCRYPT_MODE, key, new IvParameterSpec(iv)); byte[] cipherBytes = enCipher.doFinal("myMessage".getBytes()); String cipherMsg = BaseEncoding.base64().encode(cipherBytes); System.out.println("Encrypted message: " + cipherMsg); } catch (Exception ex) { ex.printStackTrace(); } } }
tagged with: aes
type: AnsweredQuestion
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/62723853
type: Question
has title: Does AES/CBC really require IV parameter?
score: 9
tagged with: cbc-mode
has answer: http://stackoverflow.com/a/52877782
has answer: http://stackoverflow.com/a/20888967
accepted answer: http://stackoverflow.com/a/20888967
answer count: 2

http://stackoverflow.com/a/20895670
upvote count: 5
has body: It seem you are getting null entry at line String BVal = JOptionPane.showInputDialog(null, "Please enter 5 different numbers"+ "\n" + "that are in the range of 1-15"); So line BValues[B]=Integer.parseInt(BVal); is causing the exception. Trace what you are getting BVal as input. Important: Always use validation while taking input from user. Update: I checked further, you are taking input in multiple places. Put validation wherever needed validation reference
score: 5
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20895621
type: Answer
answers question: http://stackoverflow.com/q/20895621

http://stackoverflow.com/a/20883789
has body: NumberFormat nf = NumberFormat.getInstance(Locale.getDefault()); double value = nf.parse(iValue).doubleValue();
score: 0
answers question: http://stackoverflow.com/q/20883402
type: Answer

http://stackoverflow.com/comment/31567465
type: Comment
has text: @JonathanDrapeau & hover so how should I fix the "new mainselection();??Sorry I'm really new in this java thing, my teacher just copy pasted all codes on projector and ask us to copy without explaining properly, I'm learning a lot today from here.
comment on: http://stackoverflow.com/a/21004104
type: AnswerComment
score: 0

http://stackoverflow.com/a/20965824
answers question: http://stackoverflow.com/q/20965658
has body: EOFException in ObjectInputStream.readInt means that there are less than 4 bytes left in the file after current position.
has comment: http://stackoverflow.com/comment/31495530
type: Answer
score: 0

http://stackoverflow.com/comment/42859959
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20858064
has text: Hi I have the class in the WEB-INF\lib\myjar. Still the same error.
type: AnswerComment

http://stackoverflow.com/comment/31547993
type: Comment
has text: My question really is what is best practice, I got my proposed solution from this question but there were some conflicts, in industry, how would this be acheived? storing temp file to user.home? or ...
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20991102

http://stackoverflow.com/comment/31476738
score: 0
type: Comment
type: QuestionComment
has text: Okay. The behavior I expect is adding users to the list and displaying them. Along with adding the users. I want to also delete object from the list. the person is should be automatically assigned for the new user that will be added to the list
comment on: http://stackoverflow.com/q/20954958

http://stackoverflow.com/comment/31586119
type: QuestionComment
comment on: http://stackoverflow.com/q/20989789
score: 0
type: Comment
has text: Also you need to explain what exactly you wish to occur.

jlist
tags question: http://stackoverflow.com/q/20890613
tags question: http://stackoverflow.com/q/20857767
tags question: http://stackoverflow.com/q/20894369
tags question: http://stackoverflow.com/q/20855058
tags question: http://stackoverflow.com/q/20911268
tags question: http://stackoverflow.com/q/20985014
type: Tag
tags question: http://stackoverflow.com/q/20870670
tags question: http://stackoverflow.com/q/20908160
tags question: http://stackoverflow.com/q/20891355
tag name: jlist
tags question: http://stackoverflow.com/q/20943327

http://stackoverflow.com/comment/31584662
has text: I just used another way to search the button
comment on: http://stackoverflow.com/q/21001183
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/31372584
type: Comment
type: QuestionComment
has text: I'm going to venture a guess that this maven clean is actually just invoking the regular Eclipse project clean to get a speed boost, but I didn't implement the Maven plugin so I can't know for sure.
comment on: http://stackoverflow.com/q/20901205
score: 0

http://stackoverflow.com/a/20863159
type: Answer
downvote count: 1
answers question: http://stackoverflow.com/q/20863023
has body: Question 1: according to the SocketChannel documentation you'll get a ClosedChannelException. Question 2: your server will buffer data right until the error happens and if it happens in the middle of the client writing, then it will contain half the data. This is assuming there is no buffering in the client before sending data, but in the end it doesn't matter, you shouldn't rely on the server getting either "complete" or "no data", it can get incomplete data.
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/31303403

http://stackoverflow.com/a/20918905
has comment: http://stackoverflow.com/comment/123493120
downvote count: 0
has comment: http://stackoverflow.com/comment/85805364
has comment: http://stackoverflow.com/comment/31406308
has body: Try with something like @Resource - I have not tested this code. @Resource(name="converters") private Map&lt;String, ISendableConverter&gt; converters; or @Value("#{converters}") private Map&lt;String, ISendableConverter&gt; converters; From Spring Docs (..) beans that are themselves defined as a collection or map type cannot be injected through @Autowired, because type matching is not properly applicable to them. Use @Resource for such beans, referring to the specific collection or map bean by unique name. This should work, only if you prepare converters bean like this: &lt;util:map id="converters" scope="prototype" map-class="java.util.HashMap" key-type="java.lang.String" value-type="...ISendableConverter"&gt; &lt;entry key="VOICE" value="sendableVoiceMsgConverter" /&gt; &lt;/util:map&gt; This is also similar question: Auto-wiring a List using util schema gives NoSuchBeanDefinitionException Spring can&#39;t autowire Map bean
type: Answer
score: 29
upvote count: 29
answers question: http://stackoverflow.com/q/20918825

http://stackoverflow.com/q/20911763
score: 6
upvote count: 6
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/20912060
type: Question
has comment: http://stackoverflow.com/comment/31393227
answer count: 2
tagged with: jpa
has body: I would like to get first row from database using JPA Criteria. I use JPA, Hibernate 4.2.7. In SQL, statement looks like: SELECT * FROM houses WHERE rownum = 1; My Java code to achive that looks like: CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery&lt;House&gt; query = builder.createQuery(House.class); Root&lt;House&gt; root = query.from(House.class); query.select(root).where(builder.equal(root.get("rownum"), 1)); TypedQuery&lt;House&gt; tQuery = entityManager.createQuery(query); House house = tQuery.getSingleResult(); But 'rownum' pseudocolumn cannot be resolved, I get exception: java.lang.IllegalArgumentException: Unable to resolve attribute [rownum] against path at org.hibernate.ejb.criteria.path.AbstractPathImpl.unknownAttribute(AbstractPathImpl.java:120) at org.hibernate.ejb.criteria.path.AbstractPathImpl.locateAttribute(AbstractPathImpl.java:229) at org.hibernate.ejb.criteria.path.AbstractPathImpl.get(AbstractPathImpl.java:200) Is is possible, and if so, how to get 'rownum' pseudocolumn with Criteria API? Thanks for any suggestions.
has title: How to resolve Oracle's 'rownum' pseudocolumn with JPA Criteria API?
downvote count: 0
accepted answer: http://stackoverflow.com/a/20912060
favorite count: 0
possible better answer: http://stackoverflow.com/a/20968406
has answer: http://stackoverflow.com/a/20968406

http://stackoverflow.com/comment/31387681
score: 3
comment on: http://stackoverflow.com/a/20907356
type: AnswerComment
type: Comment
has text: Doesn't even have to be malicious, it's very easy and innocent looking to use an object you get from somewhere to lock (say because you want to synchronize access to exactly this object). Best to avoid such problems

http://stackoverflow.com/comment/31533082
has text: You're probably going to need 2 for loops
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20985719

http://stackoverflow.com/a/21015442
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/21015318
score: 4
has body: We have some other ways too, If you can use Apache commons-collection ListUtils.union(java.util.List list1, java.util.List list2) Returns a new list containing the second list appended to the first list.
type: Answer

http://stackoverflow.com/comment/41484695
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20862335
score: 0
has text: The glyphs don't display with the released version (1.8.7) but they do display with the non-released version (2.0.0) that you can get with svn. The released versions can't display certain type1 fonts :-(

http://stackoverflow.com/q/20872773
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31319957
has title: the address of GImage
has body: So I want to set address of image, but there is some problem, I know that there is another way: add this image to this project folder and just write the name, but How can I do that way?(with full address). GImage Image = new GImage("D:\Users\Oservice\Desktop\gravity.jpg");
has answer: http://stackoverflow.com/a/20872817
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20873062
tagged with: java
type: Question
tagged with: graphics
has answer: http://stackoverflow.com/a/20873062
possible better answer: http://stackoverflow.com/a/20872817

http://stackoverflow.com/comment/31425012
type: QuestionComment
comment on: http://stackoverflow.com/q/20928176
has text: @user2570465 the first while(!ops.isEmpty()) loop, The type of parenthesis doesn't really matter, no. I added it incase the user preferred them. I am using this code for an app I am making.
score: 0
type: Comment

http://stackoverflow.com/q/20976063
linked to: http://stackoverflow.com/q/8419609
tagged with: java
has comment: http://stackoverflow.com/comment/31516126
has comment: http://stackoverflow.com/comment/31514633
upvote count: 1
type: Question
tagged with: hashmap
has body: I am attempting to send a hashmap to a Java API in PowerShell. I need to create a hashmap for one of the inputs required. I am able to create a hashtable via the following method: $myMap = @{"name1" = "server1"; "name2" = "server2"} We then echo that and get... echo $mymap System.Collections.Hashtable How can I convert the System.Collections.Hashtable object to a hashmap within Powershell? Attempting to send it as a hashtable returns this error: Cannot convert argument "in0", with value: "System.Collections.Hashtable", for "search" to type "SiteScope.Map": "Cannot create object of type "SiteScope.Map". The path property was not found for the SiteScope.Map object. The available property is: [item &lt;SiteScope.mapItem[]&gt;]" At line:6 char:5 + $ssWs.search($myMap,"5","$strUsername", "$strPassword","1") + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodException + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument "SiteScope" is the Java application with the API.
tagged with: powershell
has comment: http://stackoverflow.com/comment/71446718
has comment: http://stackoverflow.com/comment/71447000
tagged with: api
downvote count: 0
linked to: http://stackoverflow.com/q/443499
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31515795
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31525453
tagged with: hashtable
has title: How to create a hashmap in PowerShell
has comment: http://stackoverflow.com/comment/31518530
has comment: http://stackoverflow.com/comment/71446645
has comment: http://stackoverflow.com/comment/31516308
answer count: 0

http://stackoverflow.com/q/20952076
tagged with: rotation
tagged with: math
tagged with: image
has answer: http://stackoverflow.com/a/20957705
has body: I tried to post a different topic for this but people didn't really seem to understand what I was trying to do, so, now I've closed that one and opened this one to give more detail and rephrase the question as a whole. Ok. So basically, I have an application which draws an Ellipse. Now, I have a certain number of points (that can be random) in which I have to rotate an image and draw at. Using Maths I know that to get a point on an Ellipse based by using an angle I use the following equation; final int radiusW = (width / 2); final int radiusH = (height / 2); final int angle = 120; int pointX = (int) (radiusW + (radiusW * Math.cos(Math.toRadians(angle)))); int pointY = (int) (radiusH + (radiusH * Math.sin(Math.toRadians(angle)))); And that works fine, I can locate an absolute point around the perimeter of the Ellipse. However, now I'm trying to draw an image on this point so that the image is rotated facing the center of ellipse and is centered on the point. So, to get the image rotated to the center of the point I do the following; final AffineTransform at = new AffineTransform(); at.rotate(Math.toRadians(angle - 90), image.getWidth() / 2, image.getHeight() / 2); final AffineTransformOp ato = new AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR); And then I get my new rotated BufferedImage using; BufferedImage rotated = ato.filter(image, null); However, I can't seem to be able to get the central point of the image anymore. If the angle was 0 so that the Image was the original direction then I would simply do; graphics.drawImage(rotated, pointX - rotated.getWidth() / 2, pointY - rotated.getHeight() / 2, this); However I'm not sure how to find the central point and draw it based upon that on a rotated image. I know it involves using cos and sin to multiply the original pointX and pointY by the rotation matrix but everytime I try and work out a solution it always draws completely wrong. Any help would be very much appreciated as I've spent the best part of a day t…
has answer: http://stackoverflow.com/a/20952217
answer count: 3
linked to: http://stackoverflow.com/q/622140
has answer: http://stackoverflow.com/a/20952992
type: UnansweredQuestion
has title: Rotating and drawing an image at a point in Java
score: 0
tagged with: java
type: Question
tagged with: graphics

http://stackoverflow.com/q/20935617
possible better answer: http://stackoverflow.com/a/20951612
has answer: http://stackoverflow.com/a/20951612
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/20936864
favorite count: 0
tagged with: proxy
tagged with: apache-httpclient-4.x
has title: Bypass DNS lookup and submit URL to proxy
accepted answer: http://stackoverflow.com/a/20936864
tagged with: apache-commons-httpclient
has body: I have Java application that uses Apache HttpComponents to make web request. I have configured the application to use Proxy Servers using the JVM Property java -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=3132 Currently my java application client makes DNS lookup in which it will fail. I want the Proxy to do the DNS resolution just like how web browsers do in automatic Proxy configuration mode (with .pac files).
tagged with: dns
upvote count: 1
type: Question
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/31345650
type: Comment
has text: Yea that should work. c Was just a random letter selection.
comment on: http://stackoverflow.com/a/20872160
type: AnswerComment
score: 0

http://stackoverflow.com/q/20977812
accepted answer: http://stackoverflow.com/a/20977854
score: 2
type: AnsweredQuestion
tagged with: user-interface
downvote count: 0
favorite count: 0
type: Question
has title: How to resize frame dynamically with Timer?
has body: I'm trying to resize a window dynamically using a Timer object, but not succeeding... I set the preferred size of the panel in the constructor, which sets the size of the window nicely, though only once. The preferred size changes after the program is initialized, but the window size stays the same. Why? Because the constructor is initialized only once and therefore isn't affected by the size change? If so, how could I get around this to resize the window in real-time? I know this won't solve the problem in the exercise given in the beginning comments, so please ignore that :-) /* * Exercise 18.15 * * "(Enlarge and shrink an image) Write an applet that will display a sequence of * image files in different sizes. Initially, the viewing area for this image has * a width of 300 and a height of 300. Your program should continuously shrink the * viewing area by 1 in width and 1 in height until it reaches a width of 50 and * a height of 50. At that point, the viewing area should continuously enlarge by * 1 in width and 1 in height until it reaches a width of 300 and a height of 300. * The viewing area should shrink and enlarge (alternately) to create animation * for the single image." * * Created: 2014.01.07 */ import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Ex_18_15 extends JApplet { // Main method public static void main(String[] args) { JFrame frame = new JFrame(); Ex_18_15 applet = new Ex_18_15(); applet.isStandalone = true; frame.add(applet); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } // Data fields private boolean isStandalone = false; private Image image = new ImageIcon("greenguy.png").getImage(); private int xCoordinate = 360; private int yCoordinate = 300; private Timer timer = new Timer(20, new TimerListener()); private DrawPanel panel = new DrawPanel(); // Constructor public Ex_18_15() { panel.setPreferredSize(new Dimension(xCoordinate, yCoordina…
tagged with: timer
upvote count: 2
tagged with: jframe
tagged with: swing
answer count: 1
tagged with: java
has answer: http://stackoverflow.com/a/20977854

jersey
tags question: http://stackoverflow.com/q/20951852
tags question: http://stackoverflow.com/q/20876880
tags question: http://stackoverflow.com/q/20955873
tags question: http://stackoverflow.com/q/20937362
tags question: http://stackoverflow.com/q/20980814
tags question: http://stackoverflow.com/q/20875139
tags question: http://stackoverflow.com/q/20945274
tags question: http://stackoverflow.com/q/20989792
tags question: http://stackoverflow.com/q/21004704
tags question: http://stackoverflow.com/q/20946815
tags question: http://stackoverflow.com/q/20925278
tags question: http://stackoverflow.com/q/20902546
tags question: http://stackoverflow.com/q/20886690
tag name: jersey
tags question: http://stackoverflow.com/q/20890340
tags question: http://stackoverflow.com/q/20952872
tags question: http://stackoverflow.com/q/20901739
type: Tag
tags question: http://stackoverflow.com/q/20879592

http://stackoverflow.com/comment/31532920
has text: Yeah that was precisely my confusion. I got it now, I had totally missed the DTO part in the reading. Thank you!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20985555
type: Comment

http://stackoverflow.com/q/20934253
score: 0
has comment: http://stackoverflow.com/comment/31436286
has comment: http://stackoverflow.com/comment/31435485
answer count: 1
favorite count: 0
has title: Fork and Join Java
has comment: http://stackoverflow.com/comment/31435434
tagged with: fork
type: UnansweredQuestion
upvote count: 1
downvote count: 1
tagged with: join
has body: Hey guys I need some help with my homework. I understand the way the Fork and Join Framework works, but my code does not join the results. Our exercise is to write a program, that counts the true values in an array. Sorry for any mistakes (bad grammar or something else) in this post, it is my first one. Edit: Thanks for all the requests here is my solution of this problem: TrueFinder Class: import java.util.concurrent.ForkJoinPool; import java.util.concurrent.RecursiveTask; class TrueFinder extends RecursiveTask&lt;TrueResult&gt; { private static final int SEQUENTIAL_THRESHOLD = 5; private boolean[] trueData; private final int start; private final int end; public TrueFinder(boolean[] data, int start, int end) { this.trueData = data; this.start = start; this.end = end; } public TrueFinder(boolean[] data) { this(data, 0, data.length); } protected TrueResult compute() { final int length = end - start; int counter = 0; if (length &lt; SEQUENTIAL_THRESHOLD) { for (int i = start; i &lt; end; i++) { if (trueData[i]) { counter++; } } return new TrueResult(counter); } else { final int split = length / 2; TrueFinder left = new TrueFinder(trueData, start, start + split); left.fork(); TrueFinder right = new TrueFinder(trueData, start + split, end); TrueResult subResultRight = right.compute(); TrueResult subResultLeft = left.join(); return new TrueResult(subResultRight.getTrueCounter() + subResultLeft.getTrueCounter()); } } public static void main(String[] args) { int trues = 0; boolean[] trueArray = new boolean[500]; for (int i = 0; i &lt; 500; i++) { if (Math.random() &lt; 0.3) { trueArray[i] = true; trues++; } else { trueArray[i] = false; } } TrueFinder finder = new TrueFinder(trueArray); ForkJoinPool pool = new ForkJoinPool(4); long startTime = System.currentTimeMillis(); TrueResult result = pool.invoke(finder); long endTime = System.currentTimeMillis(); long actualTime = endTime - startTime; System.out.println("Array mit der Länge " + trueArray.length + " in" actualTime + "…
tagged with: java
has answer: http://stackoverflow.com/a/20934607
type: Question

http://stackoverflow.com/q/20959873
type: Question
has title: Eclipse: Feature Category does not appear in update site
score: 0
answer count: 1
tagged with: eclipse-plugin
has body: this is the url of an open source project I am working on https://code.google.com/p/mdpm/ it consists of a set of Eclipse Plugins there is a plugin implementing the update site with a site.xml file with this content <category-def name="mdpm" label="Model Driven Project Management"/> <category name="mdpm"/> the problem is that if I try to use the update site http://mdpm.googlecode.com/git/com.lowcoupling.mdpm.updateSite/ (from Eclipse) the category does not appear you have to uncheck the 'group items by category' box what am I doing wrong?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/47517830
has answer: http://stackoverflow.com/a/20961948
tagged with: java
tagged with: eclipse

http://stackoverflow.com/q/20987910
has comment: http://stackoverflow.com/comment/31536795
has comment: http://stackoverflow.com/comment/31536939
score: 0
has comment: http://stackoverflow.com/comment/31537101
has comment: http://stackoverflow.com/comment/31536903
has answer: http://stackoverflow.com/a/20988065
tagged with: types
has comment: http://stackoverflow.com/comment/31537193
has comment: http://stackoverflow.com/comment/31537218
favorite count: 0
has answer: http://stackoverflow.com/a/56200845
has comment: http://stackoverflow.com/comment/31536844
tagged with: object-reference
has answer: http://stackoverflow.com/a/20988186
answer count: 5
type: UnansweredQuestion
tagged with: classname
has comment: http://stackoverflow.com/comment/31537141
has answer: http://stackoverflow.com/a/45952018
has title: How to get the type of object reference of instance?
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/31536980
downvote count: 1
has answer: http://stackoverflow.com/a/20987975
type: Question
has body: Given an interface, an abstract class and a concrete class interface Interface { } abstract class AbstractClass { } class C extends AbstractClass implements Interface { } I instantiate two instances of my concrete class C like so Interface a = new C(); AbstractClass b = new C(); System.out.println(getObjectReferenceName(a));// return some.package.Interface System.out.println(getObjectReferenceName(b));// return some.package.AbstractClass /* it return the class name of Object refernce */ String getObjectReferenceName(Object o){ // todo return "class name"; } How can I get the class name of the reference type? That is - a's object reference is some.package.Interface. b's object reference is some.package.AbstractClass.

http://stackoverflow.com/a/20909421
type: Answer
has body: It is better to have all the queries in the DAO class methods and run them. If you are working on HQL, have all the queries written in the NamedQuery and access it by name at the run time.
answers question: http://stackoverflow.com/q/20908697
score: 0

http://stackoverflow.com/comment/31366097
has text: Did you test it? If you post code that you didn't test, you risk getting MORE downvotes.
comment on: http://stackoverflow.com/a/20897623
type: AnswerComment
type: Comment
score: 2

http://stackoverflow.com/comment/31364602
comment on: http://stackoverflow.com/q/20896754
score: 0
has text: Yes, but you were even the one who recommended the tutorial to me originally. However, if that is the case, would you recommend using strictly AWT components?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31412803
type: QuestionComment
comment on: http://stackoverflow.com/q/20922442
score: 0
has text: adding an actionListener might help here.
type: Comment

http://stackoverflow.com/comment/31447367
comment on: http://stackoverflow.com/q/20940120
has text: You have a `.class` file somewhere that isn't _actually_ a `.class` file.
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/20906589
tagged with: libgdx
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20906611
answer count: 2
tagged with: ios
has comment: http://stackoverflow.com/comment/31382472
has body: In some games people can cheat by changing the time. For example: when they have to wait 30 minutes before a building is built. Can i prevent this, assuming that the devices have connection with my server? I am programming in java using the libGDX library. Any solutions that work both on IOS and Android?
tagged with: android
accepted answer: http://stackoverflow.com/a/20906611
possible better answer: http://stackoverflow.com/a/20908176
has answer: http://stackoverflow.com/a/20908176
favorite count: 0
type: AnsweredQuestion
has title: Changing time on device => cheating in the game
upvote count: 2
downvote count: 1
type: Question

http://stackoverflow.com/comment/31596124
has text: user309039 - I've downloaded soapUI. Where do I find the input request format?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21017782

http://stackoverflow.com/a/20902657
score: 0
type: AcceptedAnswer
type: Answer
has body: commons io is the problem here removed the commons-io jar file and clean build the module its working fine now
accepted answer of: http://stackoverflow.com/q/20855212
answers question: http://stackoverflow.com/q/20855212

http://stackoverflow.com/comment/31523978
comment on: http://stackoverflow.com/a/20980679
type: AnswerComment
score: 0
type: Comment
has text: Stupid question...how is this related?

http://stackoverflow.com/a/20979580
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Solved.. the problem was.. i was accessing the datasource this way: ds = (DataSource) ctx.lookup("java:comp/env/jdbc/AccesoBD"); and was: ds = (DataSource) ctx.lookup("java:comp/env/jdbc/AccesoDB"); i swapped DB by BD :) thx all anyway ^^
accepted answer of: http://stackoverflow.com/q/20978550
answers question: http://stackoverflow.com/q/20978550
score: 4
upvote count: 4

http://stackoverflow.com/q/20923953
has answer: http://stackoverflow.com/a/20923987
type: UnansweredQuestion
tagged with: tablecelleditor
tagged with: jcombobox
has title: Java Swing : get index of combobox inside table
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/31419215
downvote count: 1
has answer: http://stackoverflow.com/a/20924266
type: Question
tagged with: java
tagged with: jtable
score: 0
answer count: 2
has body: I need to have combo boxes (JComboBox) in the first column of JTable. JTable table = new JTable(5,10); JCheckBox checkbox = new JCheckBox(); table.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(comboBox)); Now, how can I get selected index of combo box in a certain cell ? table.getModel().getValueAt(i, 0) returns a String. That's not what I need.
favorite count: 0

http://stackoverflow.com/comment/31424298
has text: This isn't homework, But I can add my attempts
comment on: http://stackoverflow.com/q/20928176
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/45877873
type: Answer
answers question: http://stackoverflow.com/q/20924149
has body: You can also do it this way. if(JOptionPane.showConfirmDialog(null, "Bla bla", "Bla bla", JOptionPane) == 0){ System.out.println("YES"); //The value zero represents index of first option which will be the YES option } else if(JOptionPane.showConfirmDialog(null, "Bla bla", "Bla bla", JOptionPane) == 1){ System.out.println("NO"); //The value one represents index of second option which will be the NO option } You can remove the index number and replace with the format you have so that it reads like this: if(JOptionPane.showConfirmDialog(null, "Bla bla", "Bla bla", JOptionPane) == JOptionPane.YES_OPTION){ System.out.println("YES"); option } else if(JOptionPane.showConfirmDialog(null, "Bla bla", "Bla bla", JOptionPane) == JOptionPane.NO_OPTION){ System.out.println("NO"); option } You can visit this YouTube link for more help JOptionPane Tutorial
score: 0

http://stackoverflow.com/a/21014810
answers question: http://stackoverflow.com/q/21014741
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3
score: 3
has body: Use Git Submodules With using it you can include other repositories and always get the latest code from them by updating the submodule.
accepted answer of: http://stackoverflow.com/q/21014741

http://stackoverflow.com/q/20933211
has comment: http://stackoverflow.com/comment/31433464
tagged with: java
has answer: http://stackoverflow.com/a/20933241
tagged with: split
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/31433469
type: Question
accepted answer: http://stackoverflow.com/a/20933241
has comment: http://stackoverflow.com/comment/31433646
has title: divide sentence into words and punctuations
upvote count: 2
has body: I need to parse class Sentence into word and punctuation (whitespace is considered as a punctuation mark), then add all of it into general ArrayList&lt;Sentence&gt;. An example sentence: A man, a plan, a canal — Panama! A => word whitespase => punctuation man => word , + space => punctuation a => word [...] I tried to read this whole sentence one character at a time and collect the same and create new word or new Punctuation from this collection. Here's my code: public class Sentence { private String sentence; private LinkedList&lt;SentenceElement&gt; elements; /** * Constructs a sentence. * @param aText a string containing all characters of the sentence */ public Sentence(String aText) { sentence = aText.trim(); splitSentence(); } public String getSentence() { return sentence; } public LinkedList&lt;SentenceElement&gt; getElements() { return elements; } /** * Split sentance into words and punctuations */ private void splitSentence() { if (sentence == "" || sentence == null || sentence == "\n") { return; } StringBuilder builder = new StringBuilder(); int j = 0; boolean mark = false; while (j &lt; sentence.length()) { //char current = sentence.charAt(j); while (Character.isLetter(sentence.charAt(j))) { if (mark) { elements.add(new Punctuation(builder.toString())); builder.setLength(0); mark = false; } builder.append(sentence.charAt(j)); j++; } mark = true; while (!Character.isLetter(sentence.charAt(j))) { if (mark) { elements.add(new Word(builder.toString())); builder.setLength(0); mark = false; } builder.append(sentence.charAt(j)); j++; } mark = true; } } But logic of splitSentence() isn't work correctly. And I can't to find right solution for it. I want to implement this as we read first character => add to builder => till next element are the same type (letter or punctuation) keep adding to builder => when next element are different than content of builder => create new word or punctuation and set builder to start. Do the same logic again. How to implement this ch…
answer count: 1

http://stackoverflow.com/a/20923509
has comment: http://stackoverflow.com/comment/31416423
type: Answer
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/20923436
score: 4
has body: The Date class is not meant for intervals. It is meant for specific moment in time. The following long wyn = goal - start; will be equal to around 3000. That's 3000 milliseconds after Unix Epoch when used as an argument for the Date constructor. Depending on your timezone, that will be some number of hours + 3 seconds. Consider using the Joda Time API which has an Interval interface you can use for calculating intervals.

http://stackoverflow.com/a/20961780
upvote count: 4
downvote count: 0
has body: When you call #{sessionBean.logout} it looks for the property logout in your SessionBean. However in your implementation, logout is a method and not a property. Therefore remember to add parenthesis () to indicate that it is a method and not a property. Change your code to: &lt;p:commandButton action="#{sessionBean.logout()}" value="logout" update="loginForm" ajax="false"&gt;&lt;/p:commandButton&gt;
has comment: http://stackoverflow.com/comment/31527908
score: 4
answers question: http://stackoverflow.com/q/20960414
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20960414
type: Answer

http://stackoverflow.com/a/20969246
score: 0
has body: Start with the below url. http://docs.seleniumhq.org/download/ Got to "Selenium Client &amp; WebDriver Language Bindings" section. Download Java version. Then just put the libraries from the downloaded file in your Java project library in eclipse. Start coding !!
type: Answer
answers question: http://stackoverflow.com/q/20965581

http://stackoverflow.com/comment/31531798
comment on: http://stackoverflow.com/a/20984697
type: Comment
has text: It is a side note but it is not the reason for the behaviour: in `someInstance.f`, `f` must be a field, whether static or not - `f` can't be a class name. I have edited for clarity.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31411248
has text: To get better answers please read: http://sscce.org/ There is much irrelevant code here..
comment on: http://stackoverflow.com/q/20921589
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/20883329
tagged with: java
tagged with: jaxb
has title: JAXB is not creating class for xsd email pattern element when compile using maven xjc
type: Question
has body: I am using xsd in which i am validation email like <xsd:element name="Company" type="Company"/> <xsd:complexType name="Company"> <xsd:sequence> <xsd:element name="Name" type="xsd:string" minOccurs="1" maxOccurs="1" /> <xsd:element name="Website" type="xsd:string" minOccurs="0" maxOccurs="1" /> <xsd:element name="Email" type="EmailAddress" minOccurs="0" maxOccurs="1" /> </xsd:sequence> <xsd:attribute name="AccountStatus" type="AccountStatus" use="optional" default="Active" /> </xsd:complexType> <xsd:simpleType name="EmailAddress"> <xsd:restriction base="xsd:string"> <xsd:pattern value="[A-Za-z0-9_]+([-+.'][A-Za-z0-9_]+)*@[A-Za-z0-9_]+([-.][A-Za-z0-9_]+)*\.[A-Za-z0-9_]+([-.][A-Za-z0-9_]+)*"/> </xsd:restriction> </xsd:simpleType> <xsd:simpleType name="AccountStatus"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="Active"/> <xsd:enumeration value="Inactive"/> </xsd:restriction> </xsd:simpleType> Here is my pom.xml file that is using xjc snippet org.codehaus.mojo jaxb2-maven-plugin 1.5 xjc generate-sources false src/main/java src/main/webapp/schemas **/*.xsd src/main/resources/bindings binding.xml false here is my binding.xml file <?xml version="1.0" encoding="UTF-8"?> <jaxb:bindings version="2.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"> <jaxb:bindings> <jaxb:globalBindings generateElementProperty="false" /> </jaxb:bindings> Here is the generated Company.java class @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Company", propOrder = { "name", "website", "email" }) public class Company { @XmlElement(name = "Name", required = true) protected String name; @XmlElement(name = "Website") protected String website; @XmlElement(name = "Email") protected String email; @XmlAttribute(name = "AccountStatus") protected AccountStatus accountStatus; //setter and getters } See there is no email pattern applying to my email attrubute. Why ? when i compile my code using maven compile then there is no EmailAddress.java cl…
upvote count: 1
answer count: 1
tagged with: maven-3
favorite count: 0
tagged with: xjc
has answer: http://stackoverflow.com/a/20883478
type: UnansweredQuestion
tagged with: xsd
downvote count: 0
score: 1

http://stackoverflow.com/q/20935606
tagged with: datatable
type: AnsweredQuestion
tagged with: jsf
score: 1
possible better answer: http://stackoverflow.com/a/20997209
tagged with: java
upvote count: 1
has body: I want to dynamically update the sum of dataSet values as I filter and/or paginate a Primefaces dataTable. The following jQuery example shows exactly the behavior I want: http://datatables.net/examples/advanced_init/footer_callback.html See below my main code for this issue: The jsf &lt;p:columnGroup type="footer"&gt; &lt;p:row&gt; &lt;p:column colspan="6" footerText="Grand Total:" style="text-align:right"/&gt; &lt;p:column colspan="7"&gt; &lt;f:facet name="footer"&gt; &lt;h:outputText value="#{purchaseOrderController.soma}"&gt; &lt;f:convertNumber pattern="###,###" locale="pl_PL"/&gt; &lt;/h:outputText&gt; &lt;/f:facet&gt; &lt;/p:column&gt; &lt;/p:row&gt; &lt;/p:columnGroup&gt; The method soma: private float soma; public float getSoma() { for (PurchaseOrder p : getItems()) { soma += p.getShippingCost().floatValue(); } return soma; } Can someone help me? Thanks in advance. Updated code The bean: @Named(value = "purchaseOrderController") @ViewScoped public class PurchaseOrderController extends AbstractController&lt;PurchaseOrder&gt; implements Serializable { private float soma = 0; private float somaFiltered = 0; private List&lt;PurchaseOrder&gt; filteredPurchaseOrder; public List&lt;PurchaseOrder&gt; getFilteredPurchaseOrder() { return filteredPurchaseOrder; } public void setFilteredPurchaseOrder(List&lt;PurchaseOrder&gt; filteredPurchaseOrder) { this.filteredPurchaseOrder = filteredPurchaseOrder; } //return the sum for the FILTERED list - using this method, get a NullPointerException (the filtered list is null) public float getSomaFiltered() { for (PurchaseOrder p : filteredPurchaseOrder) { somaFiltered += p.getQuantity() * p.getShippingCost().floatValue(); } return somaFiltered; } //return the sum for the ENTIRE list - using this method it's ok public float getSoma() { for (PurchaseOrder p : getItems()) { soma += p.getQuantity() * p.getShippingCost().floatValue(); } return soma; } @Inject private PurchaseOrderFacade ejbFacade; public PurchaseOrderController() { su…
type: Question
has answer: http://stackoverflow.com/a/22318947
answer count: 2
tagged with: primefaces
has title: Dynamic Calculation Using Filter in Datatable
downvote count: 0
accepted answer: http://stackoverflow.com/a/22318947
favorite count: 0
has answer: http://stackoverflow.com/a/20997209

http://stackoverflow.com/q/20863805
has body: A strange error when trying to start Activity. i think the error in my Animation Drawable LogCat: 12-31 06:37:45.138: E/AndroidRuntime(922): FATAL EXCEPTION: main 12-31 06:37:45.138: E/AndroidRuntime(922): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.MalekAlrwily.BasicVaccinations/com.MalekAlrwily.BasicVaccinations.Main}: android.view.InflateException: Binary XML file line #1: Error inflating class android.widget.RelativeLayout 12-31 06:37:45.138: E/AndroidRuntime(922): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211) 12-31 06:37:45.138: E/AndroidRuntime(922): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) 12-31 06:37:45.138: E/AndroidRuntime(922): at android.app.ActivityThread.access$600(ActivityThread.java:141) 12-31 06:37:45.138: E/AndroidRuntime(922): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) 12-31 06:37:45.138: E/AndroidRuntime(922): at android.os.Handler.dispatchMessage(Handler.java:99) 12-31 06:37:45.138: E/AndroidRuntime(922): at android.os.Looper.loop(Looper.java:137) 12-31 06:37:45.138: E/AndroidRuntime(922): at android.app.ActivityThread.main(ActivityThread.java:5103) 12-31 06:37:45.138: E/AndroidRuntime(922): at java.lang.reflect.Method.invokeNative(Native Method) 12-31 06:37:45.138: E/AndroidRuntime(922): at java.lang.reflect.Method.invoke(Method.java:525) 12-31 06:37:45.138: E/AndroidRuntime(922): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 12-31 06:37:45.138: E/AndroidRuntime(922): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 12-31 06:37:45.138: E/AndroidRuntime(922): at dalvik.system.NativeStart.main(Native Method) 12-31 06:37:45.138: E/AndroidRuntime(922): Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class android.widget.RelativeLayout 12-31 06:37:45.138: E/AndroidRuntime(922): at android.view.LayoutInflater.createView(LayoutInflater.java:620…
has answer: http://stackoverflow.com/a/22224065
tagged with: android
has answer: http://stackoverflow.com/a/20863852
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/31303150
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31303089
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31302918
has title: strange error in my Animation Drawable
has comment: http://stackoverflow.com/comment/31303334
tagged with: eclipse
has comment: http://stackoverflow.com/comment/31303048
has comment: http://stackoverflow.com/comment/31303292
type: Question
tagged with: logcat
answer count: 2

http://stackoverflow.com/q/20894689
tagged with: eclipse
has body: I've seen some solutions that people have posted, but I can't find the flaw in my code. It crashes on opening. Here's my Main activity. public class MainActivity extends Activity { Button guy, girl; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); guy = (Button) findViewById(R.id.bGuy); girl = (Button) findViewById(R.id.bGirl); guy.setOnClickListener(new View.OnClickListener() { public void onClick(View aView) { Intent toAnotherActivity = new Intent(aView.getContext(), ScreenGuy.class); startActivityForResult(toAnotherActivity, 0); } }); } } And the .xml for it &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=".MainActivity" &gt; &lt;TextView android:id="@+id/get_over" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="50dp" android:text="@string/get_over" android:textSize="20sp" /&gt; &lt;Button android:id="@+id/bGuy" android:layout_width="120dp" android:layout_height="40dp" android:layout_alignLeft="@+id/get_over" android:layout_below="@+id/get_over" android:layout_marginTop="66dp" android:text="@string/guy" android:onClick="sendMessage" /&gt; &lt;Button android:id="@+id/bGirl" android:layout_width="120dp" android:layout_height="40dp" android:layout_alignBaseline="@+id/bGuy" android:layout_alignBottom="@+id/bGuy" android:layout_alignRight="@+id/get_over" android:text="@string/girl" /&gt; I have another screen I want to move to on the button press of "Guy".
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has title: How do I move to a new activity in android?
possible better answer: http://stackoverflow.com/a/20894706
type: Question
has answer: http://stackoverflow.com/a/20894706
tagged with: android
score: 1
tagged with: android-activity
has answer: http://stackoverflow.com/a/20894710
answer count: 3
upvote count: 1
tagged with: android-intent
accepted answer: http://stackoverflow.com/a/20894710
has answer: http://stackoverflow.com/a/20894743
tagged with: java

google-app-engine
tags question: http://stackoverflow.com/q/20905905
tag name: google-app-engine
tags question: http://stackoverflow.com/q/20856016
type: Tag
tags question: http://stackoverflow.com/q/21005162
tags question: http://stackoverflow.com/q/20946493
tags question: http://stackoverflow.com/q/20945099
tags question: http://stackoverflow.com/q/20999456
tags question: http://stackoverflow.com/q/20944368
tags question: http://stackoverflow.com/q/20937071
tags question: http://stackoverflow.com/q/20881819
tags question: http://stackoverflow.com/q/20971834
tags question: http://stackoverflow.com/q/20973403
tags question: http://stackoverflow.com/q/20882174
tags question: http://stackoverflow.com/q/20856203
tags question: http://stackoverflow.com/q/21001260
tags question: http://stackoverflow.com/q/20852505
tags question: http://stackoverflow.com/q/20866807
tags question: http://stackoverflow.com/q/20942118
tags question: http://stackoverflow.com/q/20922779
tags question: http://stackoverflow.com/q/20994154
tags question: http://stackoverflow.com/q/20869422
tags question: http://stackoverflow.com/q/20901785
tags question: http://stackoverflow.com/q/21007597
tags question: http://stackoverflow.com/q/20937219
tags question: http://stackoverflow.com/q/20881565
tags question: http://stackoverflow.com/q/20873949
tags question: http://stackoverflow.com/q/21014186
tags question: http://stackoverflow.com/q/20896237
tags question: http://stackoverflow.com/q/20996548
tags question: http://stackoverflow.com/q/21007742
tags question: http://stackoverflow.com/q/20973879
tags question: http://stackoverflow.com/q/20915121
tags question: http://stackoverflow.com/q/20921400
tags question: http://stackoverflow.com/q/20938434
tags question: http://stackoverflow.com/q/20984275
tags question: http://stackoverflow.com/q/20870750
tags question: http://stackoverflow.com/q/20863612
tags question: http://stackoverflow.com/q/20910829
tags question: http://stackoverflow.com/q/20908174
tags question: http://stackoverflow.com/q/20893453
tags question: http://stackoverflow.com/q/20864482

http://stackoverflow.com/comment/31427546
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20929893
has text: BlueJ seems to use a wordpad as a console. That is it Channels the output into wordpad/notepad. Dos this mean I have to something else?
type: AnswerComment

http://stackoverflow.com/q/20956515
answer count: 1
has answer: http://stackoverflow.com/a/20956590
has comment: http://stackoverflow.com/comment/31477475
has body: I am new in Spring and i am trying to configure the Spring With Hibernate But I am getting the following Execepton. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private net.viralpatel.contact.service.ContactService net.viralpatel.contact.controller.ContactController.contactService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private net.viralpatel.contact.dao.ContactDAO net.viralpatel.contact.service.ContactServiceImpl.contactDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactDAOImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory net.viralpatel.contact.dao.ContactDAOImpl.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/spring-servlet.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'configurationClass' of bean class [org.springframework.orm.hibernate4.LocalSessionFactoryBean]: Bean property 'configurationClass' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:287) org.springframework.beans.facto…
type: AnsweredQuestion
type: Question
accepted answer: http://stackoverflow.com/a/20956590
tagged with: spring
has title: Error While Configuration Spring And Hibernate
score: 0
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/31418199
type: Comment
has text: Why not just do `dynamicClass = cl.loadClass(className);` again? Besides, what exactly are you trying to do anyway?
type: QuestionComment
comment on: http://stackoverflow.com/q/20925024
score: 0

http://stackoverflow.com/q/20872691
has title: Apache HttpClient Error: Target host must not be null, or set in parameters
has answer: http://stackoverflow.com/a/20879007
tagged with: http
type: Question
accepted answer: http://stackoverflow.com/a/20872754
tagged with: apache
tagged with: httpclient
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/20872754
type: AnsweredQuestion
has body: I'm trying to use Apache HttpClient to get a JSON response from a site's API but it's giving me a "IllegalStateException: Target host must not be null, or set in parameters." Java code: private String orderInURL = "https://r-test.ordr.in"; public String deliveryList(String datetime, String zip, String city, String addr) throws ClientProtocolException, IOException { String listURL = orderInURL+"/dl/" + datetime + "/" + zip + "/" + city + "/" + addr + "?_auth=1," + this.privateKey; DefaultHttpClient httpClient = new DefaultHttpClient(); HttpGet getRequest = new HttpGet(URLEncoder.encode(listURL, "UTF-8")); //header getRequest.setHeader("accept", "application/json"); HttpResponse response = httpClient.execute(getRequest); if (response.getStatusLine().getStatusCode() != 200) { throw new RuntimeException("Failed : HTTP error code : " + response.getStatusLine().getStatusCode()); } BufferedReader br = new BufferedReader( new InputStreamReader((response.getEntity().getContent()))); String output; System.out.println("Output from Server .... \n"); while ((output = br.readLine()) != null) { System.out.println(output); } httpClient.getConnectionManager().shutdown(); return output; } .... System.out.println(orderin.deliveryList("ASAP", "11111", "MyCity", "100 My Address")); The GET URL turns out to be: https://r-test.ordr.in/dl/ASAP/11111/MyCity/100%20My%20Address?_auth=1,XXXXXXXXXXXXXXXXX If you replace the XXXXXXXXX... with the private key. If I just copied this URL and put it in the browser, the correct JSON returns. I don't know why it doesn't return the correct result in Java. Any help appreciated.
possible better answer: http://stackoverflow.com/a/20879007
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/a/20881035
type: Answer
score: 4
upvote count: 4
accepted answer of: http://stackoverflow.com/q/20880793
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20880793
downvote count: 0
has body: Your problem is that drawRect takes start locations and sizes, not start locations and end locations. So it should be:- //drawRect(int x, int y, int width, int height) g.drawRect(x, y, 32, 32); Additionally This (x + 32 - x) and this (y + 32 - y) are the same as (32)

http://stackoverflow.com/a/20895484
has body: You declare local variable s in method create, so that you need to initialized it before you use it. Remember that java does not have default value for local variable. Init String s = "" or whatever value than your code will run normally.
type: Answer
downvote count: 1
answers question: http://stackoverflow.com/q/20895175
score: -1
upvote count: 0

http://stackoverflow.com/comment/31298427
score: 0
comment on: http://stackoverflow.com/q/20855288
type: Comment
type: QuestionComment
has text: @Jules yes, i have. but i hoped there is more 'elegant' solution =)

http://stackoverflow.com/comment/31517938
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20972317
has text: I have over 1000 files therefore I just limit the read files by substracting -740 from the `fileList.size()`. In fact this is just for `development mode`.

http://stackoverflow.com/a/20952259
has comment: http://stackoverflow.com/comment/31631342
has body: ServletContainer is also Jersey specific. Anyways you can create ResourceConfig directly from JAX-RS Application using ResourceConfig#forApplication or ResourceConfig#forApplicationClass. Then your code would look like: server.addServlet( new ServletHolder( new ServletContainer( ResourceConfig.forApplication(application))) , "/foo");
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/31631898
score: 0
accepted answer of: http://stackoverflow.com/q/20951852
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20951852
has comment: http://stackoverflow.com/comment/31671652
type: Answer

http://stackoverflow.com/q/20891355
has comment: http://stackoverflow.com/comment/31354675
type: UnansweredQuestion
tagged with: jlist
tagged with: swing
has comment: http://stackoverflow.com/comment/31355718
tagged with: model-view-controller
has comment: http://stackoverflow.com/comment/31354484
tagged with: java
has answer: http://stackoverflow.com/a/20891553
has comment: http://stackoverflow.com/comment/31355086
has title: JList showing old values when clicked
type: Question
has body: I've been trying real hard to understand MVC using Swing so I decided to try and make a very basic project and I think I'm close but now the JList isn't reacting like I would assume and I'm not seeing it. Could be tired, could be lacking knowledge. Probably both. My view class JList reflects adding or deleting a Person, but when I click it, it reverts to the old values, that -according to the console window- aren't even there anymore. The view class code is below, the entire project can be found here What am I doing wrong? Am I even "refreshing" the JList in a good way? Here's my view class: public class PersonView extends JFrame implements Observer, ActionListener { private static final long serialVersionUID = 1L; private JPanel contentPane; private JTextField textFieldFirstName; private JTextField textFieldLastName; private JButton btnAddPerson; private JButton btnDeletePerson; private JList listPersons; private Observable model; private ActionListener listener; public Observable getModel() { return model; } public void setModel(Observable model) { this.model = null; this.model = model; } public ActionListener getActionListener() { return listener; } public void setActionListener(ActionListener listener) { if (listener != null) this.listener = listener; } /** * Create the frame. */ public PersonView(Observable model) { if (model != null) this.setModel(model); setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JLabel lblFirstName = new JLabel("First Name"); lblFirstName.setBounds(10, 11, 68, 14); contentPane.add(lblFirstName); JLabel lblLastName = new JLabel("Last Name"); lblLastName.setBounds(10, 36, 68, 14); contentPane.add(lblLastName); textFieldFirstName = new JTextField(); textFieldFirstName.setBounds(80, 8, 142, 20); contentPane.add(textFieldFirstName); textFieldFirstName.set…
score: 0
answer count: 1

http://stackoverflow.com/comment/31365583
score: 0
has text: Did you experienced any problems with System.gc() or your judgement is based on documentation? Unless explicitly disable using -XX option System.gc() is pretty reliable on my practice.
comment on: http://stackoverflow.com/q/20893268
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31733104
type: AnswerComment
has text: @IamMe. `new LoadProfile().execute();` mistake no params in execute! 1 mistake. 2nd mistake `new LoadProfile().execute(username,password);` in doInbackground totally wrong.3 updating or accessing ui again in doinbackground wrong again
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21000080

http://stackoverflow.com/comment/31668147
has text: No it's not the porblem. I needed to reinstall windows. So, I removed every programs and reinstalled everything. Now I only have java 64 bit version installed but still the same problem.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20977062

http://stackoverflow.com/comment/31548590
comment on: http://stackoverflow.com/a/20984419
type: AnswerComment
score: 0
has text: I get the following output: Name, Raagu,Rajath,Sarath,
type: Comment

http://stackoverflow.com/comment/31529119
type: Comment
has text: They key thing is is "pre-calculate" the result (via a totals concept) as your go. Implement based on "best practice".
comment on: http://stackoverflow.com/a/20970592
score: 0
type: AnswerComment

http://stackoverflow.com/a/20957793
has body: Thanks everyone for your insights and answers. I'd like to credit this answer to John Kolen (http://www.johnfkolen.com) who has presented a feasible solution as follows: A Greedy Algorithm for Maximal Coverage of Triples Input: A set, with subsets A x B x C, of triples, where A, B, and C are sets of integers. Output: A set of n triples (A_i, B_i, C_i), where A_i in A, B_i in B, and C_i in C, and Union_i A_i x B_i x C_i = X and Intersection_i A_i x B_i x C_i = empty. Algorithm The algorithm can be broken into three parts: finding pair covers, finding triple covers, and finally constructing a total cover. Finding covers of pairs from a subset of B x C involves building a map from elements of B to sets of C. Essentially a small prefix tree, or trie, this data structure makes it easy to find the maximal cover a set of prefixes. For instance, if b_1->C_1 and b_2->C_2, then the maximal cover involving b_1 and b_2 will be &lt;[b_1,b_2],C_1 intersection C_2>. Once we can find maximal pairs, then it's possible to construct maximal triples. This time, however, the prefix (A) maps to a set of pairs (BxC). By using the previous method it's possible to find examine all subsets of A and their matching pair coverage over the suffixes. The greedy approach finds the locally best cover and adds it to the solution set. The triples captured by the current cover are removed from consideration, and the process continues until the locally best cover is a singleton. The remaining triples are added to the solution. The relevant code is attached. import java.io.IOException; import java.io.FileReader; import java.io.BufferedReader; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Set; import java.util.Arrays; class Triples { private ArrayList&lt;int[]&gt; _data; private HashMap&lt;Integer,HashSet&lt;Integer&gt;&gt; _tree; /** * Instantiates a container of triples read from the provided file. * &lt;p&gt; * File should contain lines of the form '[…
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20890802

http://stackoverflow.com/a/20894273
answers question: http://stackoverflow.com/q/20894106
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/20894106
type: AcceptedAnswer
downvote count: 0
has body: Yes. That's one of the differences between libraries/toolkits and frameworks: the formers are lighter and less intrusive but require more glue code.

http://stackoverflow.com/comment/31462404
has text: Better to add a return statement inside the loop and return null at the end of your method. If you found already an account with the given id, no need to loop through the rest of the elements in the list.
type: AnswerComment
comment on: http://stackoverflow.com/a/20948683
type: Comment
score: 2

http://stackoverflow.com/a/20893951
downvote count: 0
has comment: http://stackoverflow.com/comment/33588118
type: Answer
has body: You should look for the search view in your fragment's view, not in your activity's view. Change searchView1 = (SearchView) getActivity().findViewById(R.id.searchView1); to searchView1 = (SearchView) rootView.findViewById(R.id.searchView1);
score: 3
accepted answer of: http://stackoverflow.com/q/20893905
answers question: http://stackoverflow.com/q/20893905
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/q/20999211
answer count: 1
accepted answer: http://stackoverflow.com/a/20999323
linked to: http://stackoverflow.com/q/4952316
tagged with: jdbc
tagged with: prepared-statement
has answer: http://stackoverflow.com/a/20999323
type: AnsweredQuestion
has body: I have a Question to ExceptionHandling on java.sql.PreparedStatement. I have an PreparedStatement: insertTEZDETAIL = new XPreparedStatement(con, "INSERT INTO TEZDETAIL (PACKAGE_ID, LFDNR, ARCHIVTAG, PAYINF)" + " Values(?, ?, ? ,XMLPARSE(DOCUMENT CAST(? AS CLOB)))" ); and Add many Statements in Batch: insertTEZDETAIL.setInt(1, paket_id); insertTEZDETAIL.setInt(2, Counter1); insertTEZDETAIL.setString(3, archiv_dat); SQLXML xmlvar = con.createSQLXML(); xmlvar.setString(gesXML.toString()); insertTEZDETAIL.setSQLXML(4, xmlvar); insertTEZDETAIL.addBatch(); Now I execute it Batch: public static void DB2Commit() { try { insertTEZDETAIL.executeBatch(); } catch (SQLException ex) { for ( ; ex != null ; ex = ex.getNextException ()) { ex.printStackTrace (); } try { con.rollback(); } catch (SQLException e) { e.printStackTrace(); System.exit(12); } System.err.println("Fehler beim execute Batch"); System.exit(12); } } With the "Forech exception loop" I get all Exception, but it there a way to get the GeneratedKey's of this Statement where the exception is? With RETURN_GENERATED_KEYS it doesnt work, may because of the Batch?? Or maybe to get the Statement it self?? Because I have a class to printout the complete Statement with generatedKey's, just like the DB2 get the Statement. Thanks for Answers, Florian
tagged with: java
has title: Exception Handling on PreparedStatements ExecuteBatch() (not to get the Exception but the Statement itself)
type: Question
score: 0
tagged with: sql

http://stackoverflow.com/q/20891246
type: Question
accepted answer: http://stackoverflow.com/a/20891826
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/20891826
tagged with: selenium-webdriver
type: AnsweredQuestion
has body: I have to test an "old fashioned" web application which uses inner frames.Just like: &lt;html&gt; .... &lt;frameset name="fooSet"&gt; &lt;frame name="myFrame"&gt; &lt;html&gt; ..... &lt;frame name="whatever"&gt; ..... &lt;/html&gt; .... &lt;/html&gt; I used rekursions to read all frames... the only question I have now is if there is a way to store a handler for the frame just like a windowsHandler..like: WebDriver driver = new HtmlUnitDriver(); driver.get(Constant.URL); WebDriver fooDriver = driver.switchTo().frame("myFrame"); String handler = fooDriver.getWindowHandle(); My intention is that I could easily navigate to the frame once the focus is lost, otherwise I have to iterate again over all frames to get the one I want to pick.
score: 1
has title: Handling InnerFrames with Selenium
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/31479665
score: 0
has text: Just curious about your design choice. Why not go with a more standard option that users are more likely to understand? For example adding a delete button to the edit page, using a contextual action bar to offer the delete button, or using gestures allowing users to swipe the list item to delete the alarm.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20957504

http://stackoverflow.com/comment/31357878
has text: You are welcome, If your program does as the picture shows then it works properly since both graphs are planar. The way they look like doesnt effect the rule, check this for the explanation: !(https://thecafe.me/image/1/Nicholas_uOpsc.jpg).
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/20891718
type: Comment

http://stackoverflow.com/comment/79156834
type: AnswerComment
type: Comment
has text: @LucasMorgan It will remove it. Sounds like you have something else wrong in your code.
score: 1
comment on: http://stackoverflow.com/a/20885039

http://stackoverflow.com/q/20986566
downvote count: 0
tagged with: label
answer count: 3
accepted answer: http://stackoverflow.com/a/20997256
has answer: http://stackoverflow.com/a/28554264
tagged with: height
favorite count: 0
has answer: http://stackoverflow.com/a/21000964
type: AnsweredQuestion
has title: JavaFX labels height
upvote count: 5
tagged with: java
tagged with: scenebuilder
tagged with: javafx
possible better answer: http://stackoverflow.com/a/21000964
has answer: http://stackoverflow.com/a/20997256
type: Question
score: 5
has body: I'm developing software in JavaFX and JavaFX Scene Builder. I have a grid pane with 2 columns. Actually in each of the cells there are labels. In the first column of the table the text inside the label is a default constant, in the second one the text can change. The problem is that if the text variable is too long, it's automatically truncated. How to start a new line trimming the text and re-sizing the height of the rows in the grid pane? EDIT: Thanks to @fabian issues, this is the solution to the initial question. In addiction is necessary to set the fx:id of each element into Scene Builder. @FXML private GridPane gridPane; @FXML private Text text1; @FXML private Text text2; @FXML private Text text3; private void setGridRowHeight(GridPane gpName, int numRow, double height){ ObservableList&lt;RowConstraints&gt; rows = gpName.getRowConstraints(); rows.get(numRow).setMinHeight(32); rows.get(numRow).setPrefHeight(height); rows.get(numRow).setMaxHeight(height); } private void addTextListener(final GridPane gridPane, final Text text){ text.textProperty().addListener(new ChangeListener&lt;String&gt;() { @Override public void changed(ObservableValue&lt;? extends String&gt; observable, String oldValue, String newValue) { scrollPane.setFitToHeight(true); text.setWrappingWidth( gridPane.getColumnConstraints().get(1).getPrefWidth() ); setGridRowHeight(gridPane, gridPane.getRowIndex(text), text.getLayoutBounds().getHeight() ); } }); } @FXML public void initialize() { addTextListener(gridPane, text1); addTextListener(gridPane, text2); addTextListener(gridPane, text3); }

http://stackoverflow.com/q/20870122
downvote count: 0
score: 1
favorite count: 0
tagged with: xor
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/20870177
has title: Dividing images into parts
tagged with: java
tagged with: image-processing
tagged with: bufferedimage
type: Question
has answer: http://stackoverflow.com/a/20870188
answer count: 2
has body: i am doing XOR of pixel values using the following code BufferedImage bi=ImageIO.read(new File(1.bmp)); BufferedImage img = new BufferedImage(bi.getWidth(),bi.getHeight(),BufferedImage.TYPE_INT_RGB); int[] pixel; for (int y = 0; y &lt; bi.getHeight(); y++) { for (int x = 0; x &lt; bi.getWidth(); x++) { pixel = bi.getRaster().getPixel(x, y, new int[3]); img.setRGB(x, y, col); } }

http://stackoverflow.com/a/20914040
has body: You don't need to crawl IMDB, you can use the dumps they provide: http://www.imdb.com/interfaces There's also a parser for the data they provide: https://code.google.com/p/imdbdumpimport/ it's not perfect but maybe it will help you (you can expect spending some effort to make it work). An alternative parser: https://github.com/dedeler/imdb-data-parser EDIT You're saying you want to crawl IMDB anyway for learning purposes. So you'll probably have to go with http://en.wikipedia.org/wiki/Content_negotiation as suggested in the other answer: uc.setRequestProperty("Accept-Language", "de; q=1.0, en; q=0.5");
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/20913728
downvote count: 0
has comment: http://stackoverflow.com/comment/31397961
has comment: http://stackoverflow.com/comment/31397879
type: Answer

http://stackoverflow.com/a/20987438
score: 0
has body: Debug/Run Configuration icon drop down list show recent file use to run project recently. That dropdown list items is not related to list display under Debug Configurations dialog.
type: Answer
answers question: http://stackoverflow.com/q/20987306

http://stackoverflow.com/a/20905229
has comment: http://stackoverflow.com/comment/31380027
has body: If the processing is quick and your changes involve more interaction with Swing than just repaint() then a SwingTimer would be appropriate as you will already be on the correct thread. Reasons: SwingTimer is quick, you don't need thread switches to update Swing - but the UI is frozen while you are processing so if you need any time players will notice. If the processing might take some time and you need Swing interaction then use a SwingWorker. Reasons: Swing worker is set up to handle the passing of messages back and forth between Swing and a worker thread for you. Otherwise use a ScheduledExecutorService and scheduleAtFixedRate (which will mean you are called every 40ms even if your processing takes 0, 5, 10 or 20ms). The repaint() method is safe to call from off the EDT. Reasons: ScheduledExecutorService is the standard way for scheduling tasks to be executed in Java. It handles once off and repeated execution and it will keep your updates consistently paced even if your execution times vary (so long as you don't take more than 40ms). You can call repaint() from any thread so you have no extra thread synchronization to worry about. As a side note, this architecture is fine for a simple game, but you should consider that in a more complex game updates may take longer than 40ms and think of ways to compensate.
type: Answer
score: 2
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/31380447
answers question: http://stackoverflow.com/q/20905171
has comment: http://stackoverflow.com/comment/31390008
has comment: http://stackoverflow.com/comment/31380195

http://stackoverflow.com/comment/31521231
comment on: http://stackoverflow.com/a/20979108
score: 0
type: Comment
has text: initially the hosts file has localhost entry, but still getting same problem Moreover, i'm using latest version of eclipse.
type: AnswerComment

http://stackoverflow.com/q/20952713
has body: I'm trying to package a project using OptaPlanner 6.0.1 libraries into a .jar through IntelliJ IDEA's jar artifact but instead of my manifest.mf containing the standard Manifest-Version: 1.0 Main-Class: a.b.c.app the jar uses the one supplied in ecj-3.7.2.jar, one of OptaPlanner's supporting libraries: Manifest-Version: 1.0 Build-Jdk: 1.6.0_26 Built-By: ibrandt Created-By: Apache Maven Archiver-Version: Plexus Archiver Because of this, a "no main manifest attribute, in appname.jar" error happens when trying to run the app. If I manually replace the manifest in .jar file with mine everything works correctly. Is there anything I can do to fix this? I keep the libraries in a separate /lib directory and they were added to the root of jar artifact as Extracted Directory, IntelliJ IDEA is v13.0.1.
has answer: http://stackoverflow.com/a/41245953
has answer: http://stackoverflow.com/a/21074091
score: 108
has answer: http://stackoverflow.com/a/33684513
has comment: http://stackoverflow.com/comment/31470718
has comment: http://stackoverflow.com/comment/31480402
upvote count: 108
has answer: http://stackoverflow.com/a/33015735
downvote count: 0
has answer: http://stackoverflow.com/a/75857047
possible better answer: http://stackoverflow.com/a/20954612
accepted answer: http://stackoverflow.com/a/21074091
tagged with: optaplanner
favorite count: 0
has answer: http://stackoverflow.com/a/20954612
answer count: 9
has comment: http://stackoverflow.com/comment/57689289
has answer: http://stackoverflow.com/a/20966492
linked to: http://stackoverflow.com/q/17024715
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/78655960
has answer: http://stackoverflow.com/a/34744643
has title: Wrong Manifest.mf in IntelliJ IDEA created .jar
linked to: http://stackoverflow.com/q/42196697
type: Question
tagged with: intellij-idea

http://stackoverflow.com/comment/31587167
type: QuestionComment
has text: Just remove the loop, and add a @Override annotation and you should be fine
comment on: http://stackoverflow.com/q/21015306
score: 0
type: Comment

http://stackoverflow.com/q/20895982
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31411054
has comment: http://stackoverflow.com/comment/31400808
favorite count: 0
has comment: http://stackoverflow.com/comment/31363349
type: Question
upvote count: 2
tagged with: android
has body: Eskil Abrahamsen Blomfeldt has a post on his blog showing how to call QtActivity/(HangmanActivity) static Java methods from C++ here. He mentions that he only uses static methods because this is easier (indeed) and nothing more is needed in his example. Quote: In my game, the Activity is a singleton, so I store a static reference to the object in the constructor. (My C++ Data class has the same logic. I’m doing this so that I can facilitate the communication between the Java and the C++ code using static methods. For a more complex example, it’s also possible to store references and pointers in each C++ and Java object that maps it to its equivalent in the other language, but that is not necessary in this game.) Calling the static method works. Calling the non-static method does not work(function is never entered). If I call the non-static method connectBluetooth() in onCreate() it works. Is there a way to be able to call and not have the non-static method in onCreate()? EDIT: I figured I'll add some code. I have extended the QtActivity class: package org.qtproject.qt5.android.bindings; import org.qtproject.qt5.android.bindings.QtApplication; import org.qtproject.qt5.android.bindings.QtActivity; import android.bluetooth.BluetoothAdapter; import android.content.Intent; import android.os.Bundle; import android.util.Log; import java.lang.String; public class MyActivity extends QtActivity { private BluetoothAdapter bluetoothAdapter; private static final int ENABLE_BLUETOOTH_REQUEST = 1; public MyActivity() { Log.d(QtApplication.QtTAG, "MyActivity constructor called"); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public void onDestroy() { super.onDestroy(); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { Log.d(QtApplication.QtTAG, "onActivityResult entered"); if(requestCode == 1) { if(requestCode == 1) { if(resultCode == RESULT_OK) { Log.d(QtApplication.QtTAG, "Us…
has comment: http://stackoverflow.com/comment/31400944
tagged with: qt
tagged with: c++
has comment: http://stackoverflow.com/comment/31400329
tagged with: java
has comment: http://stackoverflow.com/comment/31365550
has comment: http://stackoverflow.com/comment/31400688
linked to: http://stackoverflow.com/q/17269631
has title: How to call non-static Java method in QtActivity from C++/Qt
answer count: 1
has comment: http://stackoverflow.com/comment/31400740
tagged with: qtandroidextras
has answer: http://stackoverflow.com/a/20925435
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31400728

http://stackoverflow.com/comment/48313085
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20859034
has text: downvote since JBoss EAP 6.1 is Java EE 6 which supports the asynchronous execution of methods by container managed thread pools. These pools were introduced by the Java EE gremium because queues were abused for having a "virtual" scalability by letting the scaling beeing done the the queue worker threads. you can scale in a Java EE 6 container and you even can collect the results, but you have to used @Asynchronous methods.

http://stackoverflow.com/comment/32414114
type: AnswerComment
type: Comment
has text: @PrakharDixit not sure about IE, haven't used it for a while. However, there is nice firefox tool for same use case: http://www.restclient.net/
comment on: http://stackoverflow.com/a/21033738
score: 0

http://stackoverflow.com/a/20992182
score: 0
answers question: http://stackoverflow.com/q/20990188
type: Answer
has body: Without knowing much about your application, but I would try to apply java declarative security for my role based solution as much as possible. If it is easy for you to use the java ee declarative security then go for it. It is simple, flexible and using standards which will give you the safety you request and the ability to port your solution to different java web server providers. Maybe a url rewriter (apache in front of the web application can help to reorganize); can split the destinations, and for that in your java web server set the url patterns which will expect different user roles for the read/view and update/write grantings permissions. This will need some few changes to achieve, but you would definitely not need to change your 4k codebase and you will by this reach a clean solution. Search for e.g. setting up role based security or java declarative security some reading with demo... http://www.thecoderscorner.com/team-blog/hosting-servers/17-setting-up-role-based-security-in-tomcat#.Us0eShoeK-Y

http://stackoverflow.com/q/20991347
has body: I have a command like this: Ant Command: &lt;path-to-ant/bin/ant -f build.xml sql -lib &lt;path-to-lib&gt;/lib -Dhome=path-home -Ddev=path-to-dev -DsdkMode=install -DcompileSource.dest=path-to-dest -DOSTEMP=/tmp -D-BIFLocation=path-to-loation -DexecutionDirectory=path-exec-dir At beggining, we use ProcessBuilder builder = new ProcessBuilder(command); to run this, currentlyric we want to run it with ANT API, so we build it with ant Project. I just build a method like: // string value after "-f" is the location of buildFile File buildFile = new File(antCommand.get((antCommand.indexOf("-f")+ 1))); // string value before "-lib" is the target to run String traget = antCommand.get((antCommand.indexOf("-lib")- 1)); Project project = new Project(); project.setUserProperty("ant.file", buildFile.getAbsolutePath()); project.init(); //set logger DefaultLogger consoleLogger = new DefaultLogger(); consoleLogger.setErrorPrintStream(System.err); consoleLogger.setOutputPrintStream(System.out); consoleLogger.setMessageOutputLevel(Project.MSG_INFO); project.addBuildListener(consoleLogger); ProjectHelper projectHelper = ProjectHelper.getProjectHelper(); project.addReference("ant.projectHelper", projectHelper); projectHelper.parse(project, buildFile); project.executeTarget(traget); But I do NOT know how to pass the parameter from the command line that starts with -D using Java. Anyone have ideas or such experience? Thank you very much.
type: Question
tagged with: ant
score: 0
answer count: 1
has title: How to pass an ant command line parameter to ant java project?
has answer: http://stackoverflow.com/a/20991476
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/31591667
score: 1
type: Comment
has text: Use byte array instead. `byte[] pixels = ((DataBufferByte) bufferedImage.getRaster().getDataBuffer()).getData();` http://stackoverflow.com/questions/6524196/java-get-pixel-array-from-image
type: QuestionComment
comment on: http://stackoverflow.com/q/21017828

http://stackoverflow.com/comment/31278263
type: QuestionComment
has text: possible duplicate of [Android Application with android-support-v4.jar added to lib facing error while trying to sign in using progaurd in IntelliJ Idea](http://stackoverflow.com/questions/9949634/android-application-with-android-support-v4-jar-added-to-lib-facing-error-while)
score: 0
comment on: http://stackoverflow.com/q/20851069
type: Comment

http://stackoverflow.com/comment/31565621
score: 0
type: AnswerComment
has text: just developing the app for learning so didn't setup the logs in the app yet
type: Comment
comment on: http://stackoverflow.com/a/20983170

http://stackoverflow.com/a/22739141
has comment: http://stackoverflow.com/comment/34667098
downvote count: 0
has comment: http://stackoverflow.com/comment/34666720
has body: If you know that the sum of all the long values in your array/list will never exceed the Long.MAX_VALUE value, you can use the following to calculate the average: // For long type array long[] array = ...; double average = LongStream.of(array).average().getAsDouble(); // For long type list List&lt;Long&gt; list = ...; double average = list.stream().mapToLong(n -&gt; n).average().getAsDouble(); But if you're unsure about the sum of your list, and that it can even exceed the maximum limit that long primitive provides, then use the following method to calculate the average: // For long type array long[] array = ...; BigInteger sum = LongStream.of(array).mapToObj(BigInteger::valueOf).reduce((x, y) -&gt; x.add(y)).get(); BigDecimal average = new BigDecimal(sum).divide(BigDecimal.valueOf(array.length)); // For long type list List&lt;Long&gt; list = ...; BigInteger sum = list.stream().map(BigInteger::valueOf).reduce((x, y) -&gt; x.add(y)).get(); BigDecimal average = new BigDecimal(sum).divide(BigDecimal.valueOf(list.size())); This technique works from Java 8 and following imports are required: import java.math.BigDecimal; import java.math.BigInteger; import java.util.stream.LongStream;
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/20952230

http://stackoverflow.com/comment/31378455
score: 0
type: Comment
type: QuestionComment
has text: You should take a look here : http://stackoverflow.com/questions/9684105/calling-javascript-functions-from-a-java-applet
comment on: http://stackoverflow.com/q/20904548

http://stackoverflow.com/a/20883969
type: AcceptedAnswer
downvote count: 0
has body: Use &lt;br/&gt; where you want to break line.
type: Answer
answers question: http://stackoverflow.com/q/20883880
has comment: http://stackoverflow.com/comment/31340117
upvote count: 3
accepted answer of: http://stackoverflow.com/q/20883880
has comment: http://stackoverflow.com/comment/31339928
score: 3
has comment: http://stackoverflow.com/comment/31339952
has comment: http://stackoverflow.com/comment/31340465

http://stackoverflow.com/a/20902288
upvote count: 1
has body: There is nothing wrong with your Java code. The problem is that there are erroneous (extra) entries in your web.xml due to which you start the Local Development Server, there is an error and hence the context is not initialized correctly. As a result, though the server is running, you get an error when you try to access the /sign endpoint. To fix the problem, do the following : Currently your web.xml is shown below: <?xml version="1.0" encoding="utf-8"?> SignGuestbookServlet guestbook.SignGuestbookServlet SignGuestbookServlet /sign Guestbook guestbook.GuestbookServlet Guestbook /guestbook guestbook.jsp Remove the entries for : Guestbook guestbook.GuestbookServlet Guestbook /guestbook Your final web.xml should look like: <?xml version="1.0" encoding="utf-8"?> SignGuestbookServlet guestbook.SignGuestbookServlet SignGuestbookServlet /sign guestbook.jsp Save your web.xml. Stop the Local Server. Start the Local Server again. And all should be fine.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31380493
type: Answer
accepted answer of: http://stackoverflow.com/q/20901785
answers question: http://stackoverflow.com/q/20901785
score: 1

http://stackoverflow.com/a/20953779
upvote count: 1
answers question: http://stackoverflow.com/q/20953553
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31472558
has body: Firstly, we need to look at what the crypt function in PHP does. php.net states: "crypt() will return a hashed string using the standard Unix DES-based algorithm or alternative algorithms that may be available on the system." Let's assume it's DES, even though DES isn't a hashing algorithm. Ok, so now we know what "hash" function is used, it's simply a case of implementing it another language (pedantry aside for now, hash functions should always return the same output given the same input). Here is a link that shows how to implement DES in Java: http://www.mkyong.com/java/jce-encryption-data-encryption-standard-des-tutorial/ Aside, DES is badly broken and should be avoided. At minimum I would recommend SHA-2 for hashing. Additionally, you can't (again, pedantry aside) "decrypt" a hash as hash functions are one way.

http://stackoverflow.com/comment/31577245
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21007475
has text: They're easy to find. Users of them, less so.

http://stackoverflow.com/q/20918967
has comment: http://stackoverflow.com/comment/31530292
tagged with: java.util.scanner
type: UnansweredQuestion
has body: I am trying to get input from the Scanner class, but every time I call it, it crashes the entire program. When trying to catch the exception and print the message, nothing shows up, so I am not even sure what the root of the problem is. Some background info is that this class is being called by the main method, which also has a Scanner that was running, but is closed before this class's method is called. public class UserHandler { static Scanner userInput1 = new Scanner(System.in); static void addInterface() throws IOException, FileNotFoundException{ boolean addMore = true; while(addMore){ System.out.println("Please enter restaurant name: "); String name = userInput1.next(); if(!FileHandler.containsName(name)){ System.out.println("Name already exists!"); }else{ String[] tags = new String[5]; System.out.print("\nPlease enter tags seperated by spaces: "); for(int i = 0; i &lt; tags.length; i++){ if(userInput1.hasNext()){ tags[i] = userInput1.next(); } else{ break; } } FileHandler.addName(name,tags); } } } } I have tried several times, and was not able to reproduce this issue. I am assuming it is something to do with syntax, or something that is just not called properly. Either way I have spent quite some time trying to fix it, but to no avail.
has comment: http://stackoverflow.com/comment/31406400
has comment: http://stackoverflow.com/comment/31406391
has title: Java - Scanner not asking for input, and then crashing
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20921061
score: 0
has comment: http://stackoverflow.com/comment/31406428
answer count: 1

http://stackoverflow.com/comment/139993263
has text: @ArvindKumarAvinash And… [that constructor](https://docs.oracle.com/en/java/javase/23/docs/api/java.base/java/util/Locale.html#%3Cinit%3E(java.lang.String,java.lang.String)) is officially deprecated.
type: AnswerComment
comment on: http://stackoverflow.com/a/79379222
score: 0
type: Comment

http://stackoverflow.com/comment/31491215
score: 0
comment on: http://stackoverflow.com/q/20963142
has text: Could you add a common interface to `XResult` and `XStatus`, use a factory to get your instance and then just program to that interface?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31278044
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20850822
has text: You may find solution form your problem here. http://stackoverflow.com/questions/10828182/spannablestringbuilder-to-create-string-with-multiple-fonts-text-sizes-etc-examp
score: 0

http://stackoverflow.com/q/21009870
upvote count: 31
accepted answer: http://stackoverflow.com/a/21011090
tagged with: java
tagged with: javadoc
tagged with: eclipse
type: Question
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/31577448
answer count: 1
has answer: http://stackoverflow.com/a/21011090
downvote count: 0
has body: Eclipse is able to provide warnings if Javadoc has been unfulfilled for a particular method or field. These fields/methods can be grouped by scope (public, protected, etc). I have found this very useful indeed when preparing my software for submission for university or whatever. Is this not possible in IntelliJ? Note that I am aware that you can hit "/**" just before a method in IntelliJ and it will fill it out. This isn't exactly what I'm after. Also note that I'm using IntelliJ 13.01 Community Edition.
favorite count: 0
score: 31
type: AnsweredQuestion
has title: How do I get IntelliJ to give me a warning if I have failed to provide JavaDoc description/annotation for public fields and methods?

http://stackoverflow.com/comment/31457350
type: Comment
has text: Note that some aspects of this (the interning, sharing/not sharing of backing arrays) are essentially dependent on the VM and should _not_ be relied upon for anything other than what it's used for: to cut down on memory used/as an optimization. Hoping for other, undocumented, functionality (ie comparing two strings with `==`) is going to get you in trouble.
score: 0
comment on: http://stackoverflow.com/a/20945113
type: AnswerComment

http://stackoverflow.com/q/20977904
tagged with: adt
has body: -I am encountering "Syntax error on token "boolean", invalid Expression" error in if/else part or the code below . Am getting this error 3 times on all "else/if" lines. -Another error I am getting is on the last "else" that i have to insert a ";" after the statement which is not resolving anything. package com.dey2929.bmihealth; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.Menu; import android.widget.TextView; public class ResultActivity extends Activity { TextView result; TextView review; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_result); result = (TextView) findViewById(R.id.tvmybmi); review = (TextView) findViewById(R.id.review); Intent intent = getIntent(); String YourBmi = intent.getStringExtra("YourBmi"); result.setText(" Your BMI is: " + YourBmi); if (boolean.valueof(YourBmi) &lt;= 18.0) { review.setText("You are Underweight "); } else if ((boolean.valueof(YourBmi) &gt; 18.0 &amp;&amp; boolean.valueof(YourBmi) &lt; 25.0 )) { review.setText("You are Normal (healthy weight) "); } else ((boolean.valueof(YourBmi)) &gt; 25.0) { review.setText("You are Overweight"); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.result, menu); return true; } @Override protected void onPause() { super.onPause(); finish(); } } UPDATE: EDIT- Error only in the last else line is left i.e. The left-hand side of an assignment must be a variable -Syntax error, insert ";" to complete Statement Insert assignment operator expression to complete assignment. modified code : package com.dey2929.bmihealth; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.Menu; import android.widget.TextView; public class ResultActivity extends Activity { TextView result; TextView review; @O…
has comment: http://stackoverflow.com/comment/31518871
score: 0
possible better answer: http://stackoverflow.com/a/20977926
has answer: http://stackoverflow.com/a/20977926
has answer: http://stackoverflow.com/a/20978103
tagged with: android
has comment: http://stackoverflow.com/comment/31519109
has title: Syntax error on token "boolean", invalid Expression
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20978181
tagged with: java
has answer: http://stackoverflow.com/a/20977959
accepted answer: http://stackoverflow.com/a/20978103
has comment: http://stackoverflow.com/comment/31517877
type: Question

http://stackoverflow.com/comment/31493316
type: Comment
has text: @GrlsHU Thank You So much my error was "I was using the layout id of the outter most layout i removed that and add another layout inside of that and it works perfect :) :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20883156

http://stackoverflow.com/a/20920252
score: 8
answers question: http://stackoverflow.com/q/20901210
has comment: http://stackoverflow.com/comment/75650005
has comment: http://stackoverflow.com/comment/43437456
downvote count: 1
upvote count: 9
has body: I am the CometD project lead. CometD ships with a demo war file that has a built-in chat application that you can use as a basis to understand how CometD works, see https://docs.cometd.org/current/reference/#_installation. The CometD full reference documentation is here: https://docs.cometd.org. From experience, I don't recommend using Servlet 3.0 async features to implement a chat, because that will rule out usage of WebSocket. It's better you rely on frameworks such as CometD that can start with WebSocket (as it is more efficient) and then fallback automatically and transparently to HTTP if WebSocket does not work. On a similar note, I don't recommend a WebSocket only approach because WebSocket does not work in certain scenarios (for example, mobile networks often do not allow WebSocket traffic), and it's a too low-level protocol so you will have to build your own protocol on top of WebSocket (which is a lot of work and not easy to get right). CometD provides you with an easy to extend protocol and automatic transport fallback, and has a ton of features (e.g. authorization &amp; authentication and clustering just to mention two).
type: Answer

http://stackoverflow.com/q/20898675
favorite count: 0
has comment: http://stackoverflow.com/comment/31367689
has comment: http://stackoverflow.com/comment/31370011
has comment: http://stackoverflow.com/comment/31367734
has title: Java BigDecimal
has comment: http://stackoverflow.com/comment/31370043
upvote count: 0
linked to: http://stackoverflow.com/q/7539
type: UnansweredQuestion
type: Question
has body: What is the 3 for in the below code: To suite your fancy better here is the original question: public float getOrderTotal(float taxRate) { BigDecimal total = new BigDecimal("0.0", 3); for (int i = 0; i &lt; orderItems.length(); i++) { total.add(String.valueOf(orderItems[i].getCost(taxRate))); } return total.setScale(2, BigDecimal.ROUND_UP).floatValue(); }
score: -2
tagged with: java
tagged with: bigdecimal
answer count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/20898800
has answer: http://stackoverflow.com/a/20898712
has comment: http://stackoverflow.com/comment/31370088
has comment: http://stackoverflow.com/comment/31367730

http://stackoverflow.com/q/20902354
has body: Actually I want to increase font size in eclipse of my editor but the post which I found this two post on stackoverflow Post1, Post2 First of all some of the good answers are saying that Goto General → Appearance → Colors and Fonts → Java Editor text font But I don't want to increase font size only for java editor but for eack and every editor Can Someone please tell me how to do it for every editor.
accepted answer: http://stackoverflow.com/a/20902571
linked to: http://stackoverflow.com/q/4922305
answer count: 4
score: 2
type: AnsweredQuestion
tagged with: eclipse-juno
upvote count: 2
tagged with: java
has title: How to increase generic font size in eclipse
type: Question
linked to: http://stackoverflow.com/q/6948374
has answer: http://stackoverflow.com/a/20902571
possible better answer: http://stackoverflow.com/a/20902536
tagged with: eclipse
has answer: http://stackoverflow.com/a/20902705
has answer: http://stackoverflow.com/a/20902536
has answer: http://stackoverflow.com/a/37606973
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/20902396
score: 59
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20902290
upvote count: 59
accepted answer of: http://stackoverflow.com/q/20902290
has comment: http://stackoverflow.com/comment/93275823
has body: I think, you want this. e.g. Mat croppedimage = cropImage(image,rect); Mat resizeimage = new Mat(); Size sz = new Size(100,100); Imgproc.resize( croppedimage, resizeimage, sz );

http://stackoverflow.com/comment/31404353
comment on: http://stackoverflow.com/q/20917623
score: 0
type: Comment
type: QuestionComment
has text: http://stackoverflow.com/questions/17105465/why-am-i-not-getting-my-original-string-after-compression-and-decompression

http://stackoverflow.com/comment/31290022
comment on: http://stackoverflow.com/a/20857531
has text: If you got more than a few inputs to parse, you may want to create a little helper method which does this without the duplication.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/20852900
tagged with: cassandra
has comment: http://stackoverflow.com/comment/31281851
tagged with: jdbc
type: Question
has body: I've written my own jdbc driver. I've added some specific methods to the connection class. Now I have to use it with jdbc, but I cann't even cast connection object that I receive from datasource to my connection class. Can I use created methods somehow?
has comment: http://stackoverflow.com/comment/31282420
has title: Get real connection from JNDI
has comment: http://stackoverflow.com/comment/31281628
score: 0
tagged with: java
tagged with: jndi
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31281760

http://stackoverflow.com/q/20976847
has comment: http://stackoverflow.com/comment/31515857
answer count: 2
has body: I'm trying to add a Java class to a jsp page but for some reason it's not working. The error I'm getting: The JSP page The project hierarchy the class itself. There are no erros in the class's code.
has comment: http://stackoverflow.com/comment/31516233
tagged with: oop
has answer: http://stackoverflow.com/a/20977219
score: 0
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/31515903
downvote count: 1
has comment: http://stackoverflow.com/comment/31515838
has answer: http://stackoverflow.com/a/21035716
tagged with: jsp
type: UnansweredQuestion
has title: How to add my own class to a JSP page?
has comment: http://stackoverflow.com/comment/31516114
has comment: http://stackoverflow.com/comment/31515817
favorite count: 0
tagged with: netbeans
type: Question

http://stackoverflow.com/comment/31291793
has text: *"How could I change this?"* Your IDE will show lists of compile errors when you go to compile the code! What IDE do you use?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20858109
score: 0

http://stackoverflow.com/comment/31308319
type: Comment
comment on: http://stackoverflow.com/q/20853124
type: QuestionComment
score: 0
has text: It _could_ be due to having code fighting over JAR versions. If that's happening, it produces very mysterious errors indeed.

http://stackoverflow.com/comment/31410138
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20920996
score: 0
has text: How did you do it? Did you add the jar to the libs folder?. Seems there is a problem in your build path

http://stackoverflow.com/comment/31303976
type: Comment
has text: VG but certificates don't use ciphers. They use key types and key lengths. I doubt that Tomcat puts any restrictions on those.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20859209

http://stackoverflow.com/comment/31443590
comment on: http://stackoverflow.com/a/20936811
type: AnswerComment
score: 0
type: Comment
has text: buttons by themselves do nothing. You need to add javascript code with an onclick="..." to make a button do something.

http://stackoverflow.com/q/20953553
type: Question
has comment: http://stackoverflow.com/comment/31474136
has comment: http://stackoverflow.com/comment/31475245
score: -2
tagged with: java
answer count: 3
linked to: http://stackoverflow.com/q/22362693
upvote count: 1
has title: How to have the same password compatible with both java and php?
linked to: http://stackoverflow.com/q/10079700
favorite count: 0
has answer: http://stackoverflow.com/a/20953779
linked to: http://stackoverflow.com/q/7626914
has comment: http://stackoverflow.com/comment/31492412
has comment: http://stackoverflow.com/comment/31474619
downvote count: 3
tagged with: android
has comment: http://stackoverflow.com/comment/31473175
has answer: http://stackoverflow.com/a/20963900
has answer: http://stackoverflow.com/a/21140482
has comment: http://stackoverflow.com/comment/31496191
has body: I have used the PHP crypt function to hash password. For example: &lt;?php $hash = '$2y$08$ffWmSGZOM5pNJpHNvpqMa.z01BL25WGoXViaWYhxS0WRaftgAxhkC'; $test = crypt("test", $hash); $pass = $test == $hash; echo "Test for functionality of compat library: " . ($pass ? "Pass" : "Fail"); echo "\n"; NOW: If i use php bcrypt password_hash() function i get this following output: Password: test bcrypted password using password_hash() is : $2y$08$ffWmSGZOM5pNJpHNvpqMa.z01BL25WGoXViaWYhxS0WRaftgAxhkC Now I want to have the same output in Android Java. My questions are: How can I achieve this? Is there any class file or default function in android java so that I can use to achieve this? Do I have to write a custom function to achieve this? I also want to decrypt the password using java. Any answer with an example will be appreciated. Advance thanks to all.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31472514
tagged with: php
has comment: http://stackoverflow.com/comment/31472033

currency
tag name: currency
type: Tag
tags question: http://stackoverflow.com/q/20950304

http://stackoverflow.com/a/20921787
accepted answer of: http://stackoverflow.com/q/20921763
upvote count: 3
has comment: http://stackoverflow.com/comment/31411781
has comment: http://stackoverflow.com/comment/31411538
has body: In your addClient() method : for (int i = 0; i &lt; clients.length; i++) { if(clients[i] == null){ clients[i].setId(i); } } So that's totally normal the NPE is thrown because you check if the Client object at the ith position of your array is null and then you're trying to access a method from this object, and hence the NPE. When you do public Client[] clients = new Client[100];, the 100 slots of the array are initialized to null (default value initialization of an Object in Java). I would initialize it in your constructor : public Bank(){ for(int i = 0; i &lt; clients.length; i++){ clients[i] = new Client(); } } Change your if in your addClient() method (do if client[i] != null to prevent the NPE), i.e : for (int i = 0; i &lt; clients.length; i++) { if (client[i] != null){ clients[i].setId(i); } } The same comment for your Client class with the array of Account. Also consider to read this : java-What is a Null Pointer Exception?
downvote count: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/20921763
score: 3

http://stackoverflow.com/a/20879492
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31332722
accepted answer of: http://stackoverflow.com/q/20878660
score: 0
answers question: http://stackoverflow.com/q/20878660
type: Answer
has comment: http://stackoverflow.com/comment/31332552
has body: Your Challenges.chalarray is not initialised, so the first time you're trying to access it you get null. Change the initialisation to: public class Challenges { public static String[][] chalarray = { { "0", "Challenge1", "Sample Description", "5", "base" }, { "1", "Challenge2?", "Sample Description", "4", "base"}, //etc }; } Also, I'd change the while loop to run through all the elements in chalarray and to break from the loop when correct id is found: while(tempPosition &lt; Challenges.chalarray.length) { if (Challenges.chalarray[tempPosition][1].contains(value)) { String s = Challenges.chalarray[tempPosition][0]; intvalue = Integer.parseInt(s); break; } tempPosition = tempPosition + 1; } Just keep in mind that if the id is not found, intvalue will be 0 from initialization, so in the following lines make sure you handle that, in other words, do you want to display the details of the element 0: title.setText(Challenges.chalarray[intvalue][1]); description.setText(Challenges.chalarray[intvalue][2]); String temp = Challenges.chalarray[intvalue][4]; String s1 = Challenges.chalarray[intvalue][3];
has comment: http://stackoverflow.com/comment/31335061
has comment: http://stackoverflow.com/comment/31333292
has comment: http://stackoverflow.com/comment/31332726
has comment: http://stackoverflow.com/comment/31332236

http://stackoverflow.com/a/20913683
upvote count: 1
answers question: http://stackoverflow.com/q/20913581
type: Answer
downvote count: 0
score: 1
has body: I use the following: -sw320dp (or default) for smaller phones -sw360dp for regular phones -sw480dp for huge phones -sw600dp for 7" tablets -sw720dp for 10" tablets You can also specify pixel densities, such as -ldpi, -mdpi, -hdpi, -xhdpi, and -xxhdpi. Here's a screenshot from one of my projects. Here, I attempt to provide the perfect images for all screen sizes and densities. This may be overkill for what you are trying to do. For more information, please see http://developer.android.com/guide/practices/screens_support.html
has comment: http://stackoverflow.com/comment/31398884
has comment: http://stackoverflow.com/comment/31399414

http://stackoverflow.com/a/20857592
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/31294859
has body: This can easily be done with basics of JSF and primefaces. Here is full working Example: XHTML File (I am using p:panel and ui:repeater) &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui"&gt; &lt;f:view contentType="text/html"&gt; &lt;h:head&gt; &lt;link rel=" stylesheet" type="text/css" href="css/style.css"&gt;&lt;/link&gt; &lt;/h:head&gt; &lt;h:body&gt; &lt;h:form&gt; &lt;p:panel header="Panel"&gt; &lt;ui:repeat var="lbl" value="#{tBean.lblClassess}"&gt; &lt;p:row&gt; &lt;p:column width="50%"&gt; &lt;p:outputLabel value="#{lbl.lbl} :" /&gt; &lt;/p:column&gt; &lt;p:column width="50%"&gt; &lt;p:inputText value="#{lbl.value}" /&gt; &lt;/p:column&gt; &lt;/p:row&gt; &lt;/ui:repeat&gt; &lt;/p:panel&gt; &lt;p:commandButton actionListener="#{tBean.submit}" value="Subtmi" update="values"&gt;&lt;/p:commandButton&gt; &lt;p:outputPanel id="values"&gt; &lt;ui:repeat var="lbl" value="#{tBean.lblClassess}"&gt; &lt;p:row&gt; &lt;p:column width="50%"&gt; &lt;p:outputLabel value="#{lbl.value} :" /&gt; &lt;/p:column&gt; &lt;/p:row&gt; &lt;/ui:repeat&gt; &lt;/p:outputPanel&gt; &lt;/h:form&gt; &lt;/h:body&gt; &lt;/f:view&gt; &lt;body&gt; &lt;/body&gt; &lt;/html&gt; Managed Bean import java.util.ArrayList; import java.util.List; import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; import javax.faces.event.ActionEvent; @ManagedBean(name = "tBean") @ViewScoped public class TestBean { private List&lt;LabelClass&gt; lblClassess; public TestBean() { lblClassess = new ArrayList&lt;LabelClass&gt;(); lblClassess.add(new LabelClass("First Label", "")); lblClassess.add(new LabelClass("Second Label", "")); lblClassess.add(new LabelClass("Third Label", "")); } public void submit(ActionEvent e) { for (La…
has comment: http://stackoverflow.com/comment/31293390
downvote count: 0
answers question: http://stackoverflow.com/q/20856339
type: Answer

http://stackoverflow.com/q/20955171
has body: I am using JUNG DirectedGraph and I need to transform a given directed graph to a reversed graph, so that the newly created graph contains all vertices and edges from the original graph and all edges in the new graph are reversed. I need to perform this transformation on the model. Is there a JUNG utility that provides this functionality? I use JUNG version 2.0.1. I realize it's easy to implement, just prefer to use the provided utility if available. Thanks
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/21032492
type: Question
has title: How to reverse Jung DirectedGraph?
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/38235807
favorite count: 0
has answer: http://stackoverflow.com/a/38235807
has answer: http://stackoverflow.com/a/21032492
tagged with: jung2

http://stackoverflow.com/comment/31481047
comment on: http://stackoverflow.com/a/20957484
score: 0
type: AnswerComment
type: Comment
has text: @user3077388 woops, yeah that makes sense

http://stackoverflow.com/comment/31396158
type: AnswerComment
has text: @Maher you solve it by creating a spare universe to store the number in.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/20913136

http://stackoverflow.com/a/20881491
has body: The R-tree stores all points in the leaf nodes. The "order" that you are looking for does not exist; all results must be from the leaves. The JTS API looks like it's painfully expensive. Coordinates wrapped in Points wrapped in Envelopes. You may want to have a look at ELKI, which I found to have very high performance. In contrast to popular belief, I have found ELKI R-trees (at least when STR bulk loaded) to still work very well in 32 dimensions (popular knowledge claims that R-trees only work up to 10 dimensions).
has comment: http://stackoverflow.com/comment/31521872
answers question: http://stackoverflow.com/q/20879910
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/31527048

http://stackoverflow.com/a/21464189
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/20947888
has body: Ok I found enough information to clear this up! The best thing to do with AsyncTasks as connection threads is to avoid them apparently, And use Google Volley instead. Please look at this link to understand the nuances concerning AsyncTasks: http://www.jayway.com/2012/11/28/is-androids-asynctask-executing-tasks-serially-or-concurrently/ (I found this link in a separate question but I can't find it, sorry). And look at this link to understand what is Google Volley and how it's easier to implement a multi-threaded connection with it: https://developers.google.com/events/io/sessions/325304728 So..To answer the question: 1. On some/most cases, your AsyncTasks will NOT run concurrently. 2. In order to "force" a multi-threaded connection, use Volley (can be configured to run serially btw) or read the link above concerning AsyncTask to "enable" it.
answers question: http://stackoverflow.com/q/20947888
type: AcceptedAnswer

http://stackoverflow.com/comment/31323607
type: AnswerComment
has text: That didn't work.. I'm using Oracle's Java 7 now and still I get the same error...
type: Comment
comment on: http://stackoverflow.com/a/20872600
score: 0

http://stackoverflow.com/comment/31372041
type: QuestionComment
has text: Please update the code into your question, it's far easier to read from there.
comment on: http://stackoverflow.com/q/20900854
score: 0
type: Comment

http://stackoverflow.com/comment/31439287
has text: Ali, Something like this ?? http://stackoverflow.com/questions/12056784/implementing-a-new-linkedlist-method-in-java and this http://stackoverflow.com/questions/13638289/java-linked-list-search-and-delete-method
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/20936053

http://stackoverflow.com/comment/31397466
comment on: http://stackoverflow.com/q/20913903
score: 1
type: Comment
type: QuestionComment
has text: Not familiar with the problem space you're dealing with, but I'm guessing a [Set](http://java.sun.com/javase/6/docs/api/java/util/Set.html) of GameObjects id's might be helpful?

http://stackoverflow.com/a/21006859
has body: Download an IDE like Intellij Idea or Eclipse. Those programs will help you with the syntax errors and compile the code on your machine. Intellij IDEA Eclipse Both are free.
type: Answer
answers question: http://stackoverflow.com/q/21006639
score: 1
accepted answer of: http://stackoverflow.com/q/21006639
upvote count: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/20942123
tagged with: struts2
has comment: http://stackoverflow.com/comment/31451216
answer count: 1
score: 1
favorite count: 0
duplicate of: http://stackoverflow.com/q/27633793
has body: I want to make a web application based on struts2 and spring. First of all, I tested if @Autowired does work on struts2. But it does not, dataSource is null. I have no idea how I can fix it. Please give me an infomation for it. HelloWorld.java package example; import java.sql.Connection; import org.apache.commons.dbcp.BasicDataSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.opensymphony.xwork2.ActionSupport; @Component public class HelloWorld extends ActionSupport { @Autowired private BasicDataSource dataSource; public String execute() throws Exception { Connection con = dataSource.getConnection(); con.close(); return SUCCESS; } } applicationContext.xml <property name="driverClassName" value="org.h2.Driver"/> <property name="url" value="jdbc:h2:mem" /> <property name="maxActive" value="10" /> <property name="username" value="sa" /> <property name="password" value="" /> <context:annotation-config /> <context:component-scan base-package="example" /> web.xml struts2 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter struts2 /* org.springframework.web.context.ContextLoaderListener struts.xml <constant name="struts.enable.DynamicMethodInvocation" value="false" /> <constant name="struts.devMode" value="true" /> /example/HelloWorld.jsp
upvote count: 1
tagged with: spring
tagged with: autowired
has comment: http://stackoverflow.com/comment/31451136
tagged with: struts2-spring-plugin
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20943132
tagged with: java
type: Question
has title: @autowired does not work on struts2 + spring
linked to: http://stackoverflow.com/q/27633793
downvote count: 0
accepted answer: http://stackoverflow.com/a/20943132

http://stackoverflow.com/comment/31352714
type: Comment
comment on: http://stackoverflow.com/a/20863514
has text: now i need to know that timers are not called on constant interval some minor difference like between different timeout the the milli sec is 29983 sometimes 29987 , 29984 etc is this by design or i am missing something?
score: 0
type: AnswerComment

opencv
type: Tag
tags question: http://stackoverflow.com/q/20858078
tags question: http://stackoverflow.com/q/20902290
tags question: http://stackoverflow.com/q/20987989
tags question: http://stackoverflow.com/q/20987321
tags question: http://stackoverflow.com/q/20853509
tags question: http://stackoverflow.com/q/20937596
tag name: opencv
tags question: http://stackoverflow.com/q/20932536
tags question: http://stackoverflow.com/q/20858021
tags question: http://stackoverflow.com/q/20965714
tags question: http://stackoverflow.com/q/20936910

http://stackoverflow.com/q/20884399
answer count: 5
has answer: http://stackoverflow.com/a/20885983
tagged with: spring
accepted answer: http://stackoverflow.com/a/41475574
tagged with: unit-testing
type: AnsweredQuestion
tagged with: java
score: 10
upvote count: 10
type: Question
has answer: http://stackoverflow.com/a/66431414
downvote count: 0
has title: Add user role to request in Spring MVC Test Framework
has answer: http://stackoverflow.com/a/41475574
has answer: http://stackoverflow.com/a/40662239
has answer: http://stackoverflow.com/a/52222301
tagged with: spring-test-mvc
favorite count: 0
has body: Started studying Spring Test MVC Framework at the office today, it looks handy, but facing some serious trouble right off the bat. Spent a few hours googling, but couldn't find anything related to my issue. Here's my very simple test class: import static org.hamcrest.Matchers.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.web.context.WebApplicationContext; @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration @ContextConfiguration(classes = WebAppContext.class) public class ControllerTests { @Autowired private WebApplicationContext wac; private MockMvc mockMvc; @Before public void setup() { mockMvc = webAppContextSetup(wac).build(); } @Test public void processFetchErrands() throws Exception { mockMvc.perform(post("/errands.do?fetchErrands=true")) .andExpect(status().isOk()) .andExpect(model().attribute("errandsModel", allOf( hasProperty("errandsFetched", is(true)), hasProperty("showReminder", is(false))))); } } The test reaches the following controller, but fails on first if clause thanks to not being authorized properly. @RequestMapping(method = RequestMethod.POST, params="fetchErrands") public String processHaeAsioinnit(HttpSession session, HttpServletRequest request, ModelMap modelMap, @ModelAttribute(ATTR_NAME_MODEL) @Valid ErrandsModel model, BindingResult result, JopoContext ctx) { if (request.isUserInRole(Authority.ERRAND…
possible better answer: http://stackoverflow.com/a/20885983

http://stackoverflow.com/comment/31416229
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20923615
has text: This is where reading the Javadoc would have answered your question.

http://stackoverflow.com/comment/31339139
comment on: http://stackoverflow.com/a/20882182
type: AnswerComment
score: 0
type: Comment
has text: i think i have found the problem. data passing like: {"password":"111111","username":"driver100@dfl.com"} But it should be like below format: {"values":{"email":"testone@gmail.com", "password":"111111","user_type":"driver"}}' Can you please help me on this? @user2675669

http://stackoverflow.com/comment/31365735
type: AnswerComment
comment on: http://stackoverflow.com/a/20896850
has text: 2) you can think of it as whichever makes more sense to you. for me, for example in notation array[i][j], I think of the first array or "i" as row and the array within that or "j" as column. you can think of them in vice-versa but makes sure it agrees with the rest of the program to avoid any potential confusion.
type: Comment
score: 0

http://stackoverflow.com/comment/31536136
type: Comment
has text: It's subjective. I like FileVisitor approach.
score: 3
comment on: http://stackoverflow.com/a/20987432
type: AnswerComment

http://stackoverflow.com/q/20992938
tagged with: automation
has answer: http://stackoverflow.com/a/20993013
answer count: 2
accepted answer: http://stackoverflow.com/a/20993154
downvote count: 0
has body: This may come across as a relatively stupid question, but I'm getting tired of having to hard code statements such as: private void doStuff(){ System.out.println(this.getClass().getName().toString()+ someText);{...};} every time I want to So I decided to implement an external method which writes in the output stream whenever I decide I need something written there such as:. public static void println(Object obj, String s) { System.out.println(obj.getClass().getName() + " &gt; " + s); } So the question is, Is there a way to automatically set the value of the 's' variable in the method above to always default to "initialized" when writing source code (using TAB for code completion e.g. Netbeans)? Many thanks in advance.
possible better answer: http://stackoverflow.com/a/20993013
favorite count: 0
tagged with: field
tagged with: shortcut
tagged with: logging
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has title: Automated or shorcut for method access logging
has answer: http://stackoverflow.com/a/20993154
type: Question

http://stackoverflow.com/a/20868102
upvote count: 2
has body: mFileList == null ? 0 : mFileList.size(); and mFileList == null ? null : mFileList.get(position); are Turnary operators. Here is the link If you want to do another way do like this: @Override public Integer getItem(int position) { if(mFileList == null) return 0; else return mFileList.size(); }
score: 2
answers question: http://stackoverflow.com/q/20868082
accepted answer of: http://stackoverflow.com/q/20868082
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/20968849
answers question: http://stackoverflow.com/q/20968357
type: Answer
downvote count: 0
score: 6
has body: You can do it in O(n * log n) time this way. public static int[] findSum(int[] values, int sum) { Arrays.sort(values); // O(N * log N) for(int i = 0; i &lt; values.length() - 1; i ++) { // O(n) int remainder = sum - values[i]; // O(log N) and assuming you can't use the same value twice. int pos2 = Arrays.binarySearch(value, i + 1, values.length, remainder); if (pos2 &gt;= 0) return new int[] { i, pos2 }; } return null; } So the total order is O(N log N) + O(N) * O(log N) or just O(N log N)
type: AcceptedAnswer
upvote count: 6
accepted answer of: http://stackoverflow.com/q/20968357

http://stackoverflow.com/comment/31466315
score: 0
type: AnswerComment
has text: "the field itself (x) is not an instance of that class"? When I declare 'Field x', what class is 'x' an instance of?
type: Comment
comment on: http://stackoverflow.com/a/20950358

http://stackoverflow.com/comment/31485377
comment on: http://stackoverflow.com/q/20959660
type: QuestionComment
type: Comment
has text: Can you include the .jar file in the .war ?
score: 0

http://stackoverflow.com/comment/31455892
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20925545
has text: Well, that is completely up to sou. I do not know how you organize your build environment, your question is terse enough.

http://stackoverflow.com/comment/31523223
comment on: http://stackoverflow.com/q/20890674
has text: @dfowler: What are you using? XSockets.NET or JWebSockets?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20885439
has comment: http://stackoverflow.com/comment/31343178
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31402031
has body: Follow these guidelines and documentation and code for your understanding at : http://developer.android.com/guide/topics/appwidgets/index.html . It has enough details in detail step-by-step to dig in
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/20885344
has comment: http://stackoverflow.com/comment/31343011
has comment: http://stackoverflow.com/comment/31343467
answers question: http://stackoverflow.com/q/20885344

http://stackoverflow.com/comment/31498527
type: AnswerComment
has text: Lets say there is a class Shipping.java where I have "Amount shippingcost;" as a member variable. Similarly I have Order.java which has "Amount orderCost;" as member variable. Shipping.java and Order.java has @Valid annotations over Amount member variable. In one case I want to allow negative also and in other I don't want to. How do I achieve this with group?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20967402

http://stackoverflow.com/q/20866725
tagged with: upload
tagged with: image
score: 0
answer count: 1
has title: Generate hash value of an image selected from gallery for uploading with a unique name onto server?
tagged with: hash
type: UnansweredQuestion
tagged with: android
has body: I want to upload image to server with a unique name, how do i do that ?i want to use hash value generator for doing the same, also how do i rename that file with the hash value so that i can uniquely identify it? Thanks in advance guys!!
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20866760

http://stackoverflow.com/q/20960622
has body: I am very new to Java and I'm trying to put together a simple time calculator. How come the add() method only throws up the last thing I added? When I run the program it only shows "Days" instead of the textboxes and the years label. import javax.swing.*; public class TimeCalculator extends JFrame { public static void main(String[] args) { JOptionPaneMultiInput window = new JOptionPaneMultiInput(); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setSize(300,500); window.setVisible(true); } public TimeCalculator() { super("Time Calculator"); JTextField yearsField = new JTextField(5); JTextField daysField = new JTextField(5); JTextField hoursField = new JTextField(5); JTextField minutesField = new JTextField(5); JTextField secondsField = new JTextField(5); JLabel yearsLabel = new JLabel(); JLabel daysLabel = new JLabel(); JLabel hoursLabel = new JLabel(); JLabel minutesLabel = new JLabel(); JLabel secondsLabel = new JLabel(); JCheckBox yearsCheckbox = new JCheckBox(); JCheckBox daysCheckbox = new JCheckBox(); JCheckBox hoursCheckbox = new JCheckBox(); JCheckBox minutesCheckbox = new JCheckBox(); JCheckBox secondsCheckbox = new JCheckBox(); JLabel yearsCLabel = new JLabel(); JLabel daysCLabel = new JLabel(); JLabel hoursCLabel = new JLabel(); JLabel minutesCLabel = new JLabel(); JLabel secondsCLabel = new JLabel(); JButton convertButton = new JButton(); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); yearsLabel.setText("Years"); daysLabel.setText("Days"); hoursLabel.setText("Hours"); minutesLabel.setText("Minutes"); secondsLabel.setText("Seconds"); yearsCLabel.setText("Yr"); daysCLabel.setText("D"); hoursCLabel.setText("Hr"); minutesCLabel.setText("Min"); secondsCLabel.setText("Sec"); convertButton.setText("Convert"); convertButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { //doConvert(evt); this will be added later once i figure everything out } }); add(yearsField); add(yearsLabel…
score: 0
answer count: 1
has title: JFrame Components Not Appearing
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20960770
has comment: http://stackoverflow.com/comment/31486105
tagged with: java
has comment: http://stackoverflow.com/comment/31486070
tagged with: swing
type: Question

http://stackoverflow.com/q/20980098
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/16788078
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/20980182
upvote count: 1
possible better answer: http://stackoverflow.com/a/26859807
linked to: http://stackoverflow.com/q/16649359
type: Question
has answer: http://stackoverflow.com/a/26859807
has body: I am working on a simple Jsoup program using my Eclipse, but when I try to run the program and add more steps to my program then I am getting error as java.net.SocketTimeoutException: connect timed out. This code works fine: public static void main(String[] args) { Document doc; try { doc = Jsoup.connect("http://google.com").get(); System.out.println("doc is = " + doc); } catch (IOException e) { e.printStackTrace(); } } and I get some XML data as output. Now when I change this program to: public static void main(String[] args) { Document doc; try { // need http protocol doc = Jsoup.connect("http://google.com").get(); System.out.println("doc is = " + doc); // get page title String title = doc.title(); System.out.println("title : " + title); // get all links Elements links = doc.select("a[href]"); for (Element link : links) { // get the value from href attribute System.out.println("\nlink : " + link.attr("href")); System.out.println("text : " + link.text()); } } catch (IOException e) { e.printStackTrace(); } } Then I am getting exception as: java.net.SocketTimeoutException: connect timed out It seems I need to set timeout option, please let me know where I can do that in eclipse? I have referred below SO posts but still facing same issue, also I don't have any proxy in between to access the internet: Sometimes java.net.SocketTimeoutException: Read timed out. Sometimes not Exception in thread “main” java.net.SocketTimeoutException: connect timed out at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
has title: Java Jsoup program in Eclipse throws java.net.SocketTimeoutException: connect timed out
tagged with: eclipse
answer count: 2
tagged with: jsoup
downvote count: 0
has answer: http://stackoverflow.com/a/20980182
favorite count: 0

http://stackoverflow.com/comment/31507880
comment on: http://stackoverflow.com/q/20972742
has text: This code change look of JComboBox, but after second, old JComboBox appear. --> looks like as bug in your code
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/20993844
downvote count: 0
type: UnansweredQuestion
tagged with: java
tagged with: file
tagged with: android-async-http
type: Question
has body: I'm uploading files(Images,Videos and Audios) from Android side to PHP server. It's working good for small files. But for large files it is giving unexpected results, like file uploads but on android side it gives timeout exception. So please help me, how i tackle all the scenarios for file uploading. How i can use HttpMultipart entity and how i can set relative timeout against different size files. My code is: File myFile = new File(filePath); RequestParams params = new RequestParams(); try { params.put("uploaded_file", myFile); } catch (FileNotFoundException e) { } URL=getResources().getString(com.newing.R.string.server_adderess)+URL+fileType+"&amp;lessonID="+LessonID; client.post(URL, params, new AsyncHttpResponseHandler() { @Override public void onSuccess(String response) { Log.w("async", "success!!!!"); UtilityFunctions.showNotification(getApplicationContext(), "File uploading completed."); stopSelf(); } @Override public void onFailure(Throwable error) { Log.w("async", "failure!!!!"); UtilityFunctions.showNotification(getApplicationContext(), "File couldn't upload. Please try later."); stopSelf(); } });
upvote count: 2
has title: Android file uploading using loopj HttpClient
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36745150
tagged with: android
has answer: http://stackoverflow.com/a/22700075
score: 2

http://stackoverflow.com/comment/31367092
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/20898050
has text: what happened here? where did the code go? the question was fine and there were many answer which solved your problem. Can you fix it up again? It's all blank
type: Comment

http://stackoverflow.com/comment/34390159
has text: Finally I could go back to this. I found some warning messages related to GIT. So I reacted to those warnings, cleaned the error log console and restarted eclipse. No log what so ever i s present now. After eclipse hangs and I shut it down, eclipse process keeps running on background and I have to kill it manually. This is to weird.
comment on: http://stackoverflow.com/q/20887997
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20886901
has comment: http://stackoverflow.com/comment/31345422
has answer: http://stackoverflow.com/a/20887088
tagged with: type-conversion
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31345473
type: Question
has body: I've an entity Date property: @Temporal(TemporalType.TIMESTAMP) private Date paymentDate; that I've to convert to a String. Using the following code I receive the Cannot format given Object as a Date exception: Format df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); String pDate = df.format(item.getPaymentDate()); Where I wrong?
accepted answer: http://stackoverflow.com/a/20887088
score: 0
tagged with: java
has title: Entity Date property: Cannot format given Object as a Date
answer count: 1

http://stackoverflow.com/comment/31426271
has text: Unfortunately that tutorial isn't working, it compiles ok but doesn't run. Happen to know of any others?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20922126

http://stackoverflow.com/q/20978662
tagged with: jpa
answer count: 1
linked to: http://stackoverflow.com/q/20976442
has comment: http://stackoverflow.com/comment/31520621
has comment: http://stackoverflow.com/comment/31519496
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20979526
has title: JPA @ManyToMany associations seem to only be working 1 way
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/31520866
has body: I've got the following association defined: public class Location ... @ManyToMany(mappedBy="locations") private List&lt;KMLFolder&gt; kmlFolderList; public class KMLFolder ... @ManyToMany(cascade=CascadeType.ALL) @JoinTable(name="LOCATION_KMLFOLDER", joinColumns={@JoinColumn(name="KMLFOLDER_ID", referencedColumnName="ID")}, inverseJoinColumns={@JoinColumn(name="LOCATION_ID", referencedColumnName="ID")} ) private List&lt;Location&gt; locations = new ArrayList&lt;Location&gt;(); Here is a unit test. The first 3 assertions pass but the last one fails: @Test @Transactional public void thatFolderLocationAssociationTableIsWorking() { Location l1 = new DomesticLocation(); l1.setDeptName("Test name 1"); Location l2 = new DomesticLocation(); l2.setDeptName("Test name 2"); KMLFolder k1 = new KMLFolder(); k1.setName("Test name 1"); List&lt;Location&gt; locations = new ArrayList&lt;Location&gt;(); locations.add(l1); locations.add(l2); k1.setLocations(locations); kmlFolderServiceImpl.save(k1); assertEquals("Test name 1", kmlFolderServiceImpl.find(1L).getLocations().get(0).getDeptName()); assertEquals("Test name 2", kmlFolderServiceImpl.find(1L).getLocations().get(1).getDeptName()); assertNotNull(locationServiceImpl.findAll().get(0)); //Failing Assertion assertNotNull(locationServiceImpl.find(1L).getKmlFolderList()); } Any thoughts why this may not be persisting correctly? Thanks.
has comment: http://stackoverflow.com/comment/31519416

http://stackoverflow.com/a/20886518
type: Answer
accepted answer of: http://stackoverflow.com/q/20886373
score: 1
has body: The most common problem is different versions of Spring libraries. E.g. in your pom.xml: org.springframework spring-tx 3.2.5.RELEASE jar and others are with: ${org.springframework-version} Link that can help you as well: Spring Error - java.lang.NoSuchMethodError: > org.springframework.beans.factory.annotation.InjectionMetadata.<init>
has comment: http://stackoverflow.com/comment/31374219
upvote count: 1
answers question: http://stackoverflow.com/q/20886373
has comment: http://stackoverflow.com/comment/31370943
has comment: http://stackoverflow.com/comment/31355502
has comment: http://stackoverflow.com/comment/31374008
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31344937

http://stackoverflow.com/comment/31587238
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21014196
has text: Are you sure that you are receiving list in your ajax response? If so, What you want to do with your list? I mean what is your expected output? What is the output you are getting in alert?

http://stackoverflow.com/q/20878219
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31332936
answer count: 0
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31331169
has title: Drools windowed event processing
favorite count: 0
type: Question
has body: I can not understand the behavior of drools windows that i need for correlation of events, i mean i want to calculate the total amount of Objects with amount property inserting in engine over last 10 secs. Here is my rule pattern: Number( intValue &gt;1000) from accumulate(Test( $p:price ) over window:time( 10s ),sum( $p ) ) It gives a compilation error: Rule Compilation error : [Rule name='Example 1'] com/retailerdev/rules/Rule_Example_1.java (15:660) : $p cannot be resolved to a variable Please help .Thanks in advance
tagged with: java
tagged with: drools-fusion
upvote count: 1
has comment: http://stackoverflow.com/comment/31332904
tagged with: drools
has comment: http://stackoverflow.com/comment/31431314

http://stackoverflow.com/q/20952633
has title: Add time unit to Joda DateTime object
type: Question
possible better answer: http://stackoverflow.com/a/20953212
has answer: http://stackoverflow.com/a/20953212
tagged with: date
accepted answer: http://stackoverflow.com/a/20952985
tagged with: jodatime
answer count: 2
downvote count: 0
score: 1
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20952985
has body: Is there a better way to add a certain unit of time to a DateTime object? I would like to do something similar to: TimeUnit unit = TimeUnit.valueOf("days"); DateTime date = new DateTime().add(unit, 20); This is my current implementation. int number = 20; MutableDateTime now = new MutableDateTime(); String timeUnit = getTimeUnit(); // returns "days", "months", "years" if (timeUnit.equals("days")) now.addDays(number); else if (timeUnit.equals("months")) now.addMonths(number); else now.addYears(number); return now.toDateTime();
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/31597695
has text: Nice, but I rather use a library that does this for me, unless there isn't any, but as far as I see there are a few.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20999400

http://stackoverflow.com/a/20889503
upvote count: 2
downvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/31350868
has body: Assignment isn't allowed outside of a method or a constructor by themselves, just like you can't call System.out.println("") outside of a method/constructor. (Not totally sure why, but I know you can't.) But, there is a solution to your problem. I'm assuming you want the assignment of the variables to be done statically so that rules out putting the assignment in a constructor. You can do two things then: First, (and probably the easiest), you can use what's called an array constant. These allow you to set the values of arrays while you're declaring them. (But only while you're declaring them.) That looks like this: public static String[] bString = {"Today", "Today", " snowing", " and", "cold!"}; You don't need to specify the size of the array because it's inferred by how many elements you included in your array constant. Secondly, you can declare a static method to do this for you, which allows you to use assignments, (Because they are allowed inside methods.) That would look like this: public static String[] getMyStringArray() { static String[] bString = new String[5]; bString[0] = "Today"; bString[1] = "Today"; bString[2] = " snowing"; bString[3] = " and"; bString[4] = "cold!"; return bString; } I personally would use the first one, as it is easier and cleaner in my opinion.
has comment: http://stackoverflow.com/comment/31350977
has comment: http://stackoverflow.com/comment/31350686
has comment: http://stackoverflow.com/comment/31350559
type: Answer
has comment: http://stackoverflow.com/comment/31350641
has comment: http://stackoverflow.com/comment/31351174
has comment: http://stackoverflow.com/comment/31350776
answers question: http://stackoverflow.com/q/20889310

http://stackoverflow.com/q/20859688
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31294356
has comment: http://stackoverflow.com/comment/31294419
has title: Alternatives to a goto statement in Java
tagged with: goto
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20859789
score: 2
upvote count: 2
tagged with: java
has body: In Java, are there any alternatives to using a goto statement without creating loops and breaks? After the user has said help (for instance), I want them to be able to type something again. Is this possible? Here's my code: package Main; import java.util.Scanner; import java.util.Calendar; import java.text.SimpleDateFormat; public class Start { public static &lt;DateFormat&gt; void main( String[] args ) { Scanner input = new Scanner( System.in ); Calendar.getInstance().getTime(); SimpleDateFormat dateFormat = new SimpleDateFormat( "HH:mm:ss" ); Calendar cal = Calendar.getInstance(); // creating scanner etc; System.out.println( "Welcome To B.V.D Please Type Your Name Here: " ); String name = input.nextLine(); // getting name; System.out.println( "For A List Of Commands " + name + " Type help" ); String main = input.nextLine(); //User input on what the user wants to do if ( main.equals( "help" ) ) { System.out.println( "You Can Use Commands Like These (Remember Type It Exactly As You See it) " ); System.out.println( "name, time, stopwatch, help, calculator, store, 15's" ); } // help if ( main.equals( "time" ) ) { System.out.println( dateFormat.format( cal.getTime() ) + " GMT" ); } input.close(); } }
type: Question
has answer: http://stackoverflow.com/a/20859755
answer count: 2

http://stackoverflow.com/q/20960715
type: Question
has comment: http://stackoverflow.com/comment/31486738
has comment: http://stackoverflow.com/comment/31486487
score: 0
tagged with: udp
tagged with: sensors
answer count: 1
has body: I am trying to receive a multicast UDP packet. The packet has a timestamp and some other useless data as well as sensor readings. Is there a way to only receive the last part of the packet, which would be the last 16 bytes out of the total 110 byte message? This would effectively take only the sensor readings and ignore the rest of the UDP package.
has comment: http://stackoverflow.com/comment/31486278
tagged with: multicast
tagged with: sockets
has comment: http://stackoverflow.com/comment/31486580
type: AnsweredQuestion
has title: Is it possible to only pick part of a UDP packet to receive?
has answer: http://stackoverflow.com/a/20961001
accepted answer: http://stackoverflow.com/a/20961001
tagged with: java
has comment: http://stackoverflow.com/comment/31487303

http://stackoverflow.com/q/20898074
has answer: http://stackoverflow.com/a/20899103
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/32871645
has body: I have a requirement for converting a String(which is usually be in ASCII char set) to UCS2 character set and then needs to be converted to Base 64. I could find the code for Base 64 conversion, but facing issue with encoding to UCS2. It would be great help if any help provided for converting a string to UCS2 character set in java. Thank you,
answer count: 2
downvote count: 0
favorite count: 0
has title: ASCII to UCS2 encoding java code
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31366622

http://stackoverflow.com/q/20934145
has answer: http://stackoverflow.com/a/20934164
type: Question
downvote count: 5
has answer: http://stackoverflow.com/a/20934203
has body: public final class Mess { Object obj1 ; // rest of the codes ...... please explain to me,for i'm a beginner, what is the significance of Object boj1? in some codes I've found that a for the same object "mess" they use, mess obj = new mess(); I've understood this one but I am quite not sure what type of variable (or might be refrence) does the code Object obj1 create..,
has comment: http://stackoverflow.com/comment/31436185
accepted answer: http://stackoverflow.com/a/20934370
answer count: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/31435395
has answer: http://stackoverflow.com/a/20934370
score: -3
has title: significance of "Object" data type in an object
has comment: http://stackoverflow.com/comment/31436071
possible better answer: http://stackoverflow.com/a/20934164
type: AnsweredQuestion
upvote count: 2
tagged with: java

http://stackoverflow.com/comment/31574359
has text: So you wanted one regex to be used in a few different types of functions? Yeah that won't work out :P I did add a section that talks about positive lookaheads for validation though.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20996283
type: AnswerComment

http://stackoverflow.com/comment/31428525
type: QuestionComment
comment on: http://stackoverflow.com/q/20930443
score: 0
type: Comment
has text: That line actually assumes 4 columns. Indexes count starts at 0. I suspect OP is trying to get the value at 3rd column in which case the right call is `table_1.getValueAt(count, 2)`.

http://stackoverflow.com/comment/31472548
type: QuestionComment
has text: I don't know the API you are using, but, if possible, just don't construct a JSONArray in the first place. Pass the String directly.
score: 0
comment on: http://stackoverflow.com/q/20946826
type: Comment

android-contacts
tags question: http://stackoverflow.com/q/20884214
type: Tag
tag name: android-contacts

http://stackoverflow.com/q/21018086
has answer: http://stackoverflow.com/a/21018616
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/14186955
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31592628
tagged with: java
tagged with: search
tagged with: user-interface
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31592032
score: 0
has body: In my program I have created an excel sheet with many names. In a gui there is a text field. What i want is when user starts entering character(s), all the names beginning with those character(s) from the excel sheet should be pulled out and displayed. If the user enters more characters the list should change accordingly. Also user should be able to select one of those names with the mouse for further processing. eg : Excel Sheet Andy Angle Alice Australia John Jane user starts entering 'a' output : Andy Angle Alice Australia next letter 'an' output: Andy Angel and so on Thanks in advance and sorry if this is a basic question
has comment: http://stackoverflow.com/comment/31591678
has title: Java GUI searching database
has comment: http://stackoverflow.com/comment/31591642
tagged with: dynamic

http://stackoverflow.com/a/21001069
accepted answer of: http://stackoverflow.com/q/21000931
answers question: http://stackoverflow.com/q/21000931
has body: If they're lagging your main loop, this is where multi-threading is of good use, that way each method can run on a separate thread and feedback to the main thread once complete, not slowing the things on the main thread.
type: Answer
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/31501389
comment on: http://stackoverflow.com/a/20969084
has text: Hi, thanks for the answer. I already added the permissions to my Manifest and they are being shown on my Andoid device under "Apps -> NameOfMyApp".
type: AnswerComment
score: 0
type: Comment

titan
tags question: http://stackoverflow.com/q/20884335
tag name: titan
type: Tag

http://stackoverflow.com/comment/31434772
score: 0
type: Comment
type: QuestionComment
has text: edit, now I save the file into C:/var. But I cant show to server where the image is. I added to server.xml <Context path="/noteProject/images" docBase="/var" /> but I get error: Error starting static Resources java.lang.IllegalArgumentException: Document base C:\INZ\work\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\webapps\var does not exist or is not a readable directory
comment on: http://stackoverflow.com/q/20926983

http://stackoverflow.com/a/20950145
has body: You need to set the classpath through dependencies. With the commandline argument -cp you set the classpath explicitly but this does not work for the maven cp. This is constructed through dependencies. org.codehaus.mojo exec-maven-plugin 1.2.1 generate-sources java <includeProjectDependencies>false</includeProjectDependencies> <includePluginDependencies>true</includePluginDependencies> org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher ${project.basedir}/src/my/mavenized/GenerateHeroLanguage.mwe2 org.eclipse.xtext org.eclipse.xtext.xtext 2.5.0-SNAPSHOT org.eclipse.xtext org.eclipse.xtext.xbase 2.5.0-SNAPSHOT
type: Answer
answers question: http://stackoverflow.com/q/20949618
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/31470432
downvote count: 0

http://stackoverflow.com/q/20914881
has answer: http://stackoverflow.com/a/20915032
accepted answer: http://stackoverflow.com/a/20915032
score: -1
has body: I have some fundamental doubts in my OO concepts. I am trying to solve this You have two numbers represented by a linked list, where each node contains a sin- gle digit. The digits are stored in reverse order, such that the 1’s digit is at the head of the list. Write a function that adds the two numbers and returns the sum as a linked list. EXAMPLE Input: (3 -> 1 -> 5) + (5 -> 9 -> 2) Output: 8 -> 0 -> 8 I know it can be recursively solved but what I tried was to iteratively test the problem. The method I wrote is this public LinkedList sum(LinkedList a){ int carry = 0; Node head1 = a.first; Node head2 = this.first; LinkedList sum = new LinkedList(); Node k = sum.first; if(a.first != null &amp;&amp; this.first != null){ k.item = (head1.item+head2.item) % 10; carry = (head1.item+head2.item) / 10; } head1 = head1.next; head2 = head2.next; while(head1 != null){ k.next = new Node((head1.item + head2.item + carry) % 10); carry = (head1.item + head2.item) / 10; head1 = head1.next; head2 = head2.next; k = k.next; } return sum; } And the method I am using to call it is this LinkedList object1 = new LinkedList(); LinkedList object2 = new LinkedList(); object1.insert(5); object1.insert(1); object1.insert(3); object2.insert(2); object2.insert(9); object2.insert(5); LinkedList object3 = object1.sum(object2); object3.display(); I am getting a Null Pointer Exception in the line k.item=(head1.item+head2.item)%10; How do I modify the sum method to present the correct result. Pleae dont suggest the recursive way as I am already aware of that. The main point of this question is I want to clarify my Object Oriented concepts. For further info Node class looks like this class Node { public int item; public Node next; public Node(int val){ item = val; } public Node(){} public void displayNode() { System.out.println("[" + item + "] "); } } The LinkedList class has one global declaration private Node first;
has comment: http://stackoverflow.com/comment/31399241
tagged with: object-oriented-analysis
answer count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31399265
has title: Object Oriented Concepts Clarification
has comment: http://stackoverflow.com/comment/31399170
type: AnsweredQuestion
upvote count: 0
tagged with: linked-list
tagged with: oop
tagged with: java
type: Question
tagged with: object

http://stackoverflow.com/comment/31354699
type: Comment
comment on: http://stackoverflow.com/q/20890974
has text: How can I use arrays?
type: QuestionComment
score: 0

http://stackoverflow.com/a/20886274
has comment: http://stackoverflow.com/comment/31344171
upvote count: 1
has body: This could be that you do not have a actionlistener on your combo box ? As Andrew suggested, there could be more reasons why your block does not work. If you pasted more code it would be easier to determine what the problem is. If however you are missing action listener on your combo box, code below. public void actionPerformed(ActionEvent e) { JComboBox cboBookType = (JComboBox)e.getSource(); String bookType= (String)cboBookType.getSelectedItem(); //and paste your ifs here if("Ebook".equals.....){ ... } ... rest of code } And if you don't know what action listener is, its basically interface used by other classes to listen for an action event. i.e. user clicking button, or user selecting checkbox etc.
type: Answer
score: 1
answers question: http://stackoverflow.com/q/20886181
has comment: http://stackoverflow.com/comment/31345533
downvote count: 0

http://stackoverflow.com/a/20916500
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: It would seem that a try/catch in the applet itself is the best approach to this. Or in other words, try some minor action at start-up. If it reaches the catch, pop a message up for the user.
answers question: http://stackoverflow.com/q/20903451

http://stackoverflow.com/q/20952575
score: 0
answer count: 1
has body: How can we group all annotations between two annotations? I'm new to GATE and am trying to group annotations together , Not sure if we can do this , Please help. For Example In the following text : Page-1 Age:53 Person: Nathan Page-2 Treatment : Initial Evaluation History: Yes Page-3 .......... If my Gazetteer list consists of different tags, page tag for each page number, age, person, Treatment, History etc. I want to group all tags from Page-1 to Page-2 under Page-1 Annotation and all tags between Page-2 and Page-3 under Page-2. Please let me know if more information required on this question. Thanks in advance.
tagged with: gate
has answer: http://stackoverflow.com/a/20953456
type: AnsweredQuestion
tagged with: java
type: Question
has title: Can we grouping Annotations in GATE
accepted answer: http://stackoverflow.com/a/20953456
tagged with: text-mining

http://stackoverflow.com/a/44983620
has body: Before you do any of these steps, make sure that your new relic folder is in inside the folder of your server. That immediately fixed my problem.
answers question: http://stackoverflow.com/q/20852811
score: 0
type: Answer

http://stackoverflow.com/a/20906858
score: 1
answers question: http://stackoverflow.com/q/20906789
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31383231
has body: Assuming you have set the id of your TextView within your layout file to TextView1 all you'll need to do is assign it like this: MyTextView = (TextView) findViewById(R.id.TextView1); But you'll either need to addView() or inflate the Layout within your custom view.
type: Answer
accepted answer of: http://stackoverflow.com/q/20906789
has comment: http://stackoverflow.com/comment/31384450

http://stackoverflow.com/comment/31419069
has text: If I map, the servlet will work well in the url I mapped it, but I need to have the servlet inside my index.jsp (and all the parameters return null). I need the servlet to be like a part of the page, you see ? Excuse me, i'm not well-trained with Java and Jsp ^^
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20925004

http://stackoverflow.com/comment/31450249
comment on: http://stackoverflow.com/q/20941624
type: QuestionComment
has text: These exception is the result of bad programming and should be fixed during development. The regular way to deal with exceptions in general in Java is to wrap exception-throwing code into `try-catch` blocks.
type: Comment
score: 1

http://stackoverflow.com/comment/31584059
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21013684
type: Comment
has text: If the object is not used in a Collection, i.e. equals() is seldom used, this might be o.k.

http://stackoverflow.com/a/21001258
answers question: http://stackoverflow.com/q/21001072
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: I've compiled and run this code, it prints out 0 with no NullPointerException. There is no way to get this error with the code you provided. public class Attributes { List text = new ArrayList(); List angle = new ArrayList(); public Attributes() { } public int getHowManyNodes() { int howMany = 0; howMany += text.isEmpty() ? 0 : text.size(); howMany += angle.isEmpty() ? 0 : angle.size(); return howMany; } public static void main(String[] args) { Attributes attributes = new Attributes(); System.out.print(attributes.getHowManyNodes()); } }

http://stackoverflow.com/q/20850258
has body: This is about a JSF + JPA application. Bill and BillItem are two entities with Bilateral OneToMany relationship with cascadeType=all in a JPA application. When the use clicks a new Bill, a new Bill object is create. User then fill properties of a BillItem like name and quantity and click the Add to Bill button, so that BillItem is added to the list of BillItems in the Bill Object. User interface is updated with Datatable linked to the bill.billItems. After adding one or more billItems to the Bill, the user click the settle button where the bill object is persisted. The issue is that it is not possible to remove billItem from the list. Always the first item is removed. How can I get the required billItem from the list ? Code of Bill Entity @Entity public class Bill implements Serializable { @OneToMany(mappedBy = "bill", cascade = CascadeType.ALL, fetch = FetchType.EAGER) List&lt;BillItem&gt; billItems = new ArrayList&lt;&gt;(); ... .. } Code for BillItem Entity @Entity public class BillItem implements Serializable { @ManyToOne Bill bill; .... ... @Override public boolean equals(Object object) { if (!(object instanceof BillItem)) { return false; } BillItem other = (BillItem) object; if ((this.id == null &amp;&amp; other.id != null) || (this.id != null &amp;&amp; !this.id.equals(other.id))) { return false; } return true; } } Code for JSF Managed Bean @Named @SessionScoped public class SaleController implements Serializable { private BilledBill bill; BillItem billItem; public void removeItem(){ if(removingItem==null){ UtilityController.addErrorMessage("Select one to remove"); return; } getBill().getBillItems().remove(removingItem); } public String newSaleBill() { fillAvailableStocks(); listBillsToSettle(); clearBill(); clearBillItem(); printPreview = false; bill = null; return "sale"; } public void settle() { .... saveBill(); UtilityController.addSuccessMessage("Successfully Billed"); } public void addItem() { ...... getBill().getBillItems().add(billItem); calTotal(); c…
answer count: 0
tagged with: jsf
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31310440
has comment: http://stackoverflow.com/comment/31277315
has title: Removing Item from JPA OneToManyList before Persisting
score: 0
has comment: http://stackoverflow.com/comment/31277500
tagged with: jpa
has comment: http://stackoverflow.com/comment/31281002
has comment: http://stackoverflow.com/comment/31304848
type: UnansweredQuestion

http://stackoverflow.com/a/21002776
answers question: http://stackoverflow.com/q/20973879
upvote count: 2
type: Answer
score: 2
downvote count: 0
has body: There is count, see https://developers.google.com/appengine/docs/python/datastore/queryclass#Query_count However see the notes in there. In short: its time is proportional to the number of elements being counted If you have many elements it will timeout because of (1) so you would need to use limit an paginate client-side. its faster than iterating, but by a constant factor (because of #1) For many elements your direction is to either use something like mapreduce, use cloud sql (easiest but $) or to maintain the counts yourself, usually with sharding and/or using memcached to improve performance and greatly reduce chances that simultaneous operations could lose data (because memcached supports atomic addition operations)

http://stackoverflow.com/comment/31544500
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20988433
has text: possible duplicate of [How do I fix a NoSuchMethodError?](http://stackoverflow.com/questions/35186/how-do-i-fix-a-nosuchmethoderror)

http://stackoverflow.com/comment/31375754
type: Comment
has text: It worked. The problem was that both of them had to be marked as **volatile**
comment on: http://stackoverflow.com/a/20873578
type: AnswerComment
score: 0

http://stackoverflow.com/a/20897172
type: Answer
answers question: http://stackoverflow.com/q/20895303
has body: Immutability:Object Not subject to change. to your question String a = new String("Wow"); String b = new String("Wow"); String sameA = a; boolean r1 = a == b; // This is false, since a and b are not the same object Reference variables a and b are not referring to same Object.When String is created with new operator a totally new memory space is Reserved in Heap for the same string Literal. If String Pool is not having the facility of making string immutable in that case string pool with one string object/literal has referenced by many reference variables and if any one of them changes the value others will be automatically gets changed. For example String firstString= "xyzabc"; String secondString= "xyzabc"; Now String secondString called "xyzabc".toUpperCase() which change the same object into "XYZABC" , so A will also be "XYZABC" which is not desirable. boolean r2 = a.equals(b); // This is true, since a and b are logically equals //Here literal i.e values of two different object is checked. boolean r3 = a == sameA; // This is true, since a and sameA are really the same object == :for Basic types compare the values == :for Object type =Reserved/Allocated Memory Space in the Heap is same. in this case a and sameA referring to the same object. Ex. If String x="singh"; x+concat("Saheb"); //Here a new object is created without having any reference to it with value "singhSaheb" But x remain same. String and even Literal are treated as object.
score: 0

jsp
tags question: http://stackoverflow.com/q/21007484
tags question: http://stackoverflow.com/q/20852921
tags question: http://stackoverflow.com/q/20987832
tags question: http://stackoverflow.com/q/20892249
tags question: http://stackoverflow.com/q/20971447
tags question: http://stackoverflow.com/q/20899607
tags question: http://stackoverflow.com/q/20977448
tags question: http://stackoverflow.com/q/20934856
tags question: http://stackoverflow.com/q/20963097
tags question: http://stackoverflow.com/q/20952032
tags question: http://stackoverflow.com/q/20943797
tags question: http://stackoverflow.com/q/20991373
tags question: http://stackoverflow.com/q/20921400
tags question: http://stackoverflow.com/q/20956020
tags question: http://stackoverflow.com/q/20933288
tags question: http://stackoverflow.com/q/20983866
tags question: http://stackoverflow.com/q/20981160
tags question: http://stackoverflow.com/q/20967543
tags question: http://stackoverflow.com/q/20949563
tags question: http://stackoverflow.com/q/20991651
tags question: http://stackoverflow.com/q/20954519
tags question: http://stackoverflow.com/q/20868396
tags question: http://stackoverflow.com/q/20951889
tags question: http://stackoverflow.com/q/20956559
tags question: http://stackoverflow.com/q/20901519
tags question: http://stackoverflow.com/q/20980964
tags question: http://stackoverflow.com/q/20876897
tags question: http://stackoverflow.com/q/20857383
tags question: http://stackoverflow.com/q/20901145
tags question: http://stackoverflow.com/q/20864482
tags question: http://stackoverflow.com/q/20880577
tags question: http://stackoverflow.com/q/20966153
tags question: http://stackoverflow.com/q/21007383
tags question: http://stackoverflow.com/q/20965826
tags question: http://stackoverflow.com/q/20904010
tags question: http://stackoverflow.com/q/20909098
tags question: http://stackoverflow.com/q/20869803
tags question: http://stackoverflow.com/q/20959961
tags question: http://stackoverflow.com/q/20947806
tags question: http://stackoverflow.com/q/20900931
tags question: http://stackoverflow.com/q/20856016
tags question: http://stackoverflow.com/q/20935554
tags question: http://stackoverflow.com/q/21013281
tags question: http://stackoverflow.com/q/20987400
tags question: http://stackoverflow.com/q/20867864
tags question: http://stackoverflow.com/q/20898848
tags question: http://stackoverflow.com/q/20875583
tags question: http://stackoverflow.com/q/20938512
type: Tag
tags question: http://stackoverflow.com/q/20946362
tags question: http://stackoverflow.com/q/20867349
tags question: http://stackoverflow.com/q/20913780
tags question: http://stackoverflow.com/q/20934739
tags question: http://stackoverflow.com/q/20936738
tags question: http://stackoverflow.com/q/20993972
tags question: http://stackoverflow.com/q/20961820
tags question: http://stackoverflow.com/q/20903257
tags question: http://stackoverflow.com/q/20883671
tags question: http://stackoverflow.com/q/20983348
tags question: http://stackoverflow.com/q/20980960
tags question: http://stackoverflow.com/q/20856712
tags question: http://stackoverflow.com/q/20994466
tags question: http://stackoverflow.com/q/20917860
tags question: http://stackoverflow.com/q/20994664
tags question: http://stackoverflow.com/q/20925004
tags question: http://stackoverflow.com/q/20896312
tags question: http://stackoverflow.com/q/20976847
tags question: http://stackoverflow.com/q/20853488
tags question: http://stackoverflow.com/q/20898257
tags question: http://stackoverflow.com/q/20966185
tags question: http://stackoverflow.com/q/20868095
tags question: http://stackoverflow.com/q/20944792
tags question: http://stackoverflow.com/q/21001212
tags question: http://stackoverflow.com/q/21008374
tags question: http://stackoverflow.com/q/20940884
tags question: http://stackoverflow.com/q/20965072
tags question: http://stackoverflow.com/q/20937169
tags question: http://stackoverflow.com/q/21004372
tag name: jsp
tags question: http://stackoverflow.com/q/20954161

http://stackoverflow.com/comment/31375015
type: QuestionComment
comment on: http://stackoverflow.com/q/20902662
score: 0
has text: Maybe I'm wrong, and indeed it won't matter for the game-loop if I used a Swing timer. But do you think it's a better choice?
type: Comment

http://stackoverflow.com/comment/31657659
score: 0
type: AnswerComment
type: Comment
has text: The csv has no commas in it(while troubleshooting this error I got rid of the columns I didn't need to simplify the code), so on each new line there is the name of a printer. Some have no special characters at all, some contain numbers, and some contain dashes or spaces. None of them are being created, so yes the output is just spitting out the whole list back at me. However, if I take ANY of the printers it spit out to the output, and use mkdir or mkdirs with the printer name enclosed in quotations, it creates the directory. It's very frustrating. Yes this is on windows.
comment on: http://stackoverflow.com/a/20984602

http://stackoverflow.com/a/20859314
type: Answer
accepted answer of: http://stackoverflow.com/q/20856016
has comment: http://stackoverflow.com/comment/31331673
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/31307274
type: AcceptedAnswer
upvote count: 3
answers question: http://stackoverflow.com/q/20856016
has body: Before this I am getting error of webservlet annotation but I have added tomcat server in my library in build path, all that error gone but now this servlet mapping error comes in. From the above description it seems that you are using javax.servlet.annotation.WebServlet annotation to configure your environment. The annotation-based servlet configuration is supported as of servlet 3.0 specification, however, servlet API supported by App Engine is 2.5 at the time of this writing. Remove all such annotations and configure your environment by means of web.xml descriptor only. Here you can find App Engine feature request for Servlet API 3.0.

http://stackoverflow.com/q/20946063
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20946438
has body: I need to remove the operational attribute from the policy overlay called pwdAccountLockedTime I followed this Q&amp;A which suggest way number 2: Use LdapTemplate#modifyAttributes(Name, ModificationItem[]) directly, manually building the ModificationItem array. Here's my code: Name dn = buildDn(user); DirContextOperations context = ldapTemplate.lookupContext(dn); ModificationItem[] modificationItems; modificationItems = new ModificationItem[1]; modificationItems[0] = new ModificationItem(DirContextAdapter.REMOVE_ATTRIBUTE, new BasicAttribute( "pwdAccountLockedTime", dn)); ldapTemplate.modifyAttributes(dn,modificationItems); I checked the user and that attribute still exist there. What am I missing?
tagged with: java
has title: How do I remove an operational attribute using ldaptemplate
type: Question
upvote count: 4
answer count: 3
accepted answer: http://stackoverflow.com/a/20967069
downvote count: 0
score: 4
favorite count: 0
tagged with: ldap
tagged with: openldap
tagged with: spring-ldap
possible better answer: http://stackoverflow.com/a/59661662
has answer: http://stackoverflow.com/a/59661662
has answer: http://stackoverflow.com/a/20967069

http://stackoverflow.com/a/21003687
has comment: http://stackoverflow.com/comment/31565485
answers question: http://stackoverflow.com/q/21003623
type: Answer
has body: You could always use mongodump/mongoimport/mongorestore if you don't mind exec'ing out. Or you could use a file of json documents and use com.mongodb.util.JSON#parse() or jackson to read that json in to DBObjects and write those out to mongo.
score: 0

http://stackoverflow.com/comment/31481888
has text: Can you tell us what is it doing ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20958627

http://stackoverflow.com/q/20972438
tagged with: rest
has answer: http://stackoverflow.com/a/20990532
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: resttemplate
has comment: http://stackoverflow.com/comment/31507792
type: Question
accepted answer: http://stackoverflow.com/a/20990532
has body: I try to login to sugar crm via JSON / REST with the below code: private String doLogin(String endpointUrl, String username, String password) { Map payload = createLoginData(username, password); String url = "http://{endpointUrl}"; URI expanded = new UriTemplate(url).expand(endpointUrl); try { url = URLDecoder.decode(expanded.toString(), "UTF-8"); } catch (Exception e) { e.printStackTrace(); } String response = template.postForObject(url, payload, String.class); ... } private Map createLoginData(String username, String password){ Map&lt;String, Object&gt; user_auth = new HashMap&lt;String, Object&gt;(); user_auth.put("user_name", username); user_auth.put("password", password); Gson gson = new Gson(); Map&lt;String, Object&gt; input_data = new HashMap&lt;String, Object&gt;(); Map&lt;String, Object&gt; rest_data = new HashMap&lt;String, Object&gt;(); rest_data.put("user_auth", user_auth); input_data.put("method", "login"); input_data.put("input_type", "JSON"); input_data.put("response_type", "JSON"); input_data.put("rest_data", gson.toJson(rest_data)); return input_data; } But instead of a successful logon, the server returns the soruce code of the php-script (the endpoint) as String. Any ideas, what I'm doing wrong?
tagged with: sugarcrm
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31509244
has title: Login to Sugar CRM CE using REST / JSON from Java

http://stackoverflow.com/comment/31499537
has text: Yeah there was a 2 min barrier, and an additional coffee break :D
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20967774
type: AnswerComment

http://stackoverflow.com/comment/31334672
type: Comment
has text: You need to have a 'pc' request attribute, of type `Pc`, before forwrding to your view. This object contains the initial values of the form elements.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20880641

http://stackoverflow.com/comment/31305047
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20862135
has text: @ThomasMatthews Error is in updation of CSF. replacement of CSF is not getting done proper. please check.
score: 0

screenshotexception
type: Tag
tag name: screenshotexception
tags question: http://stackoverflow.com/q/20994989

http://stackoverflow.com/comment/31304560
type: QuestionComment
has text: You can, but not always for arrays of the Object component type. For all other types it is unambiguous.
comment on: http://stackoverflow.com/q/20864655
score: 0
type: Comment

http://stackoverflow.com/comment/31561850
type: QuestionComment
has text: the class consists of a constructor like this public HelloClass (String [] args ) and the args is a parameters from main method but include many types such as string, int and float and i need to pass at once time to such constructor
score: 0
comment on: http://stackoverflow.com/q/21001802
type: Comment

http://stackoverflow.com/comment/31319950
has text: Cool, I'm trying right now and will let you know
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20872626
type: AnswerComment

http://stackoverflow.com/q/20908617
has title: Referencing a @FXML TextField from another class, but getting NullPointerException
has comment: http://stackoverflow.com/comment/31386548
tagged with: java
has comment: http://stackoverflow.com/comment/31387300
type: Question
answer count: 1
has body: I am trying to reference a TextField (@FXML) from another controller class, but I get NullPointerException. The following code explains the project. I want to understand why this happens. Thank you for your efforts in advance! Foo.fxml file //Foo.fxml ... &lt;TextField fx:id="textField" prefWidth="54" text="someText" /&gt; ... FooController.java file //FooController.java public class FooController implements Initializable { @FXML private TextField textField; public TextField gettextField(){ return textField; } } MainController.java file //MainController.java public class MainController implements Initializable { private FooController fooControllerClass; @Override public void initialize(URL url, ResourceBundle rb) { System.out.println(fooControllerClass.gettextField().getText()); // this line throws java.lang.NullPointerException } } Main.java file //Main.java public class Main extends Application { @Override public void start(Stage stage) throws Exception { Parent root = FXMLLoader.load(getClass().getResource("Main.fxml")); Scene scene = new Scene(root); stage.setScene(scene); stage.show(); } public static void main(String[] args) {launch(args);} } Stacktrace: java.lang.NullPointerException file:/home/vaib/shared/NetBeansProjects/JRAD/dist/run1408613327/Main.jar!/jrad/Main.fxml at jrad.MainController.initialize(MainController.java:6) at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2185) at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2185) at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2061) at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2778) at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2757) at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2743) at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2730) at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2719) at jrad.Main.start(Main.java:34) at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319) at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2185) at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.…
favorite count: 0
has answer: http://stackoverflow.com/a/20908985
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/31388372
has comment: http://stackoverflow.com/comment/31386975
tagged with: javafx-2
has comment: http://stackoverflow.com/comment/31386652
tagged with: fxml
has comment: http://stackoverflow.com/comment/31386841
upvote count: 3
has comment: http://stackoverflow.com/comment/31386589
has comment: http://stackoverflow.com/comment/31389708
accepted answer: http://stackoverflow.com/a/20908985
has comment: http://stackoverflow.com/comment/31386732
has comment: http://stackoverflow.com/comment/31386903
downvote count: 1
score: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/31382338
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20905221
has text: Vincent, yes i get JSON.parse unexpected end of data, when i surf from the browser the response is ok (no error)

http://stackoverflow.com/comment/31315733
comment on: http://stackoverflow.com/a/20858064
has text: thank you for your reply..but i have all the jars under /WEB-INF/lib folder, but still i am getting this exception..when i am running the project from eclipse it's working fine, but after deploying it on tomcat of Agile PLM its giving me this exception.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/20907539
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20907451
has body: There is no object to assign a value to at array[0].name = "ryan"; All you have is an array of variables that nothing has been assigned to as yet. You need to create one first for each address in the array... array[0] = new user(); then set it's name. Also, class names should be uppercase User, not user Lastly, if you are stepping through an array you are better to use it's size rather than a hard coded number for(int i = 0; i &lt; array.length; i++) Better yet, do a for-each for (user u : array) //for each user in array { System.out.println(u.name); System.out.println(u.age); }

http://stackoverflow.com/q/20956042
type: Question
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has title: Difficulty drawing a background sprite using LWJGL
has answer: http://stackoverflow.com/a/20956936
has body: I'm trying to render a background image for a new game I'm creating. To do this, I thought I'd just create a simple Quad and draw it first so that it stretched over the background of my game. The problem is that the quad doesn't draw to it's correct size and draws at the complete wrong place on the screen. I am using LWJGL and an added slick-util library for loading textures. background = TextureHandler.getTexture("background", "png"); This is the line of code which basically gets my background texture using a class that I wrote using slick-util. I then bind the texture to a quad and draw it using glBegin() and glEnd() like this: // Draw the background. background.bind(); glBegin(GL_QUADS); { glTexCoord2d(0.0, 0.0); glVertex2d(0, 0); glTexCoord2d(1.0, 0.0); glVertex2d(Game.WIDTH, 0); glTexCoord2d(1.0, 1.0); glVertex2d(Game.WIDTH, Game.HEIGHT); glTexCoord2d(0.0, 1.0); glVertex2d(0, Game.HEIGHT); } glEnd(); You'd expect this block to draw the quad so that it covered the entire screen, but it actually doesn't do this. It draws it in the middle of the screen, like so: https://i.sstatic.net/ag2m2.jpg The large, multicolored sprite that takes up the larger portion of the screen is my background, but it isn't taking up the full space like I want it to. A few things I've tried: Checking, double-checking, and triple-checking to make sure that the sprite's size and the window's size are identical Resizing the sprite so that it is both larger and smaller than my target size. Nothing seems to change when I do this. Positioning the sprite at different intervals or messing with the parameters of the glTexCoord2d() and glVertex2d(). This is just messy, and looks unnatural. Why won't this background sprite draw to it's correct size?
type: UnansweredQuestion
upvote count: 1
tagged with: opengl
tagged with: java
tagged with: lwjgl

http://stackoverflow.com/a/20952737
type: Answer
answers question: http://stackoverflow.com/q/20952699
has body: Try use portforwarding, for example with putty if you have a windows machine: http://www.cs.uu.nl/technical/services/ssh/putty/puttyfw.html For mac try this (didn't try it myself because i lack a mac ;-)) http://blog.evandavey.com/2008/05/how-to-ssh-port-forwarding-on-mac-osx.html
score: 2
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/31470295

http://stackoverflow.com/a/20991602
answers question: http://stackoverflow.com/q/20991386
accepted answer of: http://stackoverflow.com/q/20991386
has body: You state in the comments that the returned JSON is this: { "dstOffset" : 3600, "rawOffset" : 36000, "status" : "OK", "timeZoneId" : "Australia/Hobart", "timeZoneName" : "Australian Eastern Daylight Time" } You're telling Gson that you have an array of Post objects: List&lt;Post&gt; postsList = Arrays.asList(gson.fromJson(reader, Post[].class)); You don't. The JSON represents exactly one Post object, and Gson is telling you that. Change your code to be: Post post = gson.fromJson(reader, Post.class);
upvote count: 71
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 71

http://stackoverflow.com/q/21012219
tagged with: cross-platform
type: Question
accepted answer: http://stackoverflow.com/a/21012582
tagged with: java-native-interface
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21012582
has title: How to work programmatically with MBR and sectors of USB flash?
tagged with: usb-flash-drive
tagged with: c++
type: AnsweredQuestion
score: 3
has body: I develop application and write in Java. My application needs access to MBR of USB flash and to content of its sectors. I thought about using JNI: call methods in Java, their implementation is in C++, use only standard C functions, no WinAPI, no Linux API. And I don't know about possibility of working with such devices in Java without C++. Tell me please the best way.
upvote count: 3
tagged with: java

http://stackoverflow.com/q/20870046
has body: For supporting purposes I need to add a version and build identifier to our Java library. The library itself is a toolkit without user interaction which is used in different environments (stand alone Java applications, web applications, Eclipse applications, Maven dependency, ...). What I want, is a class with some constants giving me the above described information (such as MyAppVersion.BUILD, ...), so that they can be shown e.g. in dialogs, command line output, etc. After my research, there seem to be the following approaches: add versioning to file name, such as myLibrary-0.1.2.jar; not feasible in our case, since I have no control over the file name when deployed add information to the MANIFEST.MF and read it programmatically, like described here. I'm not sure however, how robust this approach is in respect to different class loaders (Eclipse, OSGi, application servers, ...) and if the JAR file gets re-packaged, this information is lost use a version.properties file holding the version, as described here and use a script during build to update the version.properties file hard code the version information into the class directly and use a script to update this information Are there any other approaches? The last option seems most "robust" to me, are there any objections against this variant? Is there a Maven plugin which would support updating this information in a MyAppVersion.java file during build?
linked to: http://stackoverflow.com/q/1272648
linked to: http://stackoverflow.com/q/5204297
has answer: http://stackoverflow.com/a/20870147
has title: Version information for Java library, accessible at runtime
linked to: http://stackoverflow.com/q/6611171
favorite count: 0
possible better answer: http://stackoverflow.com/a/20870147
has comment: http://stackoverflow.com/comment/31314285
has answer: http://stackoverflow.com/a/20870368
tagged with: maven
has comment: http://stackoverflow.com/comment/31314263
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/20870368
answer count: 2
tagged with: jar
downvote count: 0
linked to: http://stackoverflow.com/q/2712970
has comment: http://stackoverflow.com/comment/31314244

http://stackoverflow.com/q/20918436
favorite count: 0
type: AnsweredQuestion
score: 1
tagged with: java
has body: I am using IntelliJ IDEA. And my IDE saves my source code automatically before each compile. I am so accustomed to this feature so I even forgot that IDEA does this for me. Looks like whenever I ran Gradle "test" task, IDEA does not saves my source code automaticly, so test results might be incorrect. Console output almost allways it looks like this: some-task : UP-TO-DATE But if I save source code manually everything works fine. Is there a way to overcome this problem without manually saving source code before each test run?
upvote count: 1
tagged with: gradle
type: Question
tagged with: testing
has answer: http://stackoverflow.com/a/20919916
tagged with: intellij-idea
accepted answer: http://stackoverflow.com/a/20919916
answer count: 1
downvote count: 0
has title: IntelliJ IDEA does not save my source code before Gradle "test" task

http://stackoverflow.com/comment/31619073
comment on: http://stackoverflow.com/q/20897020
score: 3
has text: @JohnR it's in the Java Language spec, see assylias answer below.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20949587
type: Answer
upvote count: 1
score: 1
has body: At present you'll need to add the JavaFX jar manually as a library - in the future this may change, but for now, go to Tools => Preferences, click on the "Libraries" tab, click "Add", then locate jfxrt.jar - it should be in your jdk directory, under jre/lib. When you're done, you'll get something like the following: Reset your VM (Ctrl+shift+R) and then your import statements should work properly.
downvote count: 0
answers question: http://stackoverflow.com/q/20949394

http://stackoverflow.com/a/34216316
type: Answer
has body: alert('Selected items are removed successfully')
answers question: http://stackoverflow.com/q/20891556
score: 0

http://stackoverflow.com/q/20951710
has answer: http://stackoverflow.com/a/20952555
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31469930
tagged with: parsing
has comment: http://stackoverflow.com/comment/31468825
type: UnansweredQuestion
has body: I am trying to parse a text file that I converted to a string already. The text I am trying to parse(This changes every time its generated) but always has 1 or more of the sections(Errors, Warnings, Compliance, Instructional) these lines Start with "Errors", "Warnings", "Compliance" or "Instructional". Here is a text example: Errors - This section contains errors The cake is a lie All things have endings Twinkies are back Warnings - This contains warnings Show me the money Metric &gt; Imperial food for thought derp derp derp Compliance- This contains compliance issues Space is disease and danger wrapped in darkness and silence. Khaaaaaaaaaaan! Instructional - Contains Instructional Issues I'm a doctor, not an escalator. I need to test each line Psudo Code: boolean E = false; boolean W = false; boolean C = false; boolean I = false; boolean Skip5 = false; For each line in the stringFromTextFile{ Skip5 = false; if the line starts with "Errors" E = true; W = false; C = false; I = false; Skip5 = true;//start over with next line if the line starts with "Warnings" E = false; W = true; C = false; I = false; Skip5 = true;//start over with next line if the line starts with "Compliance" E = false; W = false; C = true; I = false; Skip5 = true;//start over with next line if the line starts with "Instructional" E = false; W = false; C = false; I = true; Skip5 = true;//start over with next line //Step 5 if(!Skip5){ if(I) println "Instructional " + currentLine; if(E) println "Error " + currentLine; if(W) println "Warning " + currentLine; if(C) println "Compliance " + currentLine; } //End Step 5 }//end for each Results example that Im trying to get from the above text: Error The cake is a lie Error All things have endings Error Twinkies are back Warning Show me the money Warning Metric &gt; Imperial Warning food for thought Warning derp derp derp Compliance Space is disease and danger wrapped in darkness and silence. Compliance Khaaaaaaaaaaan! Instructional I'm a doctor, not an esca…
tagged with: regex
has answer: http://stackoverflow.com/a/20956341
tagged with: java
has title: Parsing A log file into print lines with Java
has comment: http://stackoverflow.com/comment/31469500
type: Question
has comment: http://stackoverflow.com/comment/31468932
has comment: http://stackoverflow.com/comment/31469192

http://stackoverflow.com/q/20908059
answer count: 1
has comment: http://stackoverflow.com/comment/31385401
has answer: http://stackoverflow.com/a/20908306
has comment: http://stackoverflow.com/comment/31385394
has comment: http://stackoverflow.com/comment/31385403
has comment: http://stackoverflow.com/comment/31385540
has title: Read Windows text file on Linux --- MIME issues?
type: AnsweredQuestion
has body: I'm trying to read a file, of MIME type "appliaction/octet-stream" line by line via a Java application running on a Linux PC. Clarification: "appliaction/octet-stream" was the result of running "file -ib file.txt" on Linux. The file I'm trying to read was created on Windows XP. I've called my file "file.txt". On linux, "cat file.txt" displays the contents. "cat -v" as well as vim shows the control characters. When I run code to iterate through it via my Java application (using simple BufferedReader(FileReader) type of code), my output is unexpected. Any approached I should take? I tried converting the file using dos2unix, but no avail. EDIT: the input file, when read through vim or "cat -v" is as follows: [^@S^@y^@s^@t^@e^@m^@]^@^M^@ The line simply says "System", but it seems the control characters are rendering the file unreadable via my Java app. UPDATE: I ran my code using all available Character encodings, and it turns out that the readable CharSets were "x-UTF-16LE-BOM" and "COMPOUND-TEXT". Thanks to everyone for their help.
tagged with: java
score: 0
accepted answer: http://stackoverflow.com/a/20908306
type: Question
has comment: http://stackoverflow.com/comment/31385426
tagged with: character-encoding
has comment: http://stackoverflow.com/comment/31385454
tagged with: file-io
linked to: http://stackoverflow.com/q/15098186

http://stackoverflow.com/q/20996515
possible better answer: http://stackoverflow.com/a/20996819
type: Question
has comment: http://stackoverflow.com/comment/31552002
has answer: http://stackoverflow.com/a/20996819
tagged with: android-layout
tagged with: java
has comment: http://stackoverflow.com/comment/31552167
has comment: http://stackoverflow.com/comment/31551838
has title: Photoshop pictures are not working in Android application development (using Eclipse)
upvote count: 2
has comment: http://stackoverflow.com/comment/31552120
score: 0
answer count: 2
downvote count: 2
has body: I am trying to build my 1st android app. But their is problem that Photoshop images are not working as a background image of my app. I tried Paint and the images I make in Paint are working quiet well. But images of Photoshop are not working. I've used CS5, CS5.5 and even CS3. Tried a lot of images but none of them worked. Here is an XML code: &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/po"&gt; // po is the name of image I even tried relative layout. I also tried to put the images in all drawable folders. Eclipse shows no error in XML. It's working fine. But when I open graphical layout the background is not their. This is the error message which i see in graphical layout: Failed lot load D:\Other\Photoshop\New folder\Myapp\res\drawable-hdpi\po.jpg Exception details are logged in Window &gt; Show View &gt; Error Log javax.imageio.IIOException: Unsupported Image Type at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal( at com.sun.imageio.plugins.jpeg.JPEGImageReader.read( at javax.imageio.ImageIO.read( at javax.imageio.ImageIO.read( at android.graphics.Bitmap_Delegate.createBitmap(Bitmap_Delegate.java:118) at android.graphics.Bitmap_Delegate.createBitmap(Bitmap_Delegate.java:102) at com.android.layoutlib.bridge.impl.ResourceHelper.getDrawable(ResourceHelper.java:233) at android.content.res.BridgeTypedArray.getDrawable(BridgeTypedArray.java:782) at android.view.View.&lt;init&gt;(View.java:3554) at android.view.ViewGroup.&lt;init&gt;(ViewGroup.java:470) at android.widget.LinearLayout.&lt;init&gt;(LinearLayout.java:176) at android.widget.LinearLayout.&lt;init&gt;(LinearLayout.java:172) at sun.reflect.NativeConstructorAccessorImpl.newInstance0( at sun.reflect.NativeConstructorAccessorImpl.newInstance( at sun.reflect.DelegatingConstructorAccessorImpl.newInstance( at java.lang.reflect.Constructor.newI…
tagged with: photoshop
favorite count: 0
has comment: http://stackoverflow.com/comment/31552126
has comment: http://stackoverflow.com/comment/31551770
tagged with: android
has comment: http://stackoverflow.com/comment/31551990
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20996860
accepted answer: http://stackoverflow.com/a/20996860

http://stackoverflow.com/comment/31529966
type: AnswerComment
type: Comment
has text: Amazing. Why is `multi_match` in a `query` and `term` in a `filter`? And to do them both they need to be in `filtered`?
comment on: http://stackoverflow.com/a/20982878
score: 0

http://stackoverflow.com/comment/31571832
type: Comment
comment on: http://stackoverflow.com/a/21006649
type: AnswerComment
has text: Perhaps just [subtyping](http://en.wikipedia.org/wiki/Subtyping), but that articles doesn't help any of my arguments.
score: 0

http://stackoverflow.com/comment/31530866
type: Comment
has text: Why the downvote? I'm pretty sure this is a perfectly reasonable and correctly formatted question : (
type: QuestionComment
comment on: http://stackoverflow.com/q/20984429
score: 0

http://stackoverflow.com/a/20907742
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20907696
has body: how can i get null pointer exception from this line of code? If you look the table operators precedence + has a higher precedence than the ternary operator, so you concatenate your string first then it's not null so you go in the second condition.

http://stackoverflow.com/q/20868093
type: Question
answer count: 1
has body: I am using Jersey RESTful webservices. I wrote client as below but it throws above exception which i mentioned in the title. public class MyRestClient { public static void main(String[] args) { Client client = Client.create(); WebResource resource = client.resource("http://localhost:8080/myapp/rest/a/update/123"); Sample b1 = new Sample("debris"); ClientResponse response = resource.type(MediaType.APPLICATION_XML).put(ClientResponse.class, b1); } } Someone told to annotate Sample class with @XmlRootElement. But i cannot do it since Sample is generated by third party. Any help ?
score: 0
tagged with: rest
has answer: http://stackoverflow.com/a/20870607
type: UnansweredQuestion
tagged with: web-services
tagged with: spring
tagged with: java
has title: A message body writer for Java type, class myPackage.Sample, and MIME media type, application/xml, was not found

http://stackoverflow.com/a/20996321
has body: If you mean to load (and compile) a design stored in .jrxml file, then you should use JasperCompileManager.compileReport(String). It does both steps you mentioned at a time and returns JasperReport directly. EDIT: If you wish to obtain JasperDesign you can load it using net.sf.jasperreports.engine.xml.JRXmlLoader.load() method.
upvote count: 3
has comment: http://stackoverflow.com/comment/31551708
score: 3
answers question: http://stackoverflow.com/q/20996078
downvote count: 0
type: Answer

http://stackoverflow.com/q/20998631
upvote count: 11
accepted answer: http://stackoverflow.com/a/21015019
score: 11
has title: java Non-blocking HTTP client
type: Question
type: AnsweredQuestion
tagged with: nonblocking
has comment: http://stackoverflow.com/comment/31555546
tagged with: java
possible better answer: http://stackoverflow.com/a/20999400
has body: I have a high volume java application in which I have to send http posts to another server. Currently I'm using org.apache.commons.httpclient library: private static void sendData(String data) { HttpClient httpclient = new HttpClient(); StringRequestEntity requestEntity; try { requestEntity = new StringRequestEntity(data, "application/json", "UTF-8"); String address = "http://&lt;my host&gt;/events/" PostMethod postMethod = new PostMethod(address); postMethod.setRequestEntity(requestEntity); httpclient.executeMethod(postMethod); } catch (Exception e) { LOG.error("Failed to send data ", e); } } This means I'm sending my http requests synchronously, which doesn't fit my multithreaded high volume app. So I would like to change those calls to asynchronous non-blocking http calls. I was going through number of options such as apache async client and xsocket but was not able to make it work. Tried ning: private static void sendEventToGrpahiteAsync(String event) { LOG.info("\n" + "sendEventToGrpahiteAsync"); try (AsyncHttpClient asyncHttpClient = new AsyncHttpClient()) { BoundRequestBuilder post = asyncHttpClient.preparePost(); post.addHeader("Content-Type", "application/json"); post.setBodyEncoding("UTF-8"); post.setBody(event); post.execute(new HttpRequestCompletionHandler()); } catch (Exception e) { LOG.error("Failed to sending event", e); } } I tried Apache HttpAsyncClient: private static void sendEventToGrpahiteAsync(String event) { LOG.info("\n" + "sendEventToGrpahiteAsync"); try (CloseableHttpAsyncClient httpclient = HttpAsyncClients.createDefault()) { httpclient.start(); HttpPost request = new HttpPost(addr); StringEntity entity = new StringEntity(event, ContentType.create("application/json", Consts.UTF_8)); request.setEntity(entity); httpclient.execute(request, null); } catch (Exception e) { LOG.error("Failed to sending event", e); } } I tried xsocket: private static void sendEventToGrpahiteAsync2(String event) { LOG.info("\n" + "sendEventToGrpahiteAsync"); try (I…
answer count: 2
has answer: http://stackoverflow.com/a/20999400
has comment: http://stackoverflow.com/comment/31556878
downvote count: 0
favorite count: 0
tagged with: http-post
has answer: http://stackoverflow.com/a/21015019
tagged with: asynchronous

eclipse-kepler
tags question: http://stackoverflow.com/q/20866466
tag name: eclipse-kepler
type: Tag

http://stackoverflow.com/comment/31291164
comment on: http://stackoverflow.com/a/20857860
score: 0
type: AnswerComment
has text: There is some problem with mainpane
type: Comment

http://stackoverflow.com/comment/31555195
type: AnswerComment
type: Comment
score: 0
has text: alright, I used a testWatcher as you suggested. Inside the `failed(Throwable e, Description description)` method I call `myEventListener.onException(e, driver);`
comment on: http://stackoverflow.com/a/20996689

http://stackoverflow.com/comment/31354510
has text: "it says" -- what is "it"? If "it" is not LogCat, what warnings or errors are showing up in LogCat?
comment on: http://stackoverflow.com/q/20891388
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20939463
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/20939151
score: 0
has comment: http://stackoverflow.com/comment/31446086
has comment: http://stackoverflow.com/comment/37817284
has body: In my notepad application, this exception was happening because I was pointing toward a variable which was not initialized... So you need to initialize gamestarter... Hopefully it works :)
type: Answer

user-interface
tags question: http://stackoverflow.com/q/20862722
tags question: http://stackoverflow.com/q/20985732
tags question: http://stackoverflow.com/q/20987838
tags question: http://stackoverflow.com/q/20928699
tags question: http://stackoverflow.com/q/20894381
tags question: http://stackoverflow.com/q/20870102
tags question: http://stackoverflow.com/q/20873034
tags question: http://stackoverflow.com/q/20893438
tags question: http://stackoverflow.com/q/20970788
tags question: http://stackoverflow.com/q/20977286
tags question: http://stackoverflow.com/q/20957507
tags question: http://stackoverflow.com/q/20923561
type: Tag
tags question: http://stackoverflow.com/q/20938189
tags question: http://stackoverflow.com/q/20885468
tags question: http://stackoverflow.com/q/20893102
tags question: http://stackoverflow.com/q/20959053
tags question: http://stackoverflow.com/q/20890880
tags question: http://stackoverflow.com/q/20929618
tags question: http://stackoverflow.com/q/20977812
tags question: http://stackoverflow.com/q/20863860
tags question: http://stackoverflow.com/q/20890790
tags question: http://stackoverflow.com/q/20920885
tags question: http://stackoverflow.com/q/21006776
tags question: http://stackoverflow.com/q/20920237
tags question: http://stackoverflow.com/q/20879163
tags question: http://stackoverflow.com/q/21013585
tags question: http://stackoverflow.com/q/20992540
tags question: http://stackoverflow.com/q/20927864
tags question: http://stackoverflow.com/q/21018086
tags question: http://stackoverflow.com/q/21010495
tags question: http://stackoverflow.com/q/21013083
tags question: http://stackoverflow.com/q/21004861
tags question: http://stackoverflow.com/q/20856763
tags question: http://stackoverflow.com/q/20964755
tags question: http://stackoverflow.com/q/20874455
tags question: http://stackoverflow.com/q/20964413
tags question: http://stackoverflow.com/q/20953307
tags question: http://stackoverflow.com/q/20963348
tags question: http://stackoverflow.com/q/20892336
tags question: http://stackoverflow.com/q/20966118
tags question: http://stackoverflow.com/q/20985305
tags question: http://stackoverflow.com/q/20989405
tag name: user-interface
tags question: http://stackoverflow.com/q/20940921

http://stackoverflow.com/q/20921083
has comment: http://stackoverflow.com/comment/31410435
accepted answer: http://stackoverflow.com/a/20921588
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31410239
has comment: http://stackoverflow.com/comment/31410496
score: 2
has title: How to suspend Thread using java.util.concurrent?
has comment: http://stackoverflow.com/comment/31410467
upvote count: 2
tagged with: java
tagged with: multithreading
has body: I have looked everywhere. How to suspend/pause it by code until I call it to awake using any java.util.concurrentmethods/objects? I have simple Thread with run method: When I press button it stops then starts but the problem is that I get exception when I start it again. I want it play/pause like in the media player. Exception in thread "AWT-EventQueue-0" java.lang.IllegalMonitorStateException Full working code(with exceptions): import java.awt.GridLayout; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; public class Window extends JFrame { ThreadPanel leftPanel, rightPanel; Thread leftThread, rightThread; public Window() { super("StopResume"); } public void createGUI() { setLayout(new GridLayout()); add(leftPanel = new ThreadPanel()); add(rightPanel = new ThreadPanel()); leftThread = new Thread(leftPanel); rightThread = new Thread(rightPanel); leftThread.start(); rightThread.start(); setSize(800, 600); setVisible(true); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { int confirmed = JOptionPane.showConfirmDialog(null, "Zamknąć", "Potwierdzenie", JOptionPane.OK_CANCEL_OPTION); if (confirmed == JOptionPane.OK_OPTION) { dispose();//tu podmienic kod System.exit(1); } } }); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { new Window().createGUI(); } }); } } import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import javax.swing.JButton; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; public class ThreadPanel extends JPanel implements Runnable {…
has answer: http://stackoverflow.com/a/20921588
has comment: http://stackoverflow.com/comment/31410246
type: Question
tagged with: java.util.concurrent
has comment: http://stackoverflow.com/comment/31410430
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20921305
has comment: http://stackoverflow.com/comment/31410449
has answer: http://stackoverflow.com/a/20921305
answer count: 2

http://stackoverflow.com/q/20937362
has title: What objects can I inject using the @Context annotation?
answer count: 4
has answer: http://stackoverflow.com/a/20938070
has body: I'm new to JAX-RS and I'm trying to understand how the @Context annotation is supposed to work. At the javadoc there is a list of six classes (Application, UriInfo, Request, HttpHeaders, SecurityContext, Providers). However I find code on the web that use the this annotation with other types, for example: @GET public String something(@Context HttpServletRequest req) { } Is there a list of supported types that can be used with this annotations? Does this list change between implementation of the standard? I'm currently experimenting with Jersey and I'm worried that I'll write code that cannot be ported to other JAX-RS implementation.
downvote count: 1
type: AnsweredQuestion
upvote count: 46
has comment: http://stackoverflow.com/comment/31441758
tagged with: java
accepted answer: http://stackoverflow.com/a/20938070
type: Question
tagged with: jersey
has answer: http://stackoverflow.com/a/45794710
tagged with: jax-rs
has answer: http://stackoverflow.com/a/61947364
possible better answer: http://stackoverflow.com/a/35868654
favorite count: 0
has answer: http://stackoverflow.com/a/35868654
score: 45

http://stackoverflow.com/comment/31499341
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20967539
has text: @jdubbing what does your splash screen do. some people have written blogs that splash screen is not good coz it keeps the user waiting especially if it does nothing other than displaying image
score: 0

http://stackoverflow.com/comment/31338226
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20881907
score: 0
has text: Try removing the Runnable code while refereshing the ListView.

http://stackoverflow.com/q/20966142
has title: Java NIO - using Selectors
answer count: 1
upvote count: 2
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20967805
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/20967805
linked to: http://stackoverflow.com/q/17556901
downvote count: 0
tagged with: selector
tagged with: nio
has body: Got some quick questions on using a non blocking selector - answering any of the below would be greatly appreciated: I have just ben learning about the selector (java NIO model) and want to clarify some facts. Picked up most of the key points from tutorials as well as the SO question: Java NIO: Selectors so: from the question linked above, a Server socket channel is registered to listen for accept, when accepted a channel is registered for read and once read it is registered for write. How does it then go back into listening for an accept? I mean there appears to be no repeated call to a register accept listener. Is it just that once a ServerSocketChannel is registered the selector will always be listening for an accept? If so doesn't this mean that the selector will always be listening for a read/write on the channels also? How do you stop that - is it as simple as closing the channels? What happens if a channel is registered twice? I mean - in the above example, a socket is registered for write every time after a message is read - basically looks like an echo server. I guess the example assumes that the connection will then be closed after writing. What happens if you want to maintain an open connection and at different intervals write to the socket - must you register an interestOp each time? Is it harmful to register the same channel twice? Multithreading: What is the best design now for writing a multithreaded server - as the above non blocking approach assumes that one thread can handle writing and reading. Should you create a new thread if the read/write operation is expected to take a while? Are there any other points to consider? Understand that multithreaded is for blocking IO but have seen some frameworks that use a thread pool along with a Non blocking model and was wondering why.
favorite count: 0

http://stackoverflow.com/q/20927104
has body: Here is my simple function: public int countCats(String tableName) { int catCount = 0; Cursor cursor = database.rawQuery("SELECT COUNT(*) FROM " + MySQLiteHelper.TABLE_CAT, null); if (cursor != null) { catCount = cursor.getColumnIndex("COUNT"); } return catCount; } There are 11 rows int this table. But this function returns -1. How is appropriate way to handle this? EDIT: I have updated to this: public int countCats(String tableName) { int catCount = 0; Cursor cursor = database.rawQuery("SELECT COUNT("+ MySQLiteHelper.COLUMN_CAT+ ") FROM " + MySQLiteHelper.TABLE_CAT, null); if (cursor.moveToFirst()) { catCount = cursor.getInt(0); } cursor.close(); return catCount; } Now I get 0;
has comment: http://stackoverflow.com/comment/31422036
answer count: 3
upvote count: 1
tagged with: android
tagged with: sqlite
favorite count: 0
downvote count: 0
has answer: http://stackoverflow.com/a/20927136
has title: Return Count(*) in Android SQLite table
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20927118
score: 1
accepted answer: http://stackoverflow.com/a/20927139
tagged with: java
has answer: http://stackoverflow.com/a/20927118
type: Question
has answer: http://stackoverflow.com/a/20927139

http://stackoverflow.com/comment/31787425
has text: Thanks. I was hoping to avoid estimating the writes based on a "(num_of_entities * writes_per_entity_type)" formula, because there is a lot of variance in how densely or sparsely our entities are populated... and thus I don't have confidence in the second variable of that formula. However, it probably is the most convenient approach.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21102821
type: Comment

http://stackoverflow.com/q/20920217
linked to: http://stackoverflow.com/q/17489250
has title: Why I new the object not equal to the String?
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31409160
type: Question
has answer: http://stackoverflow.com/a/20920224
duplicate of: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/31408700
answer count: 2
upvote count: 0
linked to: http://stackoverflow.com/q/767372
has comment: http://stackoverflow.com/comment/31408776
favorite count: 0
has answer: http://stackoverflow.com/a/20920227
accepted answer: http://stackoverflow.com/a/20920227
downvote count: 8
score: -8
possible better answer: http://stackoverflow.com/a/20920224
has comment: http://stackoverflow.com/comment/31408617
has body: String s1 = "abcdef"; String s3 = new String(s1); if(s3 == s1){ System.out.printf("yes"); }else{ System.out.printf("no"); } Why is not print yes? Who can explain to me?

http://stackoverflow.com/comment/31332210
type: QuestionComment
has text: I forgot to add that I've hunted for information about these, but my question seems too specific. I think the error is small and that I'm just overlooking something obvious
comment on: http://stackoverflow.com/q/20879602
score: 0
type: Comment

http://stackoverflow.com/a/20920135
upvote count: 3
has comment: http://stackoverflow.com/comment/31413732
has body: The error SQLERROR -204, SQLSTATE 42704 is a missing/unknown objectname and it is most likely caused by a missing space in: rs = stmt.executeQuery("select *from TestTable"); Which should be: rs = stmt.executeQuery("select * from TestTable");
has comment: http://stackoverflow.com/comment/31410672
answers question: http://stackoverflow.com/q/20919298
score: 3
downvote count: 0
type: Answer

http://stackoverflow.com/a/20867262
type: Answer
has body: java -classpath classpath1;classpath2
answers question: http://stackoverflow.com/q/20867208
score: 0

http://stackoverflow.com/comment/31480651
score: 0
type: Comment
has text: @BillL: I've added a section on autoboxing into my answer. Furthermore, take care into what you're actually passing in as your character array - it will blow up on anything that isn't a lower case alphabetic character. This includes whitespace. You may need to trim some of it away.
type: AnswerComment
comment on: http://stackoverflow.com/a/20957841

http://stackoverflow.com/comment/31366637
type: Comment
has text: Have you run my code ? It works on my sample text .maybe I don't know the whole details of what you need,to deal with the paragraph and other segment style ,you need to write more code.
score: 0
comment on: http://stackoverflow.com/a/20897781
type: AnswerComment

http://stackoverflow.com/comment/31306391
comment on: http://stackoverflow.com/q/20865499
has text: 1) Did you look at the API for the `setDefaultCloseOperation(...)` method? What values are allowed? What methods would you think would be invoked for each of the different operations? 2) Already answered in my original response.
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/20895916
type: Question
has answer: http://stackoverflow.com/a/20896440
has comment: http://stackoverflow.com/comment/31363174
possible better answer: http://stackoverflow.com/a/20896440
has body: Starting date is today and end date should be today's date +3 years Example: TODAY=3.1.2013 and END DATE=3.1.2016 This is the screenshot ; Date begindate = new Date(); Calendar cal = Calendar.getInstance(); cal.setTime(begindate); int today = cal.get(Calendar.DAY_OF_WEEK); cal.add(Calendar.YEAR, 3); Date enddate = cal.getTime(); Date currentdate = begindate; while (true) { if (currentdate.getTime() &gt;= enddate.getTime()) { break; } else { } Calendar c = Calendar.getInstance(); c.setTime(begindate); c.add(Calendar.DATE, x++); Date newdate = c.getTime(); int day = c.get(Calendar.DAY_OF_WEEK); currentdate = newdate; }
score: 0
tagged with: java
answer count: 2
tagged with: swing
has answer: http://stackoverflow.com/a/20896397
has comment: http://stackoverflow.com/comment/31363106
has comment: http://stackoverflow.com/comment/31363230
tagged with: date
has comment: http://stackoverflow.com/comment/31363145
has comment: http://stackoverflow.com/comment/31363315
has title: Fill jtable using calendar start date and end date
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31374953
has comment: http://stackoverflow.com/comment/31380358
accepted answer: http://stackoverflow.com/a/20896397
has comment: http://stackoverflow.com/comment/31363789

http://stackoverflow.com/comment/31320301
type: QuestionComment
comment on: http://stackoverflow.com/q/20873005
has text: What the heck was that picture of your IDE supposed to communicate?
score: 0
type: Comment

http://stackoverflow.com/a/20894557
upvote count: 3
has comment: http://stackoverflow.com/comment/31361246
score: 3
accepted answer of: http://stackoverflow.com/q/20894369
answers question: http://stackoverflow.com/q/20894369
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Use something like String[] items = jTextArea2.getText().split("\n"); Then instead of jTextArea.getText().line[0] use items[0]. A for-each loop would help. DefaultListModel list = new DefaultListModel(); String[] items = jTextArea2.getText().split("\n"); for(String item : items) { list.addElement(item); } jList1.setModel(list); Note that this will add blank lines to the list, and it will not add blank list items for each row of the text area.

http://stackoverflow.com/comment/31725413
type: QuestionComment
comment on: http://stackoverflow.com/q/21000390
has text: no problem, can you post your start class where you call all this? cause your fault is there.
score: 0
type: Comment

http://stackoverflow.com/comment/31413160
comment on: http://stackoverflow.com/q/20909479
score: 0
type: QuestionComment
has text: Injecting with JavaScript works well
type: Comment

http://stackoverflow.com/a/20981944
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20981626
score: 1
answers question: http://stackoverflow.com/q/20981626
has comment: http://stackoverflow.com/comment/31526115
type: AcceptedAnswer
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/31526300
has body: In the displayView() method simply remove all tabs from the ActionBar, this way you'll always have a clean ActionBar with the exception of the TeamsAndDriversFragment fragment: private void displayView(int position) { getSupportActionBar().removeAllTabs(); // ... }

http://stackoverflow.com/comment/31450130
type: Comment
type: QuestionComment
has text: Because I'm a noob and don't know what I'm doing! =P Oh and I just went by http://web.williams.edu/admin/registrar/records/gpa.html. This is just for practice guys.
comment on: http://stackoverflow.com/q/20941509
score: 0

http://stackoverflow.com/q/20870708
score: 0
has comment: http://stackoverflow.com/comment/31315909
answer count: 1
tagged with: eclipse-plugin
has body: In the jface table tutorial Here I can see that in column editing support section JFace provides the following default implementations for cell editors: TextCellEditor ColorCellEditor CheckboxCellEditor DialogCellEditor ComboBoxViewerCellEditor but what should be done to implement something like cell displays the path of certain directory and there's a small button in this cell like this image
has answer: http://stackoverflow.com/a/20871008
tagged with: jface
has comment: http://stackoverflow.com/comment/31315843
type: AnsweredQuestion
type: Question
accepted answer: http://stackoverflow.com/a/20871008
tagged with: java
tagged with: eclipse
has title: Java eclipse : How to add browse button for Table editable cell?

http://stackoverflow.com/comment/31488831
type: QuestionComment
comment on: http://stackoverflow.com/q/20962007
has text: Judging from the title of your GUI, it appears you are making a game. If so, I encourage you to have a [proper game loop](http://www.java-gaming.org/index.php?topic=24220.0). (If I'm wrong, tell me and I will delete this comment)
score: 0
type: Comment

http://stackoverflow.com/comment/42559035
type: AnswerComment
score: 0
type: Comment
has text: Out of curiousity, why is the request executed 3 times?
comment on: http://stackoverflow.com/a/21592593

http://stackoverflow.com/comment/31281734
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20852961
has text: http://javapapers.com/core-java/hashcode-and-equals-methods-override/
score: 0

http://stackoverflow.com/comment/31585026
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21013759
has text: Does relative paths work?

http://stackoverflow.com/comment/31277898
score: 1
has text: SO is becoming a `cc` (crowd compiler)
comment on: http://stackoverflow.com/q/20850815
type: QuestionComment
type: Comment

dialog
tag name: dialog
tags question: http://stackoverflow.com/q/20935934
tags question: http://stackoverflow.com/q/20879363
tags question: http://stackoverflow.com/q/20988822
tags question: http://stackoverflow.com/q/20933087
type: Tag
tags question: http://stackoverflow.com/q/20987051
tags question: http://stackoverflow.com/q/20878487
tags question: http://stackoverflow.com/q/20995244

http://stackoverflow.com/comment/43469105
has text: Who close first reach the TIME-WAIT state.
comment on: http://stackoverflow.com/a/20901329
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31511410
type: AnswerComment
type: Comment
has text: @DianaAmza I know. I am facing the same situation. Still: using these annotations still makes things easier and less error prone, especially with Findbugs and / or IntelliJ idea
comment on: http://stackoverflow.com/a/20972273
score: 0

http://stackoverflow.com/q/20898293
favorite count: 0
answer count: 0
tagged with: exception
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/31367102
tagged with: java
tagged with: hibernate
has body: I am a beginner in hibernate. I am following this hello world tutorial from http://javapostsforlearning.blogspot.in/2013/01/hibernate-hello-world-example-in-eclipse.html but I am facing the following exception: Exception in thread "main" org.hibernate.MappingException: invalid configuration at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2018) at org.hibernate.cfg.Configuration.configure(Configuration.java:1935) at org.hibernate.cfg.Configuration.configure(Configuration.java:1914) at org.arpit.javapostsforlearning.Main.main(Main.java:14) Please help me to resolve this problem.
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/31367064
has comment: http://stackoverflow.com/comment/31372430
has comment: http://stackoverflow.com/comment/31367346
has title: configuration exception on hibernate mappingexception unknown entity
score: 1

http://stackoverflow.com/comment/31498624
comment on: http://stackoverflow.com/q/20967653
type: Comment
type: QuestionComment
has text: List<String> l = new ArrayList<String>();
score: 1

autowired
tags question: http://stackoverflow.com/q/20998784
tags question: http://stackoverflow.com/q/20908919
type: Tag
tags question: http://stackoverflow.com/q/20856825
tags question: http://stackoverflow.com/q/20878221
tags question: http://stackoverflow.com/q/20942123
tags question: http://stackoverflow.com/q/20918825
tags question: http://stackoverflow.com/q/20954632
tag name: autowired

http://stackoverflow.com/comment/31431630
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20931900
has text: Yes, the I wanted to show the type of Statement.

http://stackoverflow.com/comment/31588061
comment on: http://stackoverflow.com/a/21015862
score: 0
type: AnswerComment
has text: my problem is like this in my home page i have 4 other buttons lets name it button 1 button 2 etc. im my home page i have a div called red_div in my red_div at home it has a flash, now when i click button 1 i want red_div to contain page 1 and when i click button 2 i want red_div to contain page 2 how do i achieve this?
type: Comment

http://stackoverflow.com/comment/31485797
type: Comment
has text: Well that was just rough code. If I were to do it that way which I am not, I would cross check every pixel position with each light position, then change the light based on the distance from the source. But as you said, performance is abysmal. In your first approach, how would you go about finding the pixels closest to the light, I can't think of a way other than stepping through the pixels to see if they are close.
comment on: http://stackoverflow.com/a/20960124
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31436781
has text: okay.. i do see the variable values, such as employeeObj, json, params1, success, and params. So what do i do now?
comment on: http://stackoverflow.com/a/20933643
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/20945049
has answer: http://stackoverflow.com/a/20945113
accepted answer: http://stackoverflow.com/a/20945113
has comment: http://stackoverflow.com/comment/31536550
has answer: http://stackoverflow.com/a/66554435
upvote count: 444
has comment: http://stackoverflow.com/comment/31489418
has answer: http://stackoverflow.com/a/20945098
has comment: http://stackoverflow.com/comment/32095524
has comment: http://stackoverflow.com/comment/106331718
has answer: http://stackoverflow.com/a/21008747
linked to: http://stackoverflow.com/q/17151382
has answer: http://stackoverflow.com/a/36216059
answer count: 16
has body: We all know that String is immutable in Java, but check the following code: String s1 = "Hello World"; String s2 = "Hello World"; String s3 = s1.substring(6); System.out.println(s1); // Hello World System.out.println(s2); // Hello World System.out.println(s3); // World Field field = String.class.getDeclaredField("value"); field.setAccessible(true); char[] value = (char[])field.get(s1); value[6] = 'J'; value[7] = 'a'; value[8] = 'v'; value[9] = 'a'; value[10] = '!'; System.out.println(s1); // Hello Java! System.out.println(s2); // Hello Java! System.out.println(s3); // World Why does this program operate like this? And why is the value of s1 and s2 changed, but not s3?
has answer: http://stackoverflow.com/a/20972058
linked to: http://stackoverflow.com/q/1552301
linked to: http://stackoverflow.com/q/1230293
has answer: http://stackoverflow.com/a/20945108
has comment: http://stackoverflow.com/comment/126199339
has comment: http://stackoverflow.com/comment/31458208
has comment: http://stackoverflow.com/comment/31462560
score: 417
has answer: http://stackoverflow.com/a/20949917
has answer: http://stackoverflow.com/a/20974227
tagged with: string
linked to: http://stackoverflow.com/q/14060078
favorite count: 0
has answer: http://stackoverflow.com/a/20945157
has title: Is a Java string really immutable?
has comment: http://stackoverflow.com/comment/31491128
has answer: http://stackoverflow.com/a/20945259
has comment: http://stackoverflow.com/comment/101830153
has comment: http://stackoverflow.com/comment/31465700
downvote count: 27
tagged with: immutability
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31491624
has answer: http://stackoverflow.com/a/53534769
tagged with: reflection
possible better answer: http://stackoverflow.com/a/20945268
tagged with: java
has comment: http://stackoverflow.com/comment/94693197
has answer: http://stackoverflow.com/a/20950428
has answer: http://stackoverflow.com/a/20959594
has answer: http://stackoverflow.com/a/20945268
has answer: http://stackoverflow.com/a/20968146
has comment: http://stackoverflow.com/comment/31459361
type: Question
has comment: http://stackoverflow.com/comment/31456276

http://stackoverflow.com/q/20976930
type: Question
has title: Java Regex Pattern to extract data
type: AnsweredQuestion
has body: I have incoming data something like this http://localhost:1111/search?id=10&amp;time=3200&amp;type=abc http://localhost:1111/search?time=3200&amp;id=11&amp;type=abc http://localhost:1111/search?id=12 http://localhost:1111/search?id=13&amp;time=3200&amp;type=abc The data is varying but not something completely random or unpredictable. So basically how do we extract what are the IDs that are incoming in each string ignoring rest of the junk?
has answer: http://stackoverflow.com/a/20977312
tagged with: java
has comment: http://stackoverflow.com/comment/31516200
accepted answer: http://stackoverflow.com/a/20977054
answer count: 6
has answer: http://stackoverflow.com/a/20977154
score: 0
possible better answer: http://stackoverflow.com/a/20977135
has answer: http://stackoverflow.com/a/20977135
has comment: http://stackoverflow.com/comment/31516215
has comment: http://stackoverflow.com/comment/31516214
has comment: http://stackoverflow.com/comment/31516395
tagged with: regex
has answer: http://stackoverflow.com/a/20977054
has answer: http://stackoverflow.com/a/20977106
tagged with: data-extraction
has answer: http://stackoverflow.com/a/20977257
has comment: http://stackoverflow.com/comment/31516098

http://stackoverflow.com/comment/31291749
type: Comment
type: QuestionComment
has text: Sorry but I don't understand what you're saying. I think you're saying that I'm not aware enough of potential compile errors while I code. How could I change this? I have no idea what could cause these compile error and how to avoide them.
comment on: http://stackoverflow.com/q/20858109
score: 0

http://stackoverflow.com/a/21003490
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21003353
has body: System.out.println("hello"); only writes strings to the console, that is, if you are running this on a Windows Environment for example, that will cause a console window to pop up with the word "Hello". This is usually used for debugging purposes. sendText is used to send a string to the client, that is, someone connected to your app like a remote computer or a web browser. sendText is what you should use. System.out.println is worthless to the browser. Anything you print with System.out.println will not leave your server and will not be received by the browser.
downvote count: 0

http://stackoverflow.com/comment/31674062
type: QuestionComment
comment on: http://stackoverflow.com/q/20942821
has text: Call `out.flush()` after each message (both on server and client) to ensure data is send over the socket connection and not buffered.
score: 0
type: Comment

http://stackoverflow.com/comment/31549468
has text: sources for this assertion?
type: QuestionComment
comment on: http://stackoverflow.com/q/20995036
type: Comment
score: 0

http://stackoverflow.com/a/21000300
has comment: http://stackoverflow.com/comment/31558946
score: 0
answers question: http://stackoverflow.com/q/21000069
has comment: http://stackoverflow.com/comment/31558921
upvote count: 1
downvote count: 1
has body: The answer is in your question :- java.lang.String cannot be converted to JSONObject Obviously you are trying to convert a string into json which is not possible by the way. Look at your code again or debug it and tell the error on which the exception is coming. Not just the line number, the code on that line too. Secondly, you are using ASYNCTASK so don't write these lines :- StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); It is bad coding to use StrictMode
type: Answer

http://stackoverflow.com/comment/31475377
type: QuestionComment
comment on: http://stackoverflow.com/q/20944719
score: 0
type: Comment
has text: possible duplicate of [JFreeChart does not show the graph at every iteration on thread?](http://stackoverflow.com/questions/20884694/jfreechart-does-not-show-the-graph-at-every-iteration-on-thread)

http://stackoverflow.com/q/20942872
has title: Java AES Encryption (working) and Python Decryption (not working)
tagged with: encryption
tagged with: python
has body: I'm trying to encrypt a message in Java and decrypt it in Python. Unfortunately i'm just starting with python and am not able to get the decryption working. That's my Java Code: KeyGenerator keygen = KeyGenerator.getInstance("AES"); SecureRandom sr = SecureRandom.getInstance("SHA1PRNG"); byte[] iv = sr.generateSeed(16); IvParameterSpec ivSpec = new IvParameterSpec(iv); SecretKey aesKey = keygen.generateKey(); //save byte array in text file to recreate key later byte[] encodedKey = aesKey.getEncoded(); new File("myPath\\AESKey.txt"); FileOutputStream fos = new FileOutputStream("myPath\\AESKey.txt"); //save AesKey in first 16 bytes and Initial Vector in next 16 bytes fos.write(encodedKey); fos.write(iv); fos.close(); String secretText = "Hello cryptography"; Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, aesKey, ivSpec); byte[] encrypted = cipher.doFinal(secretText.getBytes()); BASE64Encoder myEncoder = new BASE64Encoder(); String encodedSecretText = myEncoder.encode(encrypted); new File("myPath\\encodedSecretText.txt"); FileOutputStream fos2 = new FileOutputStream("myPath\\encodedSecretText.txt"); fos2.write(encodedSecretText.getBytes()); fos2.close(); I was able to decrypt the message with java, but not with python. I hope someone can show me how to do this.i copied the part with padding from another answer and assume that's the problem. I get the message: ord() expected string of length 1, but int found. Python: from Crypto import Random from Crypto.Cipher import AES import base64 BS = 16 pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS) unpad = lambda s : s[0:-ord(s[-1])] #read bytes of aesKey file = open("myPath/AESKey.txt","rb") aesKey = file.read(16) iv = file.read(16) file.close() sec = open("myPath/encodedSecretText.txt") for line in sec: encodedSecretText = line.rstrip() sec.close() class AESCipher: def __init__( self, key ): self.key = key def encrypt( self, raw ): raw = pad(raw) iv = Random.new().r…
tagged with: java
has comment: http://stackoverflow.com/comment/31483026
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/31452615
type: Question
has comment: http://stackoverflow.com/comment/31480065
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/20942998
has comment: http://stackoverflow.com/comment/31482113
has comment: http://stackoverflow.com/comment/31484288
has comment: http://stackoverflow.com/comment/31481988
favorite count: 0
tagged with: aes
has comment: http://stackoverflow.com/comment/31452777
has comment: http://stackoverflow.com/comment/31482324
type: UnansweredQuestion

http://stackoverflow.com/comment/31492320
type: AnswerComment
type: Comment
has text: OP wants the output to be in descending order.
comment on: http://stackoverflow.com/a/20964000
score: 0

http://stackoverflow.com/a/20868936
has comment: http://stackoverflow.com/comment/31320986
score: 0
answers question: http://stackoverflow.com/q/20856282
has body: Try to add the following to your deployment Structure XML or module dependency where you try to access your module &lt;dependencies&gt; &lt;module name="org.mymodule" export="true" meta-inf="import"/&gt; &lt;/dependencies&gt;
type: Answer
has comment: http://stackoverflow.com/comment/31316300
has comment: http://stackoverflow.com/comment/31330231

http://stackoverflow.com/a/20899145
has body: I decided to use the ReflectData API to generate the Schema from the class at runtime and then use the ReflectDatumWriter for serialization. Use of reflection will be slower. But, it looks like the schema is cached internally. I will report back if I see performance issues. Schema schema = ReflectData.AllowNull.get().getSchema(sourceObject.getClass()); ReflectDatumWriter&lt;T&gt; reflectDatumWriter = new ReflectDatumWriter&lt;&gt;(schema); DataFileWriter&lt;T&gt; writer = new DataFileWriter&lt;&gt;(reflectDatumWriter); try { writer.setCodec(CodecFactory.snappyCodec()); writer.create(schema, new File("data.avro")); writer.append(sourceObject); writer.close(); } catch (IOException e) { // log exception }
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/20864470
upvote count: 2

http://stackoverflow.com/comment/31614854
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21016788
has text: As Michael says below, you will have to use one library or another, so some complication is to be expected. But any of the libraries mentioned has decent documentation, so it's not that hard. Thwyvare all independent of the actual IDE, you can use Eclipse or IntelliJ or Netbeans with the same effort.

rest
tags question: http://stackoverflow.com/q/20874896
tags question: http://stackoverflow.com/q/20941708
tags question: http://stackoverflow.com/q/20925278
tags question: http://stackoverflow.com/q/20949872
tags question: http://stackoverflow.com/q/20946659
tags question: http://stackoverflow.com/q/20892020
tags question: http://stackoverflow.com/q/20913283
tags question: http://stackoverflow.com/q/20886690
tags question: http://stackoverflow.com/q/20897094
tags question: http://stackoverflow.com/q/20950486
tags question: http://stackoverflow.com/q/20913975
tags question: http://stackoverflow.com/q/20867549
tags question: http://stackoverflow.com/q/20890340
tags question: http://stackoverflow.com/q/20991866
tags question: http://stackoverflow.com/q/20923600
tags question: http://stackoverflow.com/q/20952872
tags question: http://stackoverflow.com/q/20960983
tags question: http://stackoverflow.com/q/20901739
tags question: http://stackoverflow.com/q/20896605
tags question: http://stackoverflow.com/q/20868093
tags question: http://stackoverflow.com/q/21017532
tags question: http://stackoverflow.com/q/20945409
tags question: http://stackoverflow.com/q/20931722
type: Tag
tags question: http://stackoverflow.com/q/20877706
tags question: http://stackoverflow.com/q/20892946
tags question: http://stackoverflow.com/q/20937152
tags question: http://stackoverflow.com/q/20907488
tags question: http://stackoverflow.com/q/20910632
tags question: http://stackoverflow.com/q/20951852
tags question: http://stackoverflow.com/q/21013890
tags question: http://stackoverflow.com/q/20955873
tags question: http://stackoverflow.com/q/20972438
tag name: rest
tags question: http://stackoverflow.com/q/20853124
tags question: http://stackoverflow.com/q/20899738
tags question: http://stackoverflow.com/q/20985481
tags question: http://stackoverflow.com/q/20969664
tags question: http://stackoverflow.com/q/20902790
tags question: http://stackoverflow.com/q/20997346
tags question: http://stackoverflow.com/q/20971607
tags question: http://stackoverflow.com/q/20987720
tags question: http://stackoverflow.com/q/20961089

http://stackoverflow.com/comment/136337213
comment on: http://stackoverflow.com/a/20897452
has text: @WoooHaaaa looks like you stole that graphic from https://developer.ibm.com/articles/j-zerocopy/ so i've downvoted you
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31586630
has text: welcome to SOF. You need to `import` them before use them! or you need to add their `jar` into your build path before `import`
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21015225

http://stackoverflow.com/q/20914327
has title: Want to create a JFrame and JPanel in the same class and have my own paintComponent?
has answer: http://stackoverflow.com/a/20924223
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/31414881
has body: I am trying to create a simple JFrame and JPanel in the same class but I do not want to extends either of the JFrame or JPanel Java classes. I want to be able to also include my own paintComponent() which will override the Panel paint component so that I can paint my own paint component. I would like to just create my JPanel p = new JPanel (); JFrame f = new JFrame (); in one class. At somepoint I will use this to try and find a way to subtract and add bufferedimages but that is for a different question. Class: import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.JFrame; import javax.swing.JPanel; public class SubtractBufferedImage { private static final long serialVersionUID = 1L; Dimension dimension = new Dimension(755,450); public SubtractBufferedImage() { JFrame f = new JFrame(); JPanel d = new JPanel();/*User defined class that is above*/ d.setBackground(Color.BLACK); f.add(new myPanel()); f.setSize(745,440); f.setSize(dimension); f.setResizable(false); f.setLocationRelativeTo(null); f.setTitle("Subtract Buffered Images"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); } public static void main(String[] args) { SubtractBufferedImage t = new SubtractBufferedImage(); } } class myPanel extends JPanel { private BufferedImage bTest1 = null; private BufferedImage bTest2 = null; Dimension dimension = new Dimension(755,450); private String iOne = "src/com/ddh/graphicsBook/CardImage/hold.jpg"; private String iTwo = "src/com/ddh/graphicsBook/CardImage/draw.jpg"; myPanel() { bTest1 = loadAnyImage(iOne); bTest2 = loadAnyImage(iTwo); } private BufferedImage loadAnyImage(String value){ BufferedImage newImage = null; try { newImage = ImageIO.read(new File(value)); } catch (IOException e) { e.printStackTrace(); } return newImage; } private void drawImageToScreen(Graphics …
has comment: http://stackoverflow.com/comment/31400282
tagged with: jpanel
has comment: http://stackoverflow.com/comment/31399577
score: 0
accepted answer: http://stackoverflow.com/a/20924223
has comment: http://stackoverflow.com/comment/31398447
has comment: http://stackoverflow.com/comment/31415813
answer count: 1
tagged with: paintcomponent
has comment: http://stackoverflow.com/comment/31398510
tagged with: jframe
has comment: http://stackoverflow.com/comment/31398503
has comment: http://stackoverflow.com/comment/31400295
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/31526851
type: Comment
type: AnswerComment
has text: @Raźnyy the method `getSpriteCache` does nothing in the `Stage` class and returns `null` in the `Main` class. One of them needs to return an actual instance of `SpriteCache` otherwise you'll end up with the same error. Somewhere in your code you should instantiate a new `SpriteCache` and use it.
comment on: http://stackoverflow.com/a/20982000
score: 0

http://stackoverflow.com/comment/31658097
has text: That is actually the output of a '/bin/ls -l' command so the -> symbol represents the link of the symlink file. My ant version is 1.7.0. And the I downloaded a 1.7.1 ant-nodeps .. so yes, their version differs, but could that cause my error message ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20992485

http://stackoverflow.com/comment/31572258
comment on: http://stackoverflow.com/q/21007064
score: 0
has text: There is no (real) way to create a self contained exe of a Java program. The JVM must be installed some where on the system. Many of the applications you are talking about require libraries which may not be installed on the target system. C++ redistribution libraries, DirectX libraries etc. You can create an executable wrapper for a Jar file which provides the means for the user to double click a "executable" file, but this will simply launch the JVM and execute the required Jar file...
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20942147
has body: when I raise request with follow url: myip/searchapp/genericSearch/genericSearchInit.html?securityName=&amp;identifierType=3&amp;identifierCode=test&amp;vendor=4&amp;startDate=10%252F1%252F2013&amp;priceType=&amp;currency=&amp;endDate=&amp;exchange= I got 400 error: Failed to load resource: the server responded with a status of 400 (Bad Request) But when I give some values such as myip/searchapp/genericSearch/genericSearchInit.html?securityName=&amp;identifierType=3&amp;identifierCode=test&amp;vendor=4&amp;startDate=10%252F1%252F2013&amp;priceType=1&amp;currency=1&amp;endDate=1&amp;exchange=1 and it become legal url. can any guy tell me why? and how can I deal with it?
tagged with: web
tagged with: jquery
possible better answer: http://stackoverflow.com/a/20942172
accepted answer: http://stackoverflow.com/a/20942169
favorite count: 0
type: AnsweredQuestion
upvote count: 1
downvote count: 1
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/20942169
has comment: http://stackoverflow.com/comment/31451215
has comment: http://stackoverflow.com/comment/31451204
tagged with: java
has comment: http://stackoverflow.com/comment/31451300
has answer: http://stackoverflow.com/a/20942172
score: 0
has title: URL submit with "get" mode, response"400" error
answer count: 2
has comment: http://stackoverflow.com/comment/31451288

http://stackoverflow.com/comment/31345325
has text: There is no `CREATE TABLE` statement in the code you posted (and the use of the `max()` function in `SELECT` statement is invalid as well - unless MS-Access has a very strange SQL dialect)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20886851
score: 1

http://stackoverflow.com/comment/31465702
type: Comment
has text: Not that I know of, not without byte-code manipulation. I would suggest trying to refactor your application to remove the finalizers if you believe they are the issue.
comment on: http://stackoverflow.com/q/20950086
score: 3
type: QuestionComment

http://stackoverflow.com/comment/31537634
has text: csv does not have a notion of 'sheets'. Spreads sheets do.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20988317
score: 1

http://stackoverflow.com/a/20933655
score: 2
downvote count: 0
has body: You are right in doubting the simple for loop approach. It would be slow. The request is blocking, so you'll be waiting for the result of request 1 before firing request 2. Look into doing this asynchronously, firing multiple requests at once. It's hard to say more without details on the API. Is it an online web service? Something internal created by another department? If it does not exist, consider asking for a version of that function that can receive multiple parameters at once, instead of having to do tons of tiny calls.
answers question: http://stackoverflow.com/q/20933553
accepted answer of: http://stackoverflow.com/q/20933553
upvote count: 2
has comment: http://stackoverflow.com/comment/31434646
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/31439256

http://stackoverflow.com/q/20887878
tagged with: gwt
score: 1
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/20889186
type: Question
answer count: 1
downvote count: 0
has body: We are using GWT in our product with mojo gwt-maven-plugin 2.4 to compile the GWT code. But we observed that when we run mvn install, the gwt maven plugin is running the permutations even when no code changes are made to GWT code. After struggling on this issue for quite some time, we were able to reproduce it with a simple setup using 2 maven projects: 1st project(MyGwtMavenSampleSource) : Contains the GWT code along with the gwt module xml file 2nd project (MavenBuilderMod): Contains the MyGwtMavenSampleSource as maven dependency and will build the war file. Below are the poms for both the projects: 1st Project: MyGwtMavenSampleSource <?xml version="1.0" encoding="UTF-8"?> 4.0.0 GWTMavenPlugin MyGwtMavenSampleSource jar 0.0.1-SNAPSHOT GWT Maven Archetype 2.4.0 ${project.build.directory}/${project.build.finalName} <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> com.google.gwt gwt-servlet ${gwtVersion} runtime com.google.gwt gwt-user ${gwtVersion} provided junit junit 4.7 test javax.validation validation-api 1.0.0.GA test javax.validation validation-api 1.0.0.GA sources test src/main/java **/*.* src/main/resources **/*.* org.apache.maven.plugins maven-jar-plugin 2nd Project: MavenBuilderMod 4.0.0 GWTMavenPlugin MavenBuilderMod war 0.0.1-SNAPSHOT 2.4.0 ${project.build.directory}/${project.build.finalName} <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> com.google.gwt gwt-servlet ${gwtVersion} runtime com.google.gwt gwt-user ${gwtVersion} provided junit junit 4.7 test javax.validation validation-api 1.0.0.GA test javax.validation validation-api 1.0.0.GA sources test GWTMavenPlugin MyGwtMavenSampleSource 0.0.1-SNAPSHOT compile ${webappDirectory}/WEB-INF/classes org.apache.maven.plugins maven-dependency-plugin 2.8 src-dependencies package unpack-dependencies sources <failOnMissingClassifierArtifact>false</failOnMissingClassifierArtifact> ${project.build.directory}/sources org.codehaus.mojo gwt-maven-plugin 2.4.0 compile MyGwtMavenSa…
favorite count: 0
has title: gwt-maven-plugin runs permutations even when there are no changes
type: UnansweredQuestion
tagged with: maven
upvote count: 1
tagged with: plugins

http://stackoverflow.com/comment/31541045
has text: How are you accessing the Record method?
comment on: http://stackoverflow.com/q/20989587
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21305303
has body: For a Java solution, you could use iText to read the fields and then something like jackson-dataformat-xml to write the results as XML. A, somewhat basic, example of this would be: // read fields final PdfReader reader = new PdfReader("/path/to/my.pdf"); final AcroFields fields = reader.getAcroFields(); final Map&lt;String, Object&gt; values = new HashMap&lt;&gt;(); for (String fieldName : (Set&lt;String&gt;) fields.getFields().keySet()) { values.put(fieldName, fields.getField(fieldName)); } // write final XmlMapper mapper = new XmlMapper(); final String result = mapper.writeValueAsString(values); System.out.println(result); There is definitely some room for improvement here, but it may be a good enough starting point.
has comment: http://stackoverflow.com/comment/32116966
answers question: http://stackoverflow.com/q/21009608
score: 0
has comment: http://stackoverflow.com/comment/32118301
type: Answer
has comment: http://stackoverflow.com/comment/32132925

http://stackoverflow.com/q/21006192
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21006227
tagged with: java
tagged with: selenium
downvote count: 1
type: Question
upvote count: 0
has body: I have a dropdown with multiple options. Please Select... Technology Architecture The Avengers Human Resources R&D Quality Services Publishing Product Development MI6 - British Secret Service Finance Public Relations Client Services For my automated tests, I have a class where I create objects. So for all my dropdowns, I have an object created. Here is the object I created for the above dropdown. public static final String Basic7_Dropdown = "css=select#ctl00_cphMainContent_dq16_response"; I use this object in other methods to test the dropdown. For example, I have a method where I want to verify all the available options in the dropdown. protected void verifyDropDownValues(String selector, String expectedvalue) { List<String> listA = new ArrayList<String>(); listA.add(expectedvalue); List<String> listB = new ArrayList<String>(); List<Element> options = driver.getElements(selector); for(Element opt : options){ String actualtext = opt.getText(); listB.add(actualtext); } Assert.assertEquals(listB, listA); } When I use this method in my tests, the selector parameter is the Basic7_Dropdown object that I created. verifyDropDownValues(AppObjects.Basic7_Dropdown, "Please Select...\nTechnology Architecture\nThe Avengers\nHuman Resources\nR&D\nQuality Services\nPublishing\nProduct Development\nMI6 - British Secret Service\nFinance\nPublic Relations\nClient Services"); By using the same Basic7_Dropdown object I created, how can I create a method that will find the option that has the attribute of selected="selected", and then display that text. I tried the below code hoping to get it to return the selected value of "Please Select...". However, it doesn't return any options. List<Element> options = driver.getElements(AppObjects.Basic1_Dropdown); for(Element opt : options){ if (opt.getAttribute("selected") != null) { String actualtext = opt.getText(); System.out.println(actualtext); } } I don't believe my list is getting all the options. When I run the below code, it only prints…
score: -1
linked to: http://stackoverflow.com/q/12621075
has answer: http://stackoverflow.com/a/21006227
answer count: 1
favorite count: 0
has title: How can I display text of an option that has a certain attribute?

http://stackoverflow.com/a/20999215
answers question: http://stackoverflow.com/q/20999164
accepted answer of: http://stackoverflow.com/q/20999164
score: 10
has body: I think you can use @formatter:off and @formatter:on // @formatter:off public void fluentIterfaceThingy() { ... } // @formatter:on You might have to turn this option on in the code style section: Window-&gt;Preferences-&gt;Java-&gt;Formatter-&gt;Edit-&gt;On/Of Tags
has comment: http://stackoverflow.com/comment/31556817
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31556692
upvote count: 10

http://stackoverflow.com/q/20932764
has title: How to open any PDF and word file in Swing JTextArea?
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31432663
has comment: http://stackoverflow.com/comment/31433602
tagged with: swing
answer count: 1
tagged with: jtextarea
type: AnsweredQuestion
tagged with: http://stackoverflow.com/tag/pdf
tagged with: ms-word
has body: I'm doing Java swing application to open any PDF, word, notepad or Java file. But I'm only able to open text file. PDF and word is opening but not properly so please help me.
has answer: http://stackoverflow.com/a/20932792
type: Question
accepted answer: http://stackoverflow.com/a/20932792

http://stackoverflow.com/a/20882372
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/20880744
has comment: http://stackoverflow.com/comment/31389852
answers question: http://stackoverflow.com/q/20880744
has body: Except problem with "all is visited" check I see at least one more problem, which is in class fields. When algorithm passes one branch of recursion, it marks some squares as visited, and since this information is class field, when it fails current branch and starts another, it sees all invalid information from previous attempts. What if you try to pass positionsVisited, positionX and positionY as method arguments and remove it from class fields, so each method call will have it's own actual copy? Final version public class KnightChessRiddle { private final static Map&lt;Integer, Character&gt; letters = new HashMap&lt;&gt;(); static { letters.put(0, 'a'); letters.put(1, 'b'); letters.put(2, 'c'); letters.put(3, 'd'); letters.put(4, 'e'); letters.put(5, 'f'); } public static void main(String[] args) { if (recursive(0, 0, 0, new boolean[6][6], 1, "")) { System.out.println("yes"); } else { System.out.println("no"); } } private static boolean allVisited(boolean[][] positionsVisited) { for (int i = 0; i &lt; positionsVisited.length; i++) { for (int j = 0; j &lt; positionsVisited.length; j++) { if (!positionsVisited[i][j]) { return false; } } } return true; } private static boolean recursive(int positionX, int positionY, int moveType, boolean[][] positionsVisited, int moveCounter, String currentMoves) { // checks if (allVisited(positionsVisited)) { System.out.println(currentMoves); return true; } if (positionX &gt; 5 || positionX &lt; 0 || positionY &gt; 5 || positionY &lt; 0) { return false; } if (positionsVisited[positionX][positionY]) { return false; } // make move positionsVisited[positionX][positionY] = true; char c = letters.get(positionX); currentMoves += "" + c + (positionY + 1) + " (move type: " + (moveType + 1) + ")\r\n"; if (recursive(positionX + 2, positionY + 1, 1, cloneArray(positionsVisited), moveCounter + 1, currentMoves)) { return true; } else if (recursive(positionX + 1, positionY + 2, 2, cloneArray(positionsVisited), moveCounter + 1, currentMoves)) { ret…
type: AcceptedAnswer

http://stackoverflow.com/a/20940879
answers question: http://stackoverflow.com/q/20940353
type: AcceptedAnswer
type: Answer
has body: case CONNECTED: try { // Send data if (toSend.length() != 0) { out.print(toSend); out.flush(); toSend.setLength(0); changeStatusTS(NULL, true); } // Receive data if (in.ready()) { s = in.readLine(); if ((s != null) &amp;&amp; (s.length() != 0)) { // Check if it is the end of a trasmission if (s.equals(END_CHAT_SESSION)) { changeStatusTS(DISCONNECTING, true); } // Otherwise, receive what text else { appendToChatBox("INCOMING: " + s + "\n"); changeStatusTS(NULL, true); } } } } catch (IOException e) { cleanUp(); changeStatusTS(DISCONNECTED, false); } break; I took this code snippet from the "main procedure" of the link you provided. The method that would halt the thread from continuing like you were talking about is in.readLine(); The thread would wait until there was something to read from the input stream before continuing. I would like to point out the if statement " if(in.ready()) " By having that if statement there, the code checks first if the input stream has something to read. Otherwise, it skips over it and continues.
accepted answer of: http://stackoverflow.com/q/20940353
has comment: http://stackoverflow.com/comment/31448880
score: 0

http://stackoverflow.com/comment/31455810
type: AnswerComment
score: 0
type: Comment
has text: ..the conclusion we can reach is 'No can do', at least not for IE.
comment on: http://stackoverflow.com/a/20943558

http://stackoverflow.com/comment/31567245
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21004626
has text: If you don't know how to initialize students try this : List<Student> students = new ArrayList<Student>();
score: 0

http://stackoverflow.com/comment/31426581
has text: @TheNomad you need to cast. I checked the code by making a new project.
comment on: http://stackoverflow.com/q/20929248
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20882098
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20882063
type: Answer
score: 6
accepted answer of: http://stackoverflow.com/q/20882063
upvote count: 6
has comment: http://stackoverflow.com/comment/31336584
has body: Your url is not properly encoded, use encodeURIComponent var url = 'getList?subsNums='+encodeURIComponent(subsNumbers);

http://stackoverflow.com/a/21007449
has body: Yes, very easily. Just do it like this: int x = 0; for (x=1; x&lt;=3; x++) { System.out.println("Number: " +x); } System.out.println("Done! Counted to: "+x); You don't have to declare a new variable in the loop, you can use an existing one if you want to.
type: Answer
answers question: http://stackoverflow.com/q/21007404
score: 1
upvote count: 1
downvote count: 0

code-generation
tag name: code-generation
tags question: http://stackoverflow.com/q/20934652
type: Tag

http://stackoverflow.com/q/20983481
has title: "create new visual classes" button not clickable on eclipse
tagged with: gwt-designer
answer count: 1
favorite count: 0
upvote count: 4
tagged with: gwt
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23947729
downvote count: 0
tagged with: java
has body: I installed a new GUI designer software, and than restarted eclipse as requested but when eclipse reopened I couldn't click the "create new visual classes" button. it's clickable but it doesn't do anything. I have to click it in order to install the toolkit and to create a new jframe. I downloaded the GUI designer from the following link:https://developers.google.com/eclipse/docs/download and I used the tutorial to install it in this link:http://www.youtube.com/watch?v=8kSjGNcKYDI my eclipse is Kepler version. How can I finish installing the GUI designer (and use it)
tagged with: google-plugin-eclipse
tagged with: eclipse
has comment: http://stackoverflow.com/comment/31599160
type: Question
has answer: http://stackoverflow.com/a/23947729
score: 4

http://stackoverflow.com/comment/31376711
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20902629
has text: I'd start with that query. There's no way a SQL query should take 30 seconds. How many rows are you bringing back - millions? That would explain it, too.

http://stackoverflow.com/a/20857531
upvote count: 6
has body: I advise you to surround each statement with try-catch: try{ eingabe1 = Integer.parseInt(textfield1.getText()); } catch (NumberFormatException e) { /* Exception from textfield1 */ } try { eingabe2 = Integer.parseInt(textfield2.getText()); } catch (NumberFormatException e) { /* Exception from textfield2 */} When you put many statements in a try block, you usually handle the exception that happened in the same way, independently from the object that caused the exception.
answers question: http://stackoverflow.com/q/20857496
downvote count: 1
has comment: http://stackoverflow.com/comment/31290426
has comment: http://stackoverflow.com/comment/31290035
has comment: http://stackoverflow.com/comment/31289987
has comment: http://stackoverflow.com/comment/31290022
score: 5
type: Answer

http://stackoverflow.com/a/21022346
answers question: http://stackoverflow.com/q/21016516
type: Answer
has body: I don't know of this will help, but if you haven't already done so, you can edit your hibernate.cfg.xml file and set hibernate.show_sql from false to true in order to see what sql statements are generated when the exception occurs. Examining them may provide you a clue on what is going on. You may also consider putting print statements (System.out.println) in your set*() functions to see what primary and foreign key values are so you can examine the data in the database (now that you know the primary key value, you can see what record is being processed). Example: System.out.println("in MyDaoClass: calling customer table: setId()="+customer.getID());
score: 0

http://stackoverflow.com/comment/86188847
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20886486
has text: Dividing peakIdx by size is not so smart because division of binary numbers involves numerous add + shift operations. It's much faster to check if the peak index lies within the boundary indices of the current block as this uses 2 subtraction and 1 logical comparison operations.
score: 0

http://stackoverflow.com/a/20924815
answers question: http://stackoverflow.com/q/20924602
score: 0
has body: My friend In a strongly typed languages, for ex: in C or Java, when a variable or reference is declared, it must be informed to the compiler what data type the variable or reference is of
type: Answer

http://stackoverflow.com/comment/31479481
type: QuestionComment
comment on: http://stackoverflow.com/q/20957455
score: 1
has text: Why is this tagged [eclipse](http://stackoverflow.com/tags/eclipse/info)?
type: Comment

http://stackoverflow.com/comment/31331211
score: 2
comment on: http://stackoverflow.com/q/20878999
has text: After edit still `NPE` then your `object` is `null`. Check that you have valid reference in `object` on which you are calling `getsomeFiles()`.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21003230
answers question: http://stackoverflow.com/q/21001521
score: 0
type: AcceptedAnswer
has body: The @Valid annotation is defined by the Bean Validation specification (JSR 303/349) which is implemented by both, Hibernate Validator (which is the reference implementation) and Apache BVal. So @Valid is supposed to work on both implementations.
type: Answer
has comment: http://stackoverflow.com/comment/31565758
accepted answer of: http://stackoverflow.com/q/21001521

http://stackoverflow.com/a/20916077
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/20909180
answers question: http://stackoverflow.com/q/20909180
has body: The unit tests aren't in the main jars. As is common with Maven based projects, if you look at the Apache OpenCMIS Source in SVN, within each module you have directories src/main/java and src/test/java . When Maven builds the project, it compiles both, but only puts the main outputs into the binary jar. The test ones are used locally to run the tests, but aren't packaged. (The OpenCMIS test helpers, however, are built and packaged, they have artificats like chemistry-opencmis-test-util and chemistry-opencmis-test-tck) If you wanted to run the TCK tests, you can just grab the artifacts from Maven and run. To run the project internal tests, you'll need to either download the source package, or checkout from SVN, then build. At that point, you'll have all the unit tests available to run
has comment: http://stackoverflow.com/comment/31717510
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/20850988
has body: This is not something that is recommended to do in a multi threaded environment as it can break your code in all sorts of ways. For example imagine you are half way through changing something and suddenly your thread gets killed leaving it in a half-modified state. Because it is not recommended no easy way is provided to do it. The correct way to do this is to use a Thread and interrupt it. http://docs.oracle.com/javase/tutorial/essential/concurrency/interrupt.html Inside your Thread code you can check isInterrupted() at times where it would be appropriate to abort and abort, but the abort is controlled by the running thread which is the only thing that knows when it is safe to do so. The ScheduledExecutorService also allows you to work with a ScheduledFuture and cancel that, which then works in the same way as interrupting the thread does. http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Future.html#cancel(boolean)
type: Answer
score: 0
answers question: http://stackoverflow.com/q/20850881

http://stackoverflow.com/q/20978235
has body: I'm having problem getting Spring Framework 4 to work with my existing project using Servlet 2.5. My web project actually runs fine, but my testcases are failing and it is caused by MockHttpServletRequest, which throws this exception:- java.lang.NoClassDefFoundError: javax/servlet/AsyncContext at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) I tried adding either dependency, but I'll get other Servlet 3.0 related exceptions:- javax javaee-api 6.0 test org.mortbay.jetty servlet-api 3.0.20090124 test Based on the Spring Framework website, it is said to work with Servlet 2.5. However, Spring 4's MockHttpServletRequest seems to rely on Servlet 3.0 forward. How do I fix this problem? Thanks.
favorite count: 0
has title: Testing Spring Framework 4 with Servlet 2.5
upvote count: 18
accepted answer: http://stackoverflow.com/a/20978396
tagged with: spring
tagged with: spring-test
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20978396
type: Question
score: 18
downvote count: 0
has comment: http://stackoverflow.com/comment/31518774
answer count: 1

http://stackoverflow.com/comment/31614982
type: Comment
score: 0
comment on: http://stackoverflow.com/q/20912568
has text: As it turns out, a re-importing and recompilation solved the issue (which was module-specific, not project-specific).
type: QuestionComment

http://stackoverflow.com/a/20950511
answers question: http://stackoverflow.com/q/20945274
has comment: http://stackoverflow.com/comment/31476027
type: Answer
score: 0
has body: JacksonJsonProvider.class is used for marshalling and unmarshalling JSON Array to your custom BO (Friends) that can be mapped data in mysql database. You do need to use GSON for converting your BO (Friends) into JSON Object JacksonJsonProvider does it for you. The class can be obtained using jackson-all-1.9.11.jar.

http://stackoverflow.com/comment/31530078
has text: Well I plan on having a map of cubes (Minecraft style) and from my understanding, to modify the float data for each tile in the map, I should be using Dynamic drawing.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20979673

http://stackoverflow.com/comment/31407918
type: QuestionComment
has text: try and catch(NullPointerException e) if I understand you well , and nullpointer exception means your object is null
comment on: http://stackoverflow.com/q/20919734
score: 0
type: Comment

http://stackoverflow.com/a/20858281
type: Answer
has body: If you want to exit why you are starting activity again. use only this.finish(), remove other statements. Take look at activity life cycle for more info
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20858234

http://stackoverflow.com/q/20965807
has answer: http://stackoverflow.com/a/20965910
has comment: http://stackoverflow.com/comment/31495488
has title: Replace ArrayList Values with new String Values
has comment: http://stackoverflow.com/comment/31497695
has comment: http://stackoverflow.com/comment/31495870
tagged with: arraylist
has comment: http://stackoverflow.com/comment/31495471
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/31495888
favorite count: 0
has answer: http://stackoverflow.com/a/20966413
has comment: http://stackoverflow.com/comment/31551655
type: UnansweredQuestion
has body: i have a arraylist called arrstatus which has a set of Numeric values stored dynamically. I have to Replace those Numeric Values with Unique String values. I tried various methods it doesnt seem to be working i tries Set method, didnt work, // int[] flags = new int[arrstatus_old.size()]; int [] c = new int [arrtaskid.size()]; Toast.makeText(MyTask.this, "C:"+c, Toast.LENGTH_LONG).show(); for(int j=1;j&lt;= c.length;j++) { if(arrstatus.get(j).equals("1")) { arrstatus_old.set(j, "Saved"); } else if(arrstatus.get(j).equals("2")) { arrstatus_old.set(j, "Assigned"); } else if(arrstatus.get(j).equals("3")) { arrstatus_old.set(j, "Accepted"); } else if(arrstatus.get(j).equals("4")) { arrstatus_old.set(j, "Rejected"); } } I am not getting the size of the arrastutus, it says 0 and hence no values are getting replaced, any better idea to replace the value.?
tagged with: android
has comment: http://stackoverflow.com/comment/31495494
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31495487
has comment: http://stackoverflow.com/comment/31495445
type: Question

http://stackoverflow.com/a/20919871
has body: You're looking for a Map&lt;K,V&gt; implementation, have a look at HashMap&lt;Object, Integer&gt;
upvote count: 1
type: AcceptedAnswer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/20919838
answers question: http://stackoverflow.com/q/20919838
has comment: http://stackoverflow.com/comment/31408443
type: Answer
has comment: http://stackoverflow.com/comment/31408362

http://stackoverflow.com/comment/31461077
comment on: http://stackoverflow.com/a/20946832
type: Comment
has text: HOW TO ADD SPINNER LABEL PLS HELP. IF ADD TO SPIINER CALSS OBJ IM USING NETBAENS ERROR: UNKNOWN SYMBOL ERROR.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31390453
score: 0
comment on: http://stackoverflow.com/q/20909153
has text: Why did you change the question after accepting the answer?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31582329
type: Comment
comment on: http://stackoverflow.com/a/21011849
type: AnswerComment
has text: Hi Ned. The teacher said we don't have to execute the export command line every time when open terminal window to set up the environment for the current log in session. Here is the lint from him: (Aside: Unix/Linux allows you define environment variables for configuration. The java CLASSPATH variable is a useful variable. If you edit $HOME/.bashrc and place the following definition export CLASSPATH=.:$HOME/objectdraw.jar
score: 0

http://stackoverflow.com/a/21012875
answers question: http://stackoverflow.com/q/21012751
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21012751
has comment: http://stackoverflow.com/comment/31585552
type: Answer
has comment: http://stackoverflow.com/comment/31584924
has body: First, you need to get the date from the component, something like... Date date = jDateChooser1.getDate(); Next you need to format that Date value to a String String strDate = DateFormat.getDateInstance().format(date); Finally, you need to set that value as the text for the lable... jLabel1.setText(strDate); If you have particular formatting requirements, you may need to look at SimpleDateFormat
has comment: http://stackoverflow.com/comment/31584961
score: 9
upvote count: 9

http://stackoverflow.com/comment/31589545
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21013649
score: 0
has text: Use key bindings, for [example](http://stackoverflow.com/a/14001011/230513).

http://stackoverflow.com/comment/31591335
comment on: http://stackoverflow.com/a/21017625
type: AnswerComment
has text: @Stanislavl can you give me some sample implementation of this?
score: 0
type: Comment

http://stackoverflow.com/comment/31449505
type: QuestionComment
has text: What do you mean by "Without a defined sort order the results in the limit() query aren't going to be predictable" ? If the data are all static data , then every time I use query().skip().limit(),the returned result could be different?
comment on: http://stackoverflow.com/q/20896586
score: 0
type: Comment

http://stackoverflow.com/comment/31295808
score: 0
type: Comment
type: QuestionComment
has text: because when i run the program i cant insert things and it returns me an empty list
comment on: http://stackoverflow.com/q/20860380

http://stackoverflow.com/a/20918860
has comment: http://stackoverflow.com/comment/31419833
type: AcceptedAnswer
has body: Replace: Date myDate=(Date)format.parse(rs1.getString(5).substring(0, 10)); getdatecustomer.add(format.format(myDate)); By getdatecustomer.add(format.format(rs1.getDate(5))); EDIT: I suggest you, do not use such kind of tricks. This trick may not be useful in the future. Please learn how to use renderer. And use only proper TableCellRenderer as @MadProgrammer suggest you.
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/31415358
accepted answer of: http://stackoverflow.com/q/20916720
has comment: http://stackoverflow.com/comment/31407850
answers question: http://stackoverflow.com/q/20916720
has comment: http://stackoverflow.com/comment/31406604

http://stackoverflow.com/comment/31410904
type: Comment
has text: @Stevie Why do I get main thread, before barrier in thread, before the barrier in thread, after the barrier main thread, after barrier
comment on: http://stackoverflow.com/a/20921305
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31336306
comment on: http://stackoverflow.com/q/20881551
score: 0
type: Comment
type: QuestionComment
has text: @chrylis JSONObject finalResult = new JSONObject(tokener); String strFinalResult=finalResult.getString("Response"); String decryptedString=""; decryptedString = SimpleCrypto.decrypt(strFinalResult, key);

http://stackoverflow.com/a/20902162
score: 2
answers question: http://stackoverflow.com/q/20902022
upvote count: 2
has body: Your questions seems a bit messy + formating of your code is messy too. But as i understood you, in order to convert String back to JSONObject you can do String someString= getResponseFromServer(); JSONObject jsonObject = new JSONObject(someString); // and then do with jsonObject variable whatever you desire Also as people sugested you can use java libraries such as GSON or JSONLib etc
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/20902022

http://stackoverflow.com/comment/105031736
has text: This didn't work for me. It's still looking for linjinput-linux64.so which doesn't get added with the "apt-get install" line.
type: Comment
comment on: http://stackoverflow.com/a/48283658
score: 1
type: AnswerComment

http://stackoverflow.com/comment/31515440
type: AnswerComment
has text: Okay, yes i know that these errors were fixed and i mentioned in my question that i had the latest bindings. Just to make sure i downloaded them again (2014.01.07). The problem still remains. Also take a look at my 3 points mentioned in the question, thats whats making it interesting.
type: Comment
comment on: http://stackoverflow.com/a/20976333
score: 0

http://stackoverflow.com/q/20999456
tagged with: android
tagged with: python
has comment: http://stackoverflow.com/comment/31557752
has comment: http://stackoverflow.com/comment/31557402
has answer: http://stackoverflow.com/a/20999591
upvote count: 1
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20999802
accepted answer: http://stackoverflow.com/a/20999802
has comment: http://stackoverflow.com/comment/31573629
answer count: 2
has comment: http://stackoverflow.com/comment/31557290
has body: I am developing an application in Android using Google App engine and Google Compute Engine as backend . I have followed the Google's demo code in python as base for my application. Now I have question in my mind that since I am more familiar with Java then Python and also need to consider the fact that Google is supporting Python more then Java in its most of the demo codes, Should I change my GAE backend language to Java?? I should stick with Python and hope that I would come around with Python eventually. Any suggestions are appreciated. Thanks
downvote count: 0
has title: Python or Java as Backend Language in Google App engine?
favorite count: 0
possible better answer: http://stackoverflow.com/a/20999591
has comment: http://stackoverflow.com/comment/31557196
tagged with: google-app-engine

http://stackoverflow.com/comment/31314358
has text: How did you declare your `ArrayList`?
comment on: http://stackoverflow.com/q/20870090
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/21005996
accepted answer of: http://stackoverflow.com/q/21005775
has body: You can use Capture class to expect and capture parameter value: Capture capturedArgument = new Capture(); EasyMock.expect(mockObject.someMethod(EasyMock.capture(capturedArgument)).andReturn(1.5); Assert.assertEquals(expectedValue, capturedArgument.getValue()); Note that Capture is generic type and you can parametrize it with an argument class: Capture&lt;Integer&gt; integerArgument = new Capture&lt;Integer&gt;(); Update: If you want to return different values for different arguments in your expect definition, you can use andAnswer method: EasyMock.expect(mockObject.someMethod(EasyMock.capture(integerArgument)).andAnswer( new IAnswer&lt;Integer&gt;() { @Override public Integer answer() { return integerArgument.getValue(); // captured value if available at this point } } ); As pointed in comments, another option is to use getCurrentArguments() call inside answer: EasyMock.expect(mockObject.someMethod(anyObject()).andAnswer( new IAnswer&lt;Integer&gt;() { @Override public Integer answer() { return (Integer) EasyMock.getCurrentArguments()[0]; } } );
score: 29
answers question: http://stackoverflow.com/q/21005775
has comment: http://stackoverflow.com/comment/81445305
upvote count: 29
has comment: http://stackoverflow.com/comment/31571717
has comment: http://stackoverflow.com/comment/31572196
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31572819
has comment: http://stackoverflow.com/comment/39442081

http://stackoverflow.com/q/20892506
possible better answer: http://stackoverflow.com/a/29195847
score: 5
has body: I'm trying to solve the following interview practice question: A k-palindrome is a string which transforms into a palindrome on removing at most k characters. Given a string S, and an integer K, print "YES" if S is a k-palindrome; otherwise print "NO". Constraints: S has at most 20,000 characters. 0 &lt;= k &lt;= 30 Sample Test Cases: Input - abxa 1 Output - YES Input - abdxa 1 Output - NO My approach I've decided is going to be taking all possible String combinations of length s.length - k or greater, i.e. "abc" and k = 1 -> "ab" "bc" "ac" "abc" and checking if they are palindromes. I have the following code so far, but can't seem to figure out a proper way to generate all these string combinations in the general case: public static void isKPalindrome(String s, int k) { // Generate all string combinations and call isPalindrome on them, // printing "YES" at first true } private static boolean isPalindrome(String s) { char[] c = s.toCharArray() int slow = 0; int fast = 0; Stack&lt;Character&gt; stack = new Stack&lt;&gt;(); while (fast &lt; c.length) { stack.push(c[slow]); slow += 1; fast += 2; } if (c.length % 2 == 1) { stack.pop(); } while (!stack.isEmpty()) { if (stack.pop() != c[slow++]) { return false; } } return true; } Can anyone figure out a way to implement this, or perhaps demonstrate a better way?
tagged with: algorithm
has answer: http://stackoverflow.com/a/29195847
has comment: http://stackoverflow.com/comment/31357201
tagged with: palindrome
has answer: http://stackoverflow.com/a/71619010
has answer: http://stackoverflow.com/a/20892833
has answer: http://stackoverflow.com/a/34247008
has answer: http://stackoverflow.com/a/20893445
has answer: http://stackoverflow.com/a/56846662
favorite count: 0
has answer: http://stackoverflow.com/a/29196538
has answer: http://stackoverflow.com/a/38707763
has title: Determine if a given string is a k-palindrome
upvote count: 6
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20892833
has comment: http://stackoverflow.com/comment/31357106
tagged with: java
downvote count: 1
type: Question
answer count: 8

http://stackoverflow.com/a/21015296
answers question: http://stackoverflow.com/q/21015225
score: 0
has body: You lack the servlet-api jar provided by your targeted servlet container (for example tomcat) see How do I import the javax.servlet API in my Eclipse project? and Where do I get servlet-api.jar from?
type: Answer

http://stackoverflow.com/comment/31354100
score: 1
has text: Didn't know it! From the documentation looks like that it would bring you where you want to go, but you would still have to implement a class implementing SQLData. Have a look at this: http://publib.boulder.ibm.com/infocenter/idshelp/v10/index.jsp?topic=/com.ibm.jdbc_pg.doc/jdbc130.htm
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20889624

http://stackoverflow.com/q/20914383
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17484389
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/20918488
type: Question
answer count: 2
has body: I'm developing an android app, just for myself really, to learn android and also to make something useful for myself. The app is sort of an extension to a desktop application that I wrote. One of the things that the desktop app does is upload some textual data and images to a Dropbox account that I created just for this purpose. The android app offers a pared down implementation of the desktop app, so that I can get some of the same functionality on-the-go. So, when the android app starts up, it checks the dropbox account and downloads any new data that it doesn't already have. For the desktop app (Python), I just did an authentication manually by hitting the dropbox auth endpoint with my dropbox app key (in a browser) and then using the 'code' I got from that to finally get an access token. So I've hardcoded that token into my desktop app, and it bypasses the oAuth process and just uses the token for authentication. It's uploading data just fine. But whereas the Python Dropbox API allows me to do that, I'm not sure how to do that with the android dropbox API. I've been browsing through the classes in the JavaDocs for the API, but it seems that I have to go through the oAuth process to get an AccessTokenPair for authentication (which seems to consist of a key and a secret). Can I not just provide the same token I use in the desktop app to some object (a DropboxAPI instance, maybe) to get authenticated? I realize now that this kind of use for Dropbox is probably not very intuitive, but I'm invested now so I'd like to make it work if I can. EDIT: It seems that you can avoid having to go through the oAuth process if you have an AccessTokenPair (or it's values) saved from a previous authentication session. It looks like the AccessTokenPair is just wrapper for two strings: key and secret. So I suppose my question is now, what are these two values. I have an access token, which is a ~64 character string that my desktop app is using successfully for authentication. Can I u…
tagged with: dropbox
tagged with: dropbox-api
tagged with: android
possible better answer: http://stackoverflow.com/a/38928939
has answer: http://stackoverflow.com/a/20918488
has answer: http://stackoverflow.com/a/38928939
has comment: http://stackoverflow.com/comment/31398715
has title: Dropbox authentication in Android app using previously generated token
linked to: http://stackoverflow.com/q/12275100
tagged with: oauth
has comment: http://stackoverflow.com/comment/31398757

http://stackoverflow.com/q/20959056
has comment: http://stackoverflow.com/comment/31483431
has comment: http://stackoverflow.com/comment/31484360
has body: I have an android app(java) and a python "server", the android app connects to the python server through sockets. When I close the socket through java (socket.close()) the python program does not throw an exception like I excepted it to but when I close the android app (fully close) it throws "[Errno 10054] An existing connection was forcibly closed by the remote host" which is was I wanted it to do from closing it through the socket. How can I know when the android app closed the socket without exiting the app itself? python: def __init__(self, IP, port): try: self.acceptor = socket.socket() self.acceptor.bind((IP, port)) self.acceptor.listen(1) except socket.error, e: print e def start_server(self): #Start server: try: self.sock, self.connecting_ip = self.acceptor.accept() print self.connecting_ip[0] + " connected!" except socket.error, e: print e def wait_for_command(self): stop_flag = True try: while stop_flag: data = self.sock.recv(1024) if data: data_tuple = self.split_msg(data) if data_tuple[0] == self.MSG_REQ: print data_tuple[1] stop_flag = False except socket.error, e print e
type: Question
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31483649
accepted answer: http://stackoverflow.com/a/20959739
has comment: http://stackoverflow.com/comment/31483148
has comment: http://stackoverflow.com/comment/31483121
has comment: http://stackoverflow.com/comment/31483052
has comment: http://stackoverflow.com/comment/31482836
has comment: http://stackoverflow.com/comment/31483234
tagged with: android
has comment: http://stackoverflow.com/comment/31482969
has title: How to know when the socket on the other side is closed
has comment: http://stackoverflow.com/comment/31483420
has answer: http://stackoverflow.com/a/20959739
downvote count: 0
has comment: http://stackoverflow.com/comment/31483461
has comment: http://stackoverflow.com/comment/31482921
tagged with: sockets
has comment: http://stackoverflow.com/comment/31483097
tagged with: python
has comment: http://stackoverflow.com/comment/31482936
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/31492428
type: Comment
has text: @ElliottFrisch sorry if it is confusing, my web server is a separate project to be specific a project using glashfish server. and now i am making a website using tomcat server and sending query eg.("getUSERNAME") and i just need only the response of the server i dont want the list of usernames to last as long as the user is active i just need the list of usernames for a certain page to add to the select tag.should i really need to put it to my session so i cant access it?or there is any other way?
score: 0
comment on: http://stackoverflow.com/q/20964068
type: QuestionComment

http://stackoverflow.com/comment/31479813
type: Comment
comment on: http://stackoverflow.com/q/20957504
has text: You can add the delete option using onItemLongClickListener
score: 1
type: QuestionComment

http://stackoverflow.com/comment/31552130
has text: In your method: public void onAnalog(String name, float value, float tpf), would changing "cam" to "camNode" be correct? I don't see cam as accessible in your full code.
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/20996229

http://stackoverflow.com/comment/50552001
score: 1
has text: Read again. OP's question is not about Strings in general but dynamic variable names. A switch case of a String doesn't solve the problem. A switch case of "variable names" (not values) would help but that's not possible in Java as everyone has pointed out above.
comment on: http://stackoverflow.com/a/31269011
type: AnswerComment
type: Comment

mkdirs
tags question: http://stackoverflow.com/q/21007287
type: Tag
tag name: mkdirs
tags question: http://stackoverflow.com/q/20984405
tags question: http://stackoverflow.com/q/20954796

http://stackoverflow.com/comment/31484656
comment on: http://stackoverflow.com/a/20959870
type: AnswerComment
has text: System.currentTimeMillis would reduce the GC issue. But this will consume CPU cycles, reducing the performance of the system...
score: 1
type: Comment

http://stackoverflow.com/comment/31393453
type: QuestionComment
has text: Do not set the bounds of your JTable. That will mess all up.
comment on: http://stackoverflow.com/q/20911857
score: 1
type: Comment

http://stackoverflow.com/comment/31418141
type: QuestionComment
comment on: http://stackoverflow.com/q/20925090
type: Comment
has text: @BoristheSpider and how will I differentiate between them once they are persisted to the same table?
score: 0

http://stackoverflow.com/q/20984943
has body: So i'm wanting to make a button half as wide as my screen. I want it to work on any device screen size so typing in pixel values is not an option. I am getting my Integer from this code. String widthString = String.valueOf(getWindowManager().getDefaultDisplay().getWidth()); double widthDouble = Double.parseDouble(widthString); double result = widthDouble / 2; String resultString = String.valueOf(result); int myNum = Integer.parseInt(resultString); Then when i run the Integer into the Button like this. Button myButton = new Button(this); myButton.setWidth(myNum); I get an error when i try to run it...any ideas on how to make it work. I'm open for any other methods you might suggest also. Thanks
answer count: 3
possible better answer: http://stackoverflow.com/a/20985540
has answer: http://stackoverflow.com/a/20984998
tagged with: android
has answer: http://stackoverflow.com/a/20985540
has comment: http://stackoverflow.com/comment/31531704
has answer: http://stackoverflow.com/a/20985069
accepted answer: http://stackoverflow.com/a/20984998
type: AnsweredQuestion
tagged with: java
type: Question
has title: Specifically what kind of Integer does the .setWidth or .setHeight use?
score: 0

libgdx
tags question: http://stackoverflow.com/q/20860628
tags question: http://stackoverflow.com/q/21007822
tags question: http://stackoverflow.com/q/20967864
tags question: http://stackoverflow.com/q/20941866
tags question: http://stackoverflow.com/q/20934873
tags question: http://stackoverflow.com/q/20873667
tags question: http://stackoverflow.com/q/20929925
tags question: http://stackoverflow.com/q/20995107
tag name: libgdx
tags question: http://stackoverflow.com/q/20910593
tags question: http://stackoverflow.com/q/21002746
tags question: http://stackoverflow.com/q/20975496
tags question: http://stackoverflow.com/q/20926657
tags question: http://stackoverflow.com/q/20877025
tags question: http://stackoverflow.com/q/20981762
tags question: http://stackoverflow.com/q/20905743
tags question: http://stackoverflow.com/q/20888125
tags question: http://stackoverflow.com/q/20971539
tags question: http://stackoverflow.com/q/20927418
tags question: http://stackoverflow.com/q/20984534
tags question: http://stackoverflow.com/q/20961596
type: Tag
tags question: http://stackoverflow.com/q/20893619
tags question: http://stackoverflow.com/q/20978847
tags question: http://stackoverflow.com/q/20916512
tags question: http://stackoverflow.com/q/20927382
tags question: http://stackoverflow.com/q/20933680
tags question: http://stackoverflow.com/q/20899390
tags question: http://stackoverflow.com/q/20952845
tags question: http://stackoverflow.com/q/20963657
tags question: http://stackoverflow.com/q/20889316
tags question: http://stackoverflow.com/q/20906589
tags question: http://stackoverflow.com/q/20908842
tags question: http://stackoverflow.com/q/20919079
tags question: http://stackoverflow.com/q/20898439
tags question: http://stackoverflow.com/q/20976483
tags question: http://stackoverflow.com/q/20886960
tags question: http://stackoverflow.com/q/20899306
tags question: http://stackoverflow.com/q/20933718
tags question: http://stackoverflow.com/q/20877965
tags question: http://stackoverflow.com/q/20894238
tags question: http://stackoverflow.com/q/20933411

http://stackoverflow.com/comment/61885452
type: AnswerComment
comment on: http://stackoverflow.com/a/21843984
score: 61
type: Comment
has text: The argument presented here is not against erasure, it's against reflection (and runtime type checking in general) - it basically asserts that reflection is bad, so the fact that erasure doesn't play well with them is good. It's a valid point on its own (although many people would disagree); but it doesn't make much sense in context, because Java already has reflection / runtime checks, and they didn't and won't go away. So to have a construct that doesn't play with that existing, non-deprecated part of the language _is_ a limitation, no matter how you look at it.

junit
type: Tag
tags question: http://stackoverflow.com/q/20957482
tags question: http://stackoverflow.com/q/20991069
tags question: http://stackoverflow.com/q/20949337
tags question: http://stackoverflow.com/q/20937055
tags question: http://stackoverflow.com/q/20991683
tags question: http://stackoverflow.com/q/20935242
tags question: http://stackoverflow.com/q/21000822
tags question: http://stackoverflow.com/q/20925764
tags question: http://stackoverflow.com/q/20857167
tag name: junit
tags question: http://stackoverflow.com/q/21006774
tags question: http://stackoverflow.com/q/20879258
tags question: http://stackoverflow.com/q/20955317
tags question: http://stackoverflow.com/q/20865100
tags question: http://stackoverflow.com/q/20852689
tags question: http://stackoverflow.com/q/20978535
tags question: http://stackoverflow.com/q/20879608
tags question: http://stackoverflow.com/q/20976101
tags question: http://stackoverflow.com/q/20864499
tags question: http://stackoverflow.com/q/20933598
tags question: http://stackoverflow.com/q/20966812
tags question: http://stackoverflow.com/q/20965745
tags question: http://stackoverflow.com/q/20891494
tags question: http://stackoverflow.com/q/20899579
tags question: http://stackoverflow.com/q/20930226
tags question: http://stackoverflow.com/q/20903266
tags question: http://stackoverflow.com/q/20935729
tags question: http://stackoverflow.com/q/20969830
tags question: http://stackoverflow.com/q/20950614
tags question: http://stackoverflow.com/q/20898060
tags question: http://stackoverflow.com/q/20907103
tags question: http://stackoverflow.com/q/20920498
tags question: http://stackoverflow.com/q/20983278
tags question: http://stackoverflow.com/q/20856153
tags question: http://stackoverflow.com/q/20877034

http://stackoverflow.com/comment/31505812
type: QuestionComment
comment on: http://stackoverflow.com/q/20969120
has text: Tell us your JMeter version. Help->About Apache JMeter
score: 0
type: Comment

http://stackoverflow.com/comment/31489422
has text: I think he's trying to retrieve contact photos that are already stored on the device, without connecting to the Internet.
comment on: http://stackoverflow.com/a/20884296
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/20873900
tagged with: big-o
answer count: 1
has answer: http://stackoverflow.com/a/20874825
has comment: http://stackoverflow.com/comment/31323650
has body: I am very new at MySQL but I have some experience in OOP in Java. When you have a "database" in memory (like when programming in Java) speed of lookups depend on whether it is stored in the form of a linked list, hashmap, etc. A MySQL database is stored on the hard disk, as it is a file. What is the running time of a lookup in that case? Is there a way to get constant time access to an item in the hard disk like you do when data is in memory? Does it depend on whether its a hard disk or an SSD? Thanks!
has comment: http://stackoverflow.com/comment/31322516
score: 0
tagged with: java
tagged with: mysql
accepted answer: http://stackoverflow.com/a/20874825
tagged with: memory
tagged with: hard-drive
type: Question
type: AnsweredQuestion
has title: MySQL data lookup?
has comment: http://stackoverflow.com/comment/31322001

http://stackoverflow.com/comment/31410085
type: Comment
has text: have you referenced google play service library project??
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/20920996

http://stackoverflow.com/comment/31511935
type: QuestionComment
has text: @ᴍarounᴍaroun I am sorry if you took it personally, I didn't mean to be rude, hahah thanks for the suggestion, you will be disappointed if I'll refuse? have a nice day :)
comment on: http://stackoverflow.com/q/20974558
score: 0
type: Comment

http://stackoverflow.com/q/20864835
tagged with: dropbox-api
has comment: http://stackoverflow.com/comment/31304705
has body: Hey everyone I was doing the dropbox tutorial and I just wondered what DbxRequestConfig config = new DbxRequestConfig( "JavaTutorial/1.0", Locale.getDefault().toString()); means.
downvote count: 2
has title: What is DbxRequestConfig?
upvote count: 1
has answer: http://stackoverflow.com/a/20864852
type: AnsweredQuestion
tagged with: java
score: -1
type: Question
accepted answer: http://stackoverflow.com/a/20864852
answer count: 1
favorite count: 0

http://stackoverflow.com/q/20934097
has body: I am trying to take in some integers through command line arguments and then generate all the possible ordered sets from the set of numbers. The following code does that but it repeats the ordered sets. For example, I input "2 3 4" as the command line input, the output is as follows. 2 3 4 3 2 4 4 3 2 3 2 4 2 3 4 2 4 3 4 3 2 2 4 3 2 3 4 I don't want to repeat an ordered set. For this, I tried to convert the integer array to String and print it only if it has not been repeated by using Equals method. So, when I used Array.toString(b), I was expecting to return a integer converted to string but it returned nine addresses. My questions are: How do I get a string containing the same values of integers instead of the addresses? Please help me with the method I've used or, suggest any simpler method so that an ordered set of numbers, once used is not repeated once generated, so that while printing final set of ordered sets, each one of them are unique. My code is as follows: class Shuffler { void swapWith(int[] a,int m,int n,int sizeOfArray) { int[] b = new int[sizeOfArray]; b = a.clone(); int temp = b[n]; b[n] = b[m]; b[m]=temp; for(int k=0;k&lt;sizeOfArray;k++) {System.out.print(" "+b[k]);} System.out.println(""); } public static void main(String[] args) { int a[] = new int[10]; Shuffler SH = new Shuffler(); for(int i=0;i&lt;args.length;i++) { a[i] = Integer.parseInt(args[i]); } System.out.println("Possibilities are.."); for(int k=0;k&lt;args.length;k++) { for(int j=0;j&lt;args.length;j++) { SH.swapWith(a,k,j,args.length); } } } }
has comment: http://stackoverflow.com/comment/31435190
has comment: http://stackoverflow.com/comment/31435199
favorite count: 0
has comment: http://stackoverflow.com/comment/31435244
has comment: http://stackoverflow.com/comment/31436519
has answer: http://stackoverflow.com/a/20934140
has title: Avoid repetition and print unique ordered sets
has comment: http://stackoverflow.com/comment/31435827
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/4240080
possible better answer: http://stackoverflow.com/a/20934660
has answer: http://stackoverflow.com/a/20934660
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/20934140
score: 1
tagged with: java
answer count: 2
tagged with: arrays
downvote count: 0

http://stackoverflow.com/a/20959160
has comment: http://stackoverflow.com/comment/31483719
has comment: http://stackoverflow.com/comment/31483556
upvote count: 3
has body: You define the buttons here: final JButton redButton = new JButton ("Red"); final JButton greenButton = new JButton ("Green"); final JButton blueButton = new JButton ("Blue"); But then you add entirely new buttons to the actual panel so the buttons with the listeners attached are never added: panel.add(new JButton ("Red")); panel.add(new JButton ("Green")); panel.add(new JButton ("Blue")); You should add the buttons like this: panel.add(redButton); panel.add(greenButton); panel.add(blueButton);
has comment: http://stackoverflow.com/comment/31483027
answers question: http://stackoverflow.com/q/20959053
type: Answer
score: 3
downvote count: 0

http://stackoverflow.com/a/20859480
has body: Solved this myself. Here is the code below... ArrayList&lt;String&gt; businessNames = new ArrayList&lt;String&gt;(); List&lt;Spanned&gt; businessInfo = new ArrayList&lt;Spanned&gt;(); ArrayList&lt;String&gt; businessCategories = new ArrayList&lt;String&gt;(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); expListView = (ExpandableListView) findViewById(R.id.lvExp); String userChoice = (String) getIntent().getExtras().get("userChoice"); if (savedInstanceState != null){ businessInfo = (List&lt;Spanned&gt;) savedInstanceState.getSerializable("businessInfo"); businessNames = savedInstanceState.getStringArrayList("businessNames"); businessCategories = savedInstanceState.getStringArrayList("businessCategories"); new DisplaySavedResults().execute(); } else { new RetreiveSearchResults().execute(userChoice); } } protected void onSaveInstanceState(Bundle savedInstanceState) { super.onSaveInstanceState(savedInstanceState); savedInstanceState.putStringArrayList("businessNames", businessNames); savedInstanceState.putStringArrayList("businessCategories", businessCategories); savedInstanceState.putSerializable("businessInfo", (Serializable) businessInfo); } The new asynctask DisplaySavedResults simply just does the UI changing in the onPostExecute. The doInBackground is left empty.
answers question: http://stackoverflow.com/q/20859079
type: Answer
has comment: http://stackoverflow.com/comment/31294397
downvote count: 1
has comment: http://stackoverflow.com/comment/31294358
accepted answer of: http://stackoverflow.com/q/20859079
score: -1
upvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/31544543
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20991627
has text: You want AJAX then. Google it, there are plenty of tutorials online.
score: 0

http://stackoverflow.com/q/20988931
has title: i want to create pdf in java from xls file using FOP?
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20991779
accepted answer: http://stackoverflow.com/a/20991779
has body: i am using the code at for creating pdf using Apache FOP but i am getting these exceptions when i run the code Hi Testing javax.xml.bind.MarshalException - with linked exception: [com.sun.istack.internal.SAXException2: class com.testFOP.Employee nor any of its super class is known to this context. javax.xml.bind.JAXBException: class com.testFOP.Employee nor any of its super class is known to this context.] at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.marshal(Unknown Source) at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(Unknown Source) at com.testFOP.PDFHandler.getXMLSource(PDFHandler.java:97) at com.testFOP.TestPDF.main(TestPDF.java:37) Caused by: com.sun.istack.internal.SAXException2: class com.testFOP.Employee nor any of its super class is known to this context. javax.xml.bind.JAXBException: class com.testFOP.Employee nor any of its super class is known to this context. at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.reportError(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.reportError(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsXsiType(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.property.ArrayElementNodeProperty.serializeItem(Unknow n Source) at com.sun.xml.internal.bind.v2.runtime.property.ArrayElementProperty.serializeListBody(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.property.ArrayERProperty.serializeBody(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsSoleContent(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsRoot(Unknown Source) ... 5 more Caused by: javax.xml.bind.JAXBException: class com.testFOP.Employee nor any of its super class is known to…
score: 0
answer count: 1
tagged with: apache-fop

http://stackoverflow.com/a/21005139
type: Answer
answers question: http://stackoverflow.com/q/21005043
has body: Since you say that it appears after a long time (over 40 mins) it is likely to be caused by memory leaks (you probably continuously take memory for objects and keep it in use so that the garbage collector can do nothing about it).
score: 0

http://stackoverflow.com/comment/31466664
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20950304
has text: @Bohemian hm, yes, you're right about comparison. That's a good point, thanks. However, there are cases when no comparison is intended per se, and the price should be simply displayed.

http://stackoverflow.com/comment/31469361
has text: @user3054608 Have you tried applying the double-escaping yet?
type: Comment
comment on: http://stackoverflow.com/a/20952008
type: AnswerComment
score: 0

http://stackoverflow.com/comment/61175158
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21005410
has text: to convert `switch` to `if-else` in Android Studio hit alt-enter see-> http://stackoverflow.com/a/28259041/1815624
type: AnswerComment

http://stackoverflow.com/comment/31553223
type: QuestionComment
score: 2
has text: where are you doing the same?
comment on: http://stackoverflow.com/q/20997450
type: Comment

http://stackoverflow.com/q/20968071
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: frameworks
tagged with: administration
downvote count: 0
has title: Framework for administration and distribution of deployments (applications)
favorite count: 0
has body: Are there any frameworks or tools that help with administration and distribution of developed applications to different physical/logical servers for developement/testing/production? I am not searching for a framework or a tool that is specifically designed for doing builds/deployments (e.g. like Jenkins) as i have different needs e.g. ten thousands of different applications and workflows etc. What i want is a framework that has the ability of administrating thousands "elements" (which can be applications/sourcecode files etc.) with different attributes that i can use to save some time with a self programmed solution. A java software would be prefered. I hope that my description somehow makes clear what framework i need. Are there any of these kind available? Commercial software is fine too.
has comment: http://stackoverflow.com/comment/31502740
type: UnansweredQuestion
tagged with: deployment

http://stackoverflow.com/comment/31402260
score: 0
type: Comment
type: QuestionComment
has text: Thank you. They are test files that satisfy the large size requirement. Interesting document though!
comment on: http://stackoverflow.com/q/20897464

http://stackoverflow.com/comment/31481705
type: Comment
has text: no. get is for getting values. you call `this.mSource = new ArrayList<URI>(1); this.mSource.add(new URI(in.readString()));`
comment on: http://stackoverflow.com/a/20958327
type: AnswerComment
score: 0

http://stackoverflow.com/q/20964161
has comment: http://stackoverflow.com/comment/31492569
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20964294
has title: toggle buttons sending different strings
has answer: http://stackoverflow.com/a/20964185
has comment: http://stackoverflow.com/comment/31492695
has body: I have two toggle buttons that are suppose to send out different string code every time i press them. But the problem is that the buttons are sending the same string code '101' and I couldn't figure out how to get them to send different code '101' &amp; '102'. Any advice? java code public void onToggleClicked(View view) { // Is the toggle on? boolean on = ((ToggleButton) view).isChecked(); if (on) { String str = "101".toString(); sendToServer(str); } else { String str = "000".toString(); sendToServer(str); } } public void onToggleClicked1(View view) { // Is the toggle on? boolean on = ((ToggleButton) view).isChecked(); if (on) { String str = "201".toString(); sendToServer(str); } else { String str = "000".toString(); sendToServer(str); } xml code &lt;ToggleButton android:id="@+id/togglebutton" android:layout_width="350dp" android:layout_height="wrap_content" android:layout_x="30dp" android:layout_y="135dp" android:onClick="onToggleClicked" android:textOff="Light1- OFF" android:textOn="Light1- ON" android:textSize="40dip" /&gt; &lt;ToggleButton android:id="@+id/toggleButton1" android:layout_width="350dp" android:layout_height="wrap_content" android:layout_x="30dp" android:layout_y="440dp" android:onClick="onToggleClicked" android:text="ToggleButton" android:textOff="Light2- OFF" android:textOn="Light2- ON" android:checked="false" android:textSize="40dip" /&gt;
downvote count: 1
type: Question
tagged with: java
score: -1
answer count: 3
accepted answer: http://stackoverflow.com/a/20964185
upvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/20964267
has answer: http://stackoverflow.com/a/20964267
tagged with: android
has comment: http://stackoverflow.com/comment/31492551

http://stackoverflow.com/comment/31424180
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20927903
has text: Done, thank you. At present I've deleted the log4j dependency because eclipse can include it without errors (probably it's included in the vert.x dependency).

http://stackoverflow.com/q/20883224
score: 3
has answer: http://stackoverflow.com/a/20883784
tagged with: winapi
has title: Using windows "net use" command from java with win32 api
tagged with: java
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has body: I want to build an application on Java using the Net Use command. I'm trying to find a way to do this via a win32 API (or any other win API). I would like to use a system call to obtain the information programmatically and not to parse the output of the "net use" command in my Java application. I've downloaded jna.jar and jna-platform.jar and tried to find the proper function, but with no success. Could anyone advise if there's a way to this via system call and/or what function to use from jna. Thanks in advance. Alex B
upvote count: 3
has comment: http://stackoverflow.com/comment/31338553
type: Question

http://stackoverflow.com/q/20987951
accepted answer: http://stackoverflow.com/a/20990160
type: Question
possible better answer: http://stackoverflow.com/a/20995269
has comment: http://stackoverflow.com/comment/31539887
has answer: http://stackoverflow.com/a/20995269
tagged with: java
has comment: http://stackoverflow.com/comment/31536927
score: 0
answer count: 2
has title: Is it not required to allocate memory explicitly using new before assigning value to data through a function call in java
upvote count: 1
downvote count: 1
tagged with: initialization
favorite count: 0
has comment: http://stackoverflow.com/comment/31536929
has comment: http://stackoverflow.com/comment/31540565
has comment: http://stackoverflow.com/comment/31541072
type: AnsweredQuestion
tagged with: memory-management
has body: There are three classes. public class A { private B b; private C c; public void abcMethod(){ c = new C(this); b = c.xyzMethod(); // Doubt is here. } } public class B { int i; public void setI( int i){ this.i=i; } public int getI(){ return i; } } public class C { public B xyzMethod(){ B b = new B(); b.setI(10); return b; } } You may have noticed where my doubt is on the code. My question is- 1) why "new" is not required to allocate memory for the object b? Probable answer: "Is it due to the reason that being a data member it has been already allocated memory while object of A got created." 2) Is my probable answer is correct? If its correct, why have we allocated memory to object c using new? Perhaps, its due the reason that "this" was to be passed to the object. So for proper initialization we used new with argument "this". 3) If I am correct at point 2 above, what does happen to the previously allocated memory to object c as new will allocate new chunk of memory and assign the new address to c? Garbage collected? 4) So from above points, we can say memory is allocated for the objects which are members of a containing class, at the time of object creation of the containing class. And we can directly assign value to them with out calling new on them? [I am from C++ background, and this does not happen in C++. If a class is having pointer or reference to other class, we need to explicitly allocate memory for them.] Please, correct me where I am wrong or something is missing in my understanding. Thanks and best regards.
has comment: http://stackoverflow.com/comment/31540036
tagged with: new-operator
has answer: http://stackoverflow.com/a/20990160

http://stackoverflow.com/q/20971850
tagged with: dependency-injection
has comment: http://stackoverflow.com/comment/31506411
tagged with: constructor-injection
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31535058
has comment: http://stackoverflow.com/comment/31535091
accepted answer: http://stackoverflow.com/a/20989038
type: Question
answer count: 2
tagged with: spring
possible better answer: http://stackoverflow.com/a/20972473
has comment: http://stackoverflow.com/comment/31506440
has answer: http://stackoverflow.com/a/20972473
has comment: http://stackoverflow.com/comment/31507455
has title: Setter Injection not working with factory method injection of Spring
score: 0
tagged with: java
has body: I have two beans, SimpleBean and ArgumentBean, I am trying to wire beans through factory method and trying to replace the bean in same bean definition ( I know its pretty bad idea to do so, but I am just doing an experiment) i.e. I have below factory Utilities class: public class FactoryClassUtils { public static ArgumentBean getArgumentBean(String firstArg, int secondArg) { return new ArgumentBean(firstArg, secondArg); } public static SimpleBean getSimpleBean(ArgumentBean firstArg, int secondArg) { return new SimpleBean(firstArg, secondArg); } } and below mentioned Configuration has been specified in the spring config xml: <property name="argumentBean" ref="argumentBean" /> I am getting this error when I am executing above: Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'argumentBean' of bean class [com.view.spring.dataobjects.SimpleBean]: Bean property 'argumentBean' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:805) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:655) Its worth mentioning that all the getters and setters are present in both of the beans. SimpleBean.java has a property of Type ArgumentBean.java. Definition of Simple Bean is : package com.view.spring.dataobjects; public class SimpleBean { private ArgumentBean argumentBean; int argumentCount; public ArgumentBean getArgument() { return argumentBean; } public void setArgument(ArgumentBean argumentBean) { this.argumentBean= argumentBean; } public int getArgumentCount() { return argumentCount; } public void setArgumentCount(int argumentCount) { this.argumentCount = argumentCount; } public SimpleBean(ArgumentBean argument, int argumentCount) { this.argumentBean= argument; this.argumentCount = argumentCount; } public void letHimSay() { argumentBean.saySomething(); System.out.p…
has answer: http://stackoverflow.com/a/20989038

http://stackoverflow.com/q/20986180
has comment: http://stackoverflow.com/comment/31534739
tagged with: 3d
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/31534827
score: 1
has body: So, I've figured out how to accomplish this, sort of. My array is seemingly messed up. The problem is hard to explain, so Ill provide some pictures and code. EDIT: The problem was the for-loops and the x1, y1, z1 variables being controlled by floats public void create() { setup(); render(); } private void makeCube() { texture = glGenBuffers(); cube = glGenBuffers(); FloatBuffer cubeBuffer; FloatBuffer textureBuffer; ArrayList&lt;Float&gt; cubeList = new ArrayList&lt;&gt;(); ArrayList&lt;Float&gt; textureList = new ArrayList&lt;&gt;(); float[] cubeFloat; float[] textureFloat; for (float x1 = 0; x1 &lt; tileSize * width; x1 += tileSize) { for (float y1 = 0; y1 &lt; tileSize * height; y1 += tileSize) { for (float z1 = -tileSize * depth; z1 &lt; 0; z1 += tileSize) { float highX = x1 + tileSize; float highY = y1 + tileSize; float highZ = z1 + tileSize; float[] cubeData = new float[]{ /*Front Face*/ x1, y1, z1, highX, y1, z1, highX, highY, z1, x1, highY, z1, /*Back Face*/ x1, y1, highZ, highX, y1, highZ, highX, highY, highZ, x1, highY, highZ, /*Left Face*/ x1, y1, z1, x1, y1, highZ, x1, highY, highZ, x1, highY, z1, /*Right Face*/ highX, y1, z1, highX, y1, highZ, highX, highY, highZ, highX, highY, z1, /*Bottom Face*/ x1, y1, z1, x1, y1, highZ, highX, y1, highZ, highX, y1, z1, /*Top Face*/ x1, highY, z1, x1, highY, highZ, highX, highY, highZ, highX, highY, z1}; for (float f : cubeData) { cubeList.add(f); } } } } cubeFloat = compileFloat(cubeList); for (int i = 0; i &lt; (width * height * depth); i++) { float[] textureData = new float[]{ 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1}; for (Float f : textureData) { textureList.add(f); } } textureFloat = compileFloat(textureList); textureBuffer = asFloatBuffer(textureFloat); glBindBuffer(GL_ARRAY_BUFFER, texture); glBufferData(GL_ARRAY_BUFFER, textureBuffer, GL_DYNAMIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); cubeBuffer = asFloatBu…
favorite count: 0
has comment: http://stackoverflow.com/comment/31534213
type: Question
has title: Multiple Cubes in one VBO
has comment: http://stackoverflow.com/comment/31534885
accepted answer: http://stackoverflow.com/a/20986883
has comment: http://stackoverflow.com/comment/31534288
tagged with: opengl
tagged with: java
tagged with: lwjgl
upvote count: 1
linked to: http://stackoverflow.com/q/20979673
has comment: http://stackoverflow.com/comment/31534918
answer count: 1
has answer: http://stackoverflow.com/a/20986883

http://stackoverflow.com/q/21015278
tagged with: spring
tagged with: properties
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21015489
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/51132584
upvote count: 29
favorite count: 0
has answer: http://stackoverflow.com/a/21015489
has title: Override properties from external property file if exists using Spring
has body: I have the following property file defined in one of my Spring configuration file: &lt;context:property-placeholder location="classpath:project.properties"/&gt; Now I want to override few properties from some external property file that is not in the classpath. Let's say I have my project deployed somewhere and I need to some dynamic configuration change. I do not want to make updates to the project codebase in the container(tomcat or any thing). 1.) So I need a way that updates (overrides) the values of spring's loaded properties file with my recent updates in the external property file. 2.) It would be great if somebody could also share the way to refresh the properties that are preloaded.
downvote count: 0
possible better answer: http://stackoverflow.com/a/51132584
score: 29

http://stackoverflow.com/a/20948624
has comment: http://stackoverflow.com/comment/45059457
has body: Default maximum number of websocket connections allowed in FireFox is 200. Source: https://developer.mozilla.org/en/docs/WebSockets#Gecko_7.0 From the comment given in line #48 of http://src.chromium.org/viewvc/chrome/trunk/src/net/socket/client_socket_pool_manager.cc?r1=128044&amp;r2=128043&amp;pathrev=128044 seems to talk of dynamic numbers with minimum of 6 for normal socket pool and 30 for websocket pool. More Info: https://groups.google.com/a/chromium.org/forum/#!topic/chromium-reviews/4sHNK-Eotn0
type: Answer
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/20945080
score: 0

http://stackoverflow.com/comment/31443868
score: 0
type: Comment
type: QuestionComment
has text: no I will try it and post result
comment on: http://stackoverflow.com/q/20938086

http://stackoverflow.com/q/20913190
accepted answer: http://stackoverflow.com/a/20914288
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31396200
upvote count: 1
has comment: http://stackoverflow.com/comment/71361741
has body: I am stuck with this very strange problem. In the client I am passing in objects like try{ oos.writeObject(new GameStartSerializedObject()); oos.flush(); } catch(Exception e){ e.printStackTrace(); } and in the server I am reading the object try{ //Its my turn thrown_message = player_reader.readObject(); } catch(Exception e){ My question is why am i getting EOF exception. My understanding of object input stream is when i call readObject() i should block until i get an object so how does it know if the eof is reached? Please help! This is how I create object streams ois = new ObjectInputStream(socket.getInputStream()); oos = new ObjectOutputStream(socket.getOutputStream()); oos.flush(); Also, after i write object and flush should i close the stream. I am not closing it since the objects are written pretty regularly from different parts of the code one after another.
tagged with: objectinputstream
type: Question
has title: Why is ObjectInputStream readObject() throwing EOF exception
linked to: http://stackoverflow.com/q/664331
has comment: http://stackoverflow.com/comment/31396311
downvote count: 0
answer count: 1
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31396122
has answer: http://stackoverflow.com/a/20914288
tagged with: sockets

http://stackoverflow.com/a/20931518
answers question: http://stackoverflow.com/q/20928479
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20928479
upvote count: 1
type: Answer
has body: That is misinterpretation of items in result list. Size of the list is not affected by number of selections (max, min, avg, count). In this case expected size of the list is 1 because it is simple select with aggregate functions and without grouping. Sole item in list is object array that contains in selections order all four selected values. Result can be explorer with following: List results = crit.list(); for (Object item: results) { Object[] itemArr = (Object[]) item; System.out.println("max: "+ itemArr[0].getClass() +" " + itemArr[0]); System.out.println("min: "+ itemArr[1].getClass() +" " + itemArr[1]); System.out.println("avg: "+ itemArr[2].getClass() +" " + itemArr[2]); System.out.println("count: "+ itemArr[3].getClass() +" " + itemArr[3]); } Values from array can be assigned then when their type is understood. For example if type of hostsCount is Integer, following can be used: Integer max = (Integer) itemArr[0]; Because it is known that query does not return multiple rows, instead of Criteria.list we can use: Object[] itemArr = (Object[]) crit.uniqueResult();
downvote count: 0
score: 1

http://stackoverflow.com/comment/31306933
comment on: http://stackoverflow.com/q/20854965
has text: Yes, my resource class is an EJB
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/20888512
score: 0
answers question: http://stackoverflow.com/q/20887961
type: Answer
has comment: http://stackoverflow.com/comment/31349875
has comment: http://stackoverflow.com/comment/31349485
has body: It should work normally, since you dont have any statement that could stop the while execution, or a break; command. However, I would advice you to use JDK(java developer kit) instead of JRE.
has comment: http://stackoverflow.com/comment/31438065

http://stackoverflow.com/q/20918498
answer count: 3
has comment: http://stackoverflow.com/comment/31405615
tagged with: parseint
has comment: http://stackoverflow.com/comment/31405608
has title: Casting a String Array to ArrayList<Integer>
has body: I am trying to import a web file containing a numbers that correspond to vertices for a graph. The first line states how many vertices there are. So i defined an int verticesAmount to correspond to how many vertices there are. After that I started a for loop to see catch the input of each line in the file and then put each number in an array by splitting them using the .split(" ") method. Everything up to this point compiles fine and when I print out the array I just made it prints out fine. However, when I try to cast each element of the array to an INT i get a compiler error and I cannot figure out why. Any help would be appreciated. Thank You. import java.util.Scanner; import java.io.*; import java.util.ArrayList; public class Graph { public static void main(String[] args)throws Exception{ ArrayList&lt;ArrayList&lt;Integer&gt;&gt; array; Scanner input2 = new Scanner(System.in); System.out.println("Enter a URL"); String urlString = input2.next(); java.net.URL url = new java.net.URL(urlString); Scanner input = new Scanner(url.openStream()); String verticesAmount = input.next(); int amount = Integer.parseInt(verticesAmount); String[] stringArray = new String[10]; ArrayList&lt;Integer&gt; row = new ArrayList&lt;Integer&gt;(); String line; for(int i = 0; i &lt; amount; i++){ line = input.nextLine(); stringArray = line.split(" "); for(int j = 0; j &lt; stringArray.length; j++) row.add(Integer.parseInt(stringArray[j]));
has answer: http://stackoverflow.com/a/20918555
favorite count: 0
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/20918699
has comment: http://stackoverflow.com/comment/31405625
tagged with: java
has answer: http://stackoverflow.com/a/20918556
type: Question
has comment: http://stackoverflow.com/comment/31405581
upvote count: 0
score: -2
tagged with: arraylist

http://stackoverflow.com/a/20956725
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20956385
has comment: http://stackoverflow.com/comment/31480652
score: 8
accepted answer of: http://stackoverflow.com/q/20956385
type: Answer
has comment: http://stackoverflow.com/comment/31479285
has comment: http://stackoverflow.com/comment/31481959
downvote count: 0
has comment: http://stackoverflow.com/comment/31480587
has body: Jackson's ObjectMapper creates a new JsonGenerator on each request for serialization. In that sense, it is guaranteed to be thread safe. The only thing that I can see that might cause the behavior you are seeing is if your CustomSerializer has some instance fields that it is sharing and is doing some kind of internal synchronization.
upvote count: 8
has comment: http://stackoverflow.com/comment/31478187
has comment: http://stackoverflow.com/comment/31482071

http://stackoverflow.com/q/20882189
type: UnansweredQuestion
has title: jsf composite -> ajax listener throws Exception
tagged with: jsf
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31360851
type: Question
has body: Mojarra: 2.1.26 Description: I have very simple composite component hello.xhtml: &lt;composite:interface&gt; &lt;composite:attribute name="value" /&gt; &lt;composite:attribute name="changeListener" method-signature="void listener(javax.faces.event.AjaxBehaviorEvent)" /&gt; &lt;/composite:interface&gt; &lt;composite:implementation&gt; &lt;h:inputText id="inputNameId" value="#{cc.attrs.value}"&gt; &lt;f:ajax execute="@this" event="change" listener="#{cc.attrs.changeListener}"/&gt; &lt;/h:inputText&gt; &lt;/composite:implementation&gt; As you see implementation is very simple. The main key here is ajax support for event change. omposite component is used like that: &lt;h:form id="formId"&gt; &lt;hla:hello id="compositeId" value="#{helloController.name}" changeListener="#{helloController.nameChangedListener}"&gt; &lt;/hla:hello&gt; &lt;/h:form&gt; As you see attrbiute changeListener is used. I just want to have listener called. In composite component method-signature is provided. Let's look at backing bean, which is very simple: @ManagedBean @ViewScoped public class HelloController implements Serializable{ private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } public void nameChangedListener(AjaxBehaviorEvent event){ System.out.println("-nameChangedListener-"); System.out.println("\tphase: " + event.getPhaseId()); } } Listener method doesn't do anything special, just to keep this simple. Problem: When I try to run this code I always get Exception: java.lang.ArrayIndexOutOfBoundException: 0 ... If I change method-signature in my composite component to: &lt;composite:attribute name="changeListener" method-signature="void listener()" /&gt; and method in backing bean to: public void nameChangedListener(){ ... } everything works fine. Question: Is there any chance to make it work with AjaxBehaviorEvent as a listener method parameter? How to do that?
tagged with: jsf-2
score: 0
has comment: http://stackoverflow.com/comment/31369532
tagged with: ajax

http://stackoverflow.com/comment/31400296
has text: None of the actual encryption logic is written in Java but rather one form or another of a "native method", and hence the encryption code is not inherently portable between disparate platforms. Further, encryption code cannot be "exported" without a license, so likely the Oracle code always invokes OS services for encryption. If the OS doesn't have the service then it's not going to be available.
score: 0
comment on: http://stackoverflow.com/q/20915276
type: Comment
type: QuestionComment

http://stackoverflow.com/a/67449256
score: 1
answers question: http://stackoverflow.com/q/20862558
upvote count: 1
has body: Unfortunately, none of the existing answers has mentioned the root cause of the problem which is as follows: You have used D (which specifies Day in year) instead of d (Day in month). You have used Y (which specifies Week year) instead of y (Year). Learn more about it at the documentation page. Now that you have understood the root cause of the problem, let's focus on the solution using the best standard API of the time. java.time The legacy date-time API (java.util date-time types and their formatting API, SimpleDateFormat) is outdated and error-prone. It is recommended to stop using it completely and switch to java.time, the modern date-time API*. I would solve it in the following steps: Parse the date string into LocalDate. Parse the time string into LocalTime. Combine the objects of LocalDate and LocalTime to obtain an object of LocalDateTime. Format the object of LocalDateTime into the desired pattern. Demo using the modern API: import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.time.format.DateTimeFormatter; import java.util.Locale; public class Main { public static void main(String[] args) { // 1. Parse the date string into `LocalDate`. DateTimeFormatter dateParser = DateTimeFormatter.ofPattern("M/d/u", Locale.ENGLISH); LocalDate date = LocalDate.parse("01/01/2014", dateParser); // 2. Parse the time string into `LocalTime`. DateTimeFormatter timeParser = DateTimeFormatter.ofPattern("HHmm", Locale.ENGLISH); LocalTime time = LocalTime.parse("1615", timeParser); // 3. Combine date and time to obtain an object of `LocalDateTime`. LocalDateTime ldt = date.atTime(time); // 4. Format the object of `LocalDateTime` into the desired pattern. DateTimeFormatter dtfOutput = DateTimeFormatter.ofPattern("MMMM d, uuuu HH:mm", Locale.ENGLISH); String output = dtfOutput.format(ldt); System.out.println(output); } } Output: January 1, 2014 16:15 Learn more about the the modern date-time API* from Trail: Date Time. * For any reason…
type: Answer
downvote count: 0

http://stackoverflow.com/q/20962960
has comment: http://stackoverflow.com/comment/31490617
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/44990046
tagged with: c++
tagged with: java
type: Question
score: 5
has comment: http://stackoverflow.com/comment/31490586
has comment: http://stackoverflow.com/comment/45929406
upvote count: 5
tagged with: java-native-interface
has body: I have a native function (from a library) that does some work on uint8_t types (unsigned 8-bit number 0-255). The closest thing Java has is byte which must be signed. How can I convert this byte into a proper positive integer to use in Java? I know I'll have to store it in a short or int in order to properly represent numbers from 0-255, but I don't know how to convert the byte. I tried int intValue = byteValue &amp; 0xFF;, but that is giving me unexpected results, so I suspect it's incorrect. Or that is correct and I am misunderstanding the expected results from the native library function. Would appreciate confirmation either way.
has title: Convert native uint8_t (Java byte) into an int

http://stackoverflow.com/comment/31495386
score: 0
has text: Have a look at [**this answer**](http://stackoverflow.com/questions/10929438/create-jar-with-custom-manifest-with-multiple-libraries-in-classpath) and [**this answer**](http://stackoverflow.com/questions/219585/setting-multiple-jars-in-java-classpath) and [**Working with Manifests**](http://docs.oracle.com/javase/tutorial/deployment/jar/manifestindex.html) from the Oracle tutorial
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20965106

http://stackoverflow.com/a/20953848
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20953769
downvote count: 0
has comment: http://stackoverflow.com/comment/31473098
has body: "I have to make a constructor of an array in which each digit of a big number will be a different char of this array." You can just do n = _number.toCharArray(); which returns a character array of the String private char[] n = null; public BigNumber(String _number){ n = _number.toCharArray(); } If you want to print the BigNumber object as a String, you need to @Override the toString() method in the BigNumber class public class BigNumber { .... @Override public String toString(){ return Arrays.toString(n); } } The way you're currently printing won't print the array as you would expect. You need to override the toString() method to output the object as a String representation with your desired output format. My simple example just prints out the array as a String, though you can choose to format it any way you like. But keep in mind the method must return a String Then you can do this BigNumber bn2 = new BigNumber("987349837937497938943242"); System.out.println("line 1: " + bn2); Also NOTE : You cannot do this BigNumber bn1 = new BigNumber(1500); as the BigNumber constructor only take a String argument, where 1500 is an int. You could do this BigNumber bn1 = new BigNumber(String.valueOf(1500)); UPDATE If you wanted to accept an int as an argument to the constructor, you would need to create a separate constructor that takes an int argument. In which case you would also need to make the int a String, then get the character array. So you would have two constructors, one that takes a String and one that takes an int public BigNumber(int number){ String numString = String.valueOf(number); n = number.toCharArray(); }
type: Answer
has comment: http://stackoverflow.com/comment/31473017

http://stackoverflow.com/comment/31448112
comment on: http://stackoverflow.com/a/20940396
type: Comment
has text: I noticed you edited your OP. Is that the code as it stands now? Because I don't see maxq1 being printed anywhere now.
score: 0
type: AnswerComment

http://stackoverflow.com/q/20950748
has answer: http://stackoverflow.com/a/20951216
has answer: http://stackoverflow.com/a/45150301
has answer: http://stackoverflow.com/a/72485172
has comment: http://stackoverflow.com/comment/31478369
has answer: http://stackoverflow.com/a/42090115
has answer: http://stackoverflow.com/a/23910165
tagged with: selenium-grid
upvote count: 34
favorite count: 0
has answer: http://stackoverflow.com/a/43332947
answer count: 19
has title: Cannot find firefox binary in PATH. Make sure firefox is installed
has answer: http://stackoverflow.com/a/43798257
downvote count: 1
has answer: http://stackoverflow.com/a/28955288
has answer: http://stackoverflow.com/a/67839478
has answer: http://stackoverflow.com/a/58932365
linked to: http://stackoverflow.com/q/14723081
type: UnansweredQuestion
has body: In Selenium Grid I am trying to execute a simple program and I'm getting Cannot find firefox binary in PATH though I have added the binary path in my code. My code and the error are given below. Code package Sample; import java.net.MalformedURLException; import java.net.URL; import org.openqa.selenium.Platform; import org.openqa.selenium.WebDriver; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteWebDriver; import org.testng.annotations.Test; import org.testng.annotations.BeforeTest; import org.testng.annotations.AfterTest; public class sample1 { WebDriver driver; String BaseURL,NodeURL; @BeforeTest public void beforeTest() throws MalformedURLException { BaseURL="www.google.com"; NodeURL="http://192.168.10.162:5566/wd/hub"; DesiredCapabilities capa =DesiredCapabilities.firefox(); capa.setBrowserName("firefox"); capa.setCapability("binary", "C:\\Users\\praveenraj.d\\AppData\\Local\\Mozilla Firefox\\firefox.exe"); capa.setPlatform(Platform.ANY); driver=new RemoteWebDriver(new URL(NodeURL),capa); } @Test public void f() throws InterruptedException { driver.get(BaseURL); System.out.println(driver.getTitle()); Thread.sleep(50000); } @AfterTest public void afterTest() { driver.quit(); } } Error [TestNG] Running: C:\Users\praveenraj.d\AppData\Local\Temp\testng-eclipse-1233453386\testng-customsuite.xml FAILED CONFIGURATION: @BeforeTest beforeTest org.openqa.selenium.WebDriverException: Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: WIN8 Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:11:15' System info: host: 'IN-IF-WS1-0154', ip: '192.168.10.162', os.name: 'Windows 8', os.arch: 'amd64', os.version: '6.2', java.version: '1.7.0_07' Driver info: driver.version: FirefoxDriver Command duration or timeout: 97 milliseconds Build info: version: '2.31.0', revision: '1bd294d', time: '2013-02-27 20:53:56' System info: os.name: 'Windows 8', os.arch: 'x86', os.version: '6.2', j…
has answer: http://stackoverflow.com/a/36936477
tagged with: selenium
has answer: http://stackoverflow.com/a/21058942
has answer: http://stackoverflow.com/a/70609976
tagged with: selenium-webdriver
has answer: http://stackoverflow.com/a/68812608
has comment: http://stackoverflow.com/comment/51723581
has answer: http://stackoverflow.com/a/38464797
tagged with: java
has answer: http://stackoverflow.com/a/37655607
score: 33
has answer: http://stackoverflow.com/a/38800442
type: Question
has answer: http://stackoverflow.com/a/24891650
has answer: http://stackoverflow.com/a/47771939

http://stackoverflow.com/q/20856825
has answer: http://stackoverflow.com/a/20892846
tagged with: configuration
accepted answer: http://stackoverflow.com/a/20892846
tagged with: java
type: Question
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31311143
has body: I am stuck with null values in an autowired property. I am hoping I could get some help. We are using for the project spring-boot version 0.5.0.M6. The four configuration files with beans are in one package and are sorted by "area": Data source configuration Global method security configuration (as we use Spring-ACL) MVC configuration Spring Security configuration The main method that bootstraps everything is in the following file: @EnableAspectJAutoProxy @EnableSpringConfigured @EnableAutoConfiguration(exclude = { DataSourceTransactionManagerAutoConfiguration.class, HibernateJpaAutoConfiguration.class, JpaRepositoriesAutoConfiguration.class, SecurityAutoConfiguration.class, ThymeleafAutoConfiguration.class, ErrorMvcAutoConfiguration.class, MessageSourceAutoConfiguration.class, WebSocketAutoConfiguration.class }) @Configuration @ComponentScan public class IntegrationsImcApplication { public static void main(String[] args) throws Exception { ApplicationContext ctx = SpringApplication.run( IntegrationsImcApplication.c lass, args); } } The first file that holds the data source configuration beans is as follows (I have omitted some method body parts to make it more readable): @EnableTransactionManagement(mode = AdviceMode.ASPECTJ) @Configuration public class RootDataSourceConfig extends TomcatDataSourceConfiguration implements TransactionManagementConfigurer { @Override public DataSource dataSource() { return jpaDataSource(); } public PlatformTransactionManager annotationDrivenTransactionManager() { return jpaTransactionManager(); } @Bean public HibernateExceptionTranslator hibernateExceptionTranslator() { return new HibernateExceptionTranslator(); } @Bean(name="jpaDataSource") public DataSource jpaDataSource() {......} @Bean(name = {"transactionManager","txMgr"}) public JpaTransactionManager jpaTransactionManager() {......} @Bean(name = "entityManagerFactory") public EntityManagerFactory jpaEmf() {......} } And here is the next configuration file, that depends on the d…
favorite count: 0
has comment: http://stackoverflow.com/comment/31328051
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/31290871
possible better answer: http://stackoverflow.com/a/20877208
has comment: http://stackoverflow.com/comment/31290791
has comment: http://stackoverflow.com/comment/31313176
has comment: http://stackoverflow.com/comment/31293015
upvote count: 2
has answer: http://stackoverflow.com/a/20877208
has title: Autowired property is null - Spring Boot Configuration
tagged with: autowired
score: 2
has comment: http://stackoverflow.com/comment/31312545
type: AnsweredQuestion
tagged with: spring-boot

ksoap2
type: Tag
tags question: http://stackoverflow.com/q/20991576
tags question: http://stackoverflow.com/q/20900100
tags question: http://stackoverflow.com/q/21003696
tag name: ksoap2

http://stackoverflow.com/comment/31431380
has text: the problem still remains I think. What I need to happen is, I need to insert the cipherText and key into the map at the SAME time. The as in, cipherKeyPairs.put(cipherText, key); Thanks for the continued support, means a TON
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20931939

http://stackoverflow.com/comment/31288199
type: Comment
comment on: http://stackoverflow.com/a/20856235
type: AnswerComment
has text: Three files are there. Which one is correct(December...)
score: 0

http://stackoverflow.com/q/20913252
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31397031
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
type: Question
has comment: http://stackoverflow.com/comment/31396637
has comment: http://stackoverflow.com/comment/31396845
answer count: 1
has answer: http://stackoverflow.com/a/20913665
score: 0
has title: GSON JSON Mapping
has body: Please I need help about to pull my hair out. Using GSON to read JSON input returned from my PHP web service. simplified (test) JSON looks like: {"Posts":[{"post":{"Areaid":"1"}},{"post":{"Areaid":"2"}}]} Code look like this: public void viewAreas() throws Exception { List&lt;Map&lt;String, Area&gt;&gt; map=viewAreaResponseToMap("{\"Posts\":[{\"post\":{\"Areaid\":\"1\"}},{\"post\":{\"Areaid\":\"2\"}}]}"); for (Map&lt;String, Area&gt; map1 : map) { for (Map.Entry&lt;String, Area&gt; entry : map1.entrySet()) { String string = entry.getKey(); System.out.println(string); Area list = entry.getValue(); System.out.println(list.Areaid); } } } private List&lt;Map&lt;String, Area&gt;&gt; viewAreaResponseToMap(String response) throws Exception { List&lt;Map&lt;String, Area&gt;&gt; map = new Gson().fromJson(response, new TypeToken&lt;List&lt;Map&lt;String, Area&gt;&gt;&gt;() { }.getType()); return map; } with the Area class like: public class Area { public String Areaid; } However when I call viewAreas() I get: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 I have tried many different ways i.e Map&lt;String,List&lt;Area&gt;&gt;, List&lt;Map&lt;String,List&lt;Area&gt;&gt;&gt; but I just cant seem to map the JSON response correctly. Any help or advice?
accepted answer: http://stackoverflow.com/a/20913665

http://stackoverflow.com/q/20971381
has comment: http://stackoverflow.com/comment/31505516
answer count: 3
has answer: http://stackoverflow.com/a/20971870
has comment: http://stackoverflow.com/comment/31505385
possible better answer: http://stackoverflow.com/a/20971870
accepted answer: http://stackoverflow.com/a/20971435
has comment: http://stackoverflow.com/comment/31505431
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31505350
tagged with: java
has title: How to get word (String) only?
has comment: http://stackoverflow.com/comment/31505517
score: -1
has comment: http://stackoverflow.com/comment/31505378
type: Question
has answer: http://stackoverflow.com/a/20971491
upvote count: 0
has answer: http://stackoverflow.com/a/20971435
tagged with: string
favorite count: 0
has body: I am creating a chat application that will filter bad word for example, ass. So, if use type "your face look like ass", the result will be "your face look like ". the code is String msg = e.getMessages(); if(msg.contains("ass")) { String aaa = msg.replace("ass", ""); //my code here to show msg } So, if user type a word that contains ass, for example glass, my code will remove the ass and become gl only. So, I want to know how to detect word by word and remove bad words in my list?

http://stackoverflow.com/comment/31476920
has text: readLine always only reads strings. If you want to use it for numeric input, you'll need to `Parse` the values out of the strings. Otherwise, I think `Scanner` is what the cool kids are using to read console input these days. The cool kids who use it almost always forget that they have to scan for the carriage returns too.
type: QuestionComment
comment on: http://stackoverflow.com/q/20956185
type: Comment
score: 0

http://stackoverflow.com/comment/31537552
has text: it is the same as the code above. I used jdbcTempalte.
comment on: http://stackoverflow.com/q/20988152
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/32660390
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: There are some required steps, that you have to do before using @PreAuthorize annotation with your Java Config: In your main security config you have to specify annotation for enabling global method security: @Configuration @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) Mark a method you want to protect using @PreAuthorize annotation (by the way, @Override should give you a thought about programming in interfaces): @Service (value = "defaultSecuredService") public class DefaultSecuredService implements SecuredService { @Override @PreAuthorize("hasRole('ROLE_ADMIN')") public String findSimpleString() { return "simple string"; } } Make sure that your bean is added to Spring context and is instanciated using INTERFACE: @Controller public class IndexController { @Autowired private SecuredService defaultSecuredService; @RequestMapping (value = "/index", method = RequestMethod.GET) public ModelAndView getIndexPage() { ModelAndView modelAndView = new ModelAndView(); modelAndView.setViewName("index"); modelAndView.addObject("simpleString", defaultSecuredService.findSimpleString()); return modelAndView; } }
answers question: http://stackoverflow.com/q/20906865

http://stackoverflow.com/q/20911853
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/20911964
answer count: 1
favorite count: 0
tagged with: netbeans
has comment: http://stackoverflow.com/comment/31393289
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/31393274
has body: The title is a bit confusing so I'll try to explain more in here. I'm quite new to computer programming and have been using Netbeans for my Java programming (stop laughing) and have found out that in order to execute a statement, an event has to be fired off (such as clicking a button) but how would I make it so that when the program starts, it creates an event that I could set to fire off statements/code. Any help is much appreciated! Edit: I don't have any code to show, but I can put it in pseudocode. when &lt;Program starts&gt; do &lt;lblMessage.setText("Hello World"); Instead of when &lt;button clicked&gt; do &lt;lblMessage.setText("Hello World");
has comment: http://stackoverflow.com/comment/31393423
score: 1
tagged with: java
has title: Execute statement/code when program runs

http://stackoverflow.com/comment/31536435
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20979178
has text: @user3170281 Your welcome. If it helped you solve your problem, then you should accept the answer to help others with the same problem find the answer.
score: 0

http://stackoverflow.com/q/20914728
has title: Editing a variable in one class doesn't seem to change it in another
has answer: http://stackoverflow.com/a/20914748
answer count: 1
downvote count: 0
tagged with: variables
favorite count: 0
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/20914748
has body: Its obviously a really simple issue. However, I can't fix it. I'm making a simple code game in which you have five buttons across the middle that correspond with the numbers 1 through 5. The goal is to answer a question given at the top with numbers. If you pass the given max number for how many times you can guess at a question, I want to change the number of lives you have on the screen. I have 3 classes. my main method containing class : public class LevelChanger { protected static int buttoncount = 0; protected static int buttonlimit = 20; protected static int answer = 12; protected static int level = 1; protected static int lives = 10; protected static String Hint = ""; protected static String Question = "default text"; public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { CodeGui frame = new CodeGui(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); checkbuttonlimitAndAnswer(); } protected static void checkbuttonlimitAndAnswer() { if (buttoncount &gt; buttonlimit) { lives--; buttoncount = 0; } } } action listener class public class ActionListeners implements ActionListener { public void actionPerformed(ActionEvent B) { CodeGui Gui = new CodeGui(); if (Gui.num1.getName().equals(((Component) B.getSource()).getName())) { LevelChanger.buttoncount++; } if (Gui.num2.getName().equals(((Component) B.getSource()).getName())) { LevelChanger.buttoncount += 2; } if (Gui.num3.getName().equals(((Component) B.getSource()).getName())) { LevelChanger.buttoncount += 3; } if (Gui.num4.getName().equals(((Component) B.getSource()).getName())) { LevelChanger.buttoncount += 4; } if (Gui.num5.getName().equals(((Component) B.getSource()).getName())) { LevelChanger.buttoncount += 5; System.out.println(LevelChanger.buttoncount); } } } finally the gui class : public class CodeGui extends JFrame { private static final long serialVersionUID = 1L; ActionListeners Al = new ActionListeners(); protected JPanel co…

http://stackoverflow.com/comment/31304402
comment on: http://stackoverflow.com/q/20864626
type: Comment
type: QuestionComment
has text: What are you trying to achieve by `if (divisor == 20) {success = true; }` block?
score: 0

http://stackoverflow.com/a/20989038
upvote count: 0
type: AcceptedAnswer
has body: Thanks everyone for devoting your time and providing help to me. Problem is solved. Issue was with my code. The bean name in SimpleBean.java is argument rather than argumentBean. I was referring to the variable name, but should go with getter name except 'get' suffix(with first letter smallcase of course). I changed the config to below: &lt; property name="argument" ref="argumentBean" /> and it solved the problem.
accepted answer of: http://stackoverflow.com/q/20971850
type: Answer
downvote count: 1
score: -1
answers question: http://stackoverflow.com/q/20971850

http://stackoverflow.com/comment/31449868
comment on: http://stackoverflow.com/q/20941445
has text: What is your question?
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/31513348
comment on: http://stackoverflow.com/q/20975592
type: Comment
type: QuestionComment
has text: @Christian The whole thing is the `psw` class.
score: 1

http://stackoverflow.com/a/21030105
has body: I use GridBagLyout quite a lot, but like many others before me, I quickly found out it can be quite verbose. There are many examples on the web of how users wrote utility methods and/or classes to help them generate GBL code. I'll show you what I do. 1) First, I created 2 enums that are wrappers for the anchor and fill GridBagConstraints fields. I prefer the type checking of enums vs. ints, and it also allows me to write more concise code (as you'll see later). And yes, I still use the older "directional" values for Anchor. I could never quite get used to the preferred values of PAGE_START and the like. Use whatever you prefer. Anchor.java: package gbl; import java.awt.*; /** * Convenience enum that aliases out all possible values for the * GridBagConstraints anchor property. */ public enum Anchor { NORTH(GridBagConstraints.NORTH), SOUTH(GridBagConstraints.SOUTH), EAST(GridBagConstraints.EAST), WEST(GridBagConstraints.WEST), NORTHEAST(GridBagConstraints.NORTHEAST), NORTHWEST(GridBagConstraints.NORTHWEST), SOUTHEAST(GridBagConstraints.SOUTHEAST), SOUTHWEST(GridBagConstraints.SOUTHWEST), CENTER(GridBagConstraints.CENTER); private int constraint; private Anchor(int gbConstraint) { constraint = gbConstraint; } public int getConstraint() { return constraint; } } Fill.java: package gbl; import java.awt.*; /** * Convenience enum that aliases out all possible values for the * GridBagConstraints fill property. */ public enum Fill { NONE(GridBagConstraints.NONE), HORIZONTAL(GridBagConstraints.HORIZONTAL), VERTICAL(GridBagConstraints.VERTICAL), BOTH(GridBagConstraints.BOTH); private int constraint; private Fill(int gbConstraint) { constraint = gbConstraint; } public int getConstraint() { return constraint; } } 2) Then, I created a subclass of GridBagConstraints that allowed me "chain" the properties only as I need them, while utilizing common defaults: GBConstraints.java: package gbl; import java.awt.*; /** * Convenience class to simplify the creation of a GridBagConstraints o…
score: 4
has comment: http://stackoverflow.com/comment/32096688
has comment: http://stackoverflow.com/comment/31616923
has comment: http://stackoverflow.com/comment/32092612
has comment: http://stackoverflow.com/comment/31616980
has comment: http://stackoverflow.com/comment/32094525
accepted answer of: http://stackoverflow.com/q/21010799
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31617354
answers question: http://stackoverflow.com/q/21010799
has comment: http://stackoverflow.com/comment/31617145
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/31617043
downvote count: 0

http://stackoverflow.com/q/20932537
tagged with: excel
has title: Setting a part of the cell contents to Underline using Apache POI?
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/55358293
linked to: http://stackoverflow.com/q/20627043
has body: I am working on a program in which I have to set cell value in an Excel spreadsheet like "This is an Underlined text". It can be anything Bold, Italic, or Underline. I am using Apache POI 3.9
type: Question
has answer: http://stackoverflow.com/a/20932849
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31433304
favorite count: 0
score: 8
accepted answer: http://stackoverflow.com/a/20932849
tagged with: apache-poi
upvote count: 8
has comment: http://stackoverflow.com/comment/31432534

http://stackoverflow.com/comment/31552484
score: 0
comment on: http://stackoverflow.com/q/20994099
has text: I just added some additional information that may help clarify my problem. I'm afraid I may have caused confusion by listing only the root logger and the non-working logger, sorry.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31537491
comment on: http://stackoverflow.com/a/20988047
type: Comment
score: 0
type: AnswerComment
has text: If you are using `maven` build plug-in you can skip test by `mvn clean install -Dmaven.test.skip=true`

http://stackoverflow.com/comment/31586467
score: 2
has text: No i just need to put all data in to hashmap. not a list of hashmap in a single hashmap
type: AnswerComment
comment on: http://stackoverflow.com/a/21014552
type: Comment

http://stackoverflow.com/q/20956406
possible better answer: http://stackoverflow.com/a/20956499
has comment: http://stackoverflow.com/comment/31477285
linked to: http://stackoverflow.com/q/1732348
downvote count: 0
has answer: http://stackoverflow.com/a/20956479
tagged with: string
has comment: http://stackoverflow.com/comment/31477301
favorite count: 0
has comment: http://stackoverflow.com/comment/31477693
has body: I am trying to create a method to find and return the first tag in a given HTML string, and returns null if no such tag is found. (A tag would be something like ) I looked through the String class methods but I can't find a method that can suit this purpose. I'm thinking my plan is to scan each word for a "<" then once it is found, scan for a ">", but am unsure of how to do so. Also wondering if I should put a while/for loop in there? Help is appreciated, thank you. public class HTMLProcessor { public static void main(String[] args) { System.out.println(findFirstTag("The man jumped.")); } public static String findFirstTag(String text) { int firstIndex = text.indexOf("<"); if (firstIndex >= 0) { String newText = text.substring(firstIndex); int secondIndex = newText.indexOf(">"); return text.substring(firstIndex, secondIndex + 1); } else { return null; } }
answer count: 3
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/20956509
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31478030
has comment: http://stackoverflow.com/comment/31477438
upvote count: 3
has comment: http://stackoverflow.com/comment/31477812
has title: HTML tag finder
has answer: http://stackoverflow.com/a/20956499
type: Question
score: 3
accepted answer: http://stackoverflow.com/a/20956509
tagged with: java

http://stackoverflow.com/a/20913803
type: Answer
upvote count: 5
answers question: http://stackoverflow.com/q/20913773
accepted answer of: http://stackoverflow.com/q/20913773
downvote count: 0
has body: The JIT compiler will figure out the fastest operation and use that. Use whatever makes the most sense to read. Don't optimize prematurely. For interest's sake: If this were being compiled without optimizations, then the boolean operator would be faster. It's a simple mathematical operation, which takes just one CPU cycle (plus another for the ! operator), whereas the ternary expression would require a branch, which interrupts the pipeline if branch prediction guesses wrong.
has comment: http://stackoverflow.com/comment/31402659
score: 5
has comment: http://stackoverflow.com/comment/31402012
type: AcceptedAnswer

http://stackoverflow.com/a/20982296
accepted answer of: http://stackoverflow.com/q/20977159
has comment: http://stackoverflow.com/comment/31556988
has comment: http://stackoverflow.com/comment/31543194
has body: I would recommend doing this with css. button.setSyleName("add") Then in css button.add { background: url(images/add.png) no-repeat center center fixed; border: none; } You would need to put the add.png in your public directory in /images/add.png The other option is that you can use a CssResource and a sprite to add the background image to your button.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20977159
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/31579640
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21011123
type: Comment
has text: I suggest you to use `Dependence Injection`, as it is good for a better program structure

http://stackoverflow.com/comment/31431755
score: 2
type: AnswerComment
has text: You don't "call" variables. The OP is setting the variable's value but never *using* it.
comment on: http://stackoverflow.com/a/20932254
type: Comment

http://stackoverflow.com/comment/54155393
score: 9
has text: One exception to this rule is that a local variable initialized with a constant is not a constant expression to the compiler. You cannot use such a variable for a case in a switch/case until you explicitly add the final keyword. E.g. "int k = 1; switch(someInt) { case k: ...".
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20940888

http://stackoverflow.com/a/20922658
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20922568
accepted answer of: http://stackoverflow.com/q/20922568
has body: It's because you're calling setOnMarkerClickListener() on the SAME gMap object multiple times. In this way it's not strange that the last call will take effect, and the last shop's info will be used. You should set OnMarkerClickListener only once. Of course, then you have to identify your markers in its onMarkerClick() method to decide which shop was clicked.
type: Answer
has comment: http://stackoverflow.com/comment/31413516
has comment: http://stackoverflow.com/comment/31413255
downvote count: 0
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/31413308

http://stackoverflow.com/comment/31441885
score: 0
comment on: http://stackoverflow.com/q/20935122
type: Comment
has text: please let me know if you try my solution, or if you need other further help!
type: QuestionComment

http://stackoverflow.com/q/20961596
answer count: 2
score: 3
downvote count: 0
favorite count: 0
has body: In fear of reinventing the wheel, I wonder: What is the best approach to implement a smooth grid based game character movement on a top-down Tiled (2D) map with libGDX? The character should keep moving smoothly between tiles as long as an arrow key is pressed (or a touch event occures on certain direction of the character) and should finish confined to a grid position on key / touch release. The movement should be independent from the frame rate. I would be glad about some already implemented examples that can be studied and lead to a proper libGDX API usage.
has comment: http://stackoverflow.com/comment/114721918
tagged with: android
tagged with: windows
possible better answer: http://stackoverflow.com/a/20966570
has title: libGDX: How to implement a smooth tile / grid based game character movement?
has answer: http://stackoverflow.com/a/20961911
has answer: http://stackoverflow.com/a/20966570
type: AnsweredQuestion
upvote count: 3
tagged with: java
type: Question
tagged with: libgdx
accepted answer: http://stackoverflow.com/a/20961911
tagged with: tiled

http://stackoverflow.com/comment/31621763
score: 0
has text: @Quirliom I didn't mean that I don't want to use a dedicated library, just that I wasn't comfortable with using OpenGL yet, as in I don't have experience with it, so I don't know how to use it to load obj files.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20984214

http://stackoverflow.com/q/20898378
has comment: http://stackoverflow.com/comment/31367937
score: 0
has answer: http://stackoverflow.com/a/20899087
answer count: 2
accepted answer: http://stackoverflow.com/a/20899087
has comment: http://stackoverflow.com/comment/31367887
has title: Java-Fake system clock in launch
has body: For a workaround , I need to change the system clock for a certain java program without touching the code in order to get for : calendar.getinstance().get(calendar.year) = 2013 is it possible just with setting a variable through launch configuration? Thanks EDIT :Sorry , i want to simulate the current year as 2013
linked to: http://stackoverflow.com/q/6203857
has comment: http://stackoverflow.com/comment/31367265
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31367697
has comment: http://stackoverflow.com/comment/31367788
has answer: http://stackoverflow.com/a/20899077
type: Question
has comment: http://stackoverflow.com/comment/31367248
tagged with: date
possible better answer: http://stackoverflow.com/a/20899077

http://stackoverflow.com/a/20979034
answers question: http://stackoverflow.com/q/20974723
accepted answer of: http://stackoverflow.com/q/20974723
score: 1
upvote count: 1
type: AcceptedAnswer
has body: You add a MouseListener to the table, and you check for the following things: Clicked button is mouse right-click. The pointer of the event is located within the bounds of your table item (i.e. your first TableItem - you will use table.getItem(Point)). If these conditions are met, you open the menu at mouse location.
type: Answer
downvote count: 0

http://stackoverflow.com/comment/31305799
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20865143
has text: @chrylis I'm not sure I understand. A regex I might want is "^.*?でいる。" But now, I'm doing ("^.*?" + Const_DE + Const_I + Const_RU + DOUBLE_WIDTH_PERIOD) just so people who can't read kana can read my source code. But, really the only way is to write the "^.*?でいる。" regex and not worry if some people can't read it. Don't you agree?
score: 0

http://stackoverflow.com/q/20992485
has comment: http://stackoverflow.com/comment/31604153
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/23837342
score: 1
tagged with: java
type: Question
has title: How to install org.apache.tools.ant.taskdefs.optional.Rpm for ant
tagged with: ant
downvote count: 0
has body: I'm trying to launch: ant rpm command where my build.xml at line #126 looks like: &lt;rpm specFile="whatever.spec" topDir="${basedir}/rpm" command="-bb" failOnError="true" /&gt; I'm getting the error: build.xml:126: Problem: failed to create task or type rpm Cause: the class org.apache.tools.ant.taskdefs.optional.Rpm was not found. This looks like one of Ant's optional components. Action: Check that the appropriate optional JAR exists in -/usr/share/ant/lib -/export/home/myuser/.ant/lib -a directory added on the command line with the -lib argument I downloaded ant-nodeps-1.7.1.jar which contains: jar tvf ant-nodeps-1.7.1.jar | grep Rpm 7171 Fri Jun 27 05:03:48 CEST 2008 org/apache/tools/ant/taskdefs/optional/Rpm.class I placed this jar file to directory: /usr/share/ant/lib ant-1.7.0.jar -&gt; ../../java/ant-1.7.0.jar ant.jar -&gt; ../../java/ant.jar ant-launcher-1.7.0.jar -&gt; ../../java/ant-launcher-1.7.0.jar ant-launcher.jar -&gt; ../../java/ant-launcher.jar ant-nodeps-1.7.1.jar but still getting that build error. I tried also with commands: ant -lib /usr/share/ant/lib rpm ant -lib /usr/share/ant/lib/ant-nodeps-1.7.1.jar rpm ant -lib ant-nodeps-1.7.1.jar rpm whithout succes, getting the same error. What is missing, what I need to do ? Thanks !
answer count: 1
has comment: http://stackoverflow.com/comment/31658097

http://stackoverflow.com/a/20898458
upvote count: 1
type: Answer
has body: However, I can't seem to find the perfect way. ( Especially, not sure how to send images to android..) => I assume your question is to send and receive image to/from server. Based on the assumption, I would suggest you a best solution to upload/receive images from/to your server. Suggestion: To send image/s from Android: Convert the selected image into Base64 String and send it to the server. Server has to convert received Base64 string into Image and store at any location. To Receive image/s from Server: As server converts Base64 string into the actual Images, it just has to return URL of images. Android has to load images by using URLs. I would say this is the optimized solution, by using you can transfer any size of images. Other approach of sending images to server is by using Multi-party entity logic.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31367538
answers question: http://stackoverflow.com/q/20898349

http://stackoverflow.com/q/20907772
has title: Reusing Java objects to avoid repetitive work?
has body: Everytime, before sending a request to an HTTP server, I need to create a java bean and set the values of its members, then transform it to XML, since that server only accepts this data formatted as XML. There are some common member values of this java bean, and I don't want to create a new instance for each request. At first, I thought of the Prototype design pattern, but after reading "Effective java", I think it wouldn't work. Any other suggestions? Thank you, and there are some code to make it clear: /** * @Title: SSOManager.java * @Prject: TIJDemo * @Package: com.common * @Description: TODO * @author: Administrator * @date: 2014-1-4 上午7:58:32 * @version: V1.0 */ package com.common; import java.io.Serializable; /** * @author Administrator * */ public class SSOManager { private static String serverUrl = "http://localhost:8080/SSO/"; public SSOEntity getUserNameById(SSOEntity entity) { return requestSSO(entity, "GetUserNameById"); } public SSOEntity modifyUserName(SSOEntity entity) { return requestSSO(entity, "ModifyUserName"); } public SSOEntity register(SSOEntity entity) { return requestSSO(entity, "Register"); } private SSOEntity requestSSO(SSOEntity entity, String url) { String requestXml = getXmlFromEntity(entity); String requestUrl = serverUrl + url; String result = httpRequest(requestXml, requestUrl); return getEntityFromXml(result); } /** * * @param entity * @return */ private String getXmlFromEntity(SSOEntity entity) { String result = ""; /** * generate xml from this entity, and sign data */ return result; } private SSOEntity getEntityFromXml(String xml) { /** * transform xml to java bean */ return null; } private String httpRequest(String xml, String url) { String result = ""; /** * request another web server, get xml */ return result; } public static void main(String[] args) { // this property is for md5 sign, each server has a different key String applicationKey = "hellokitty"; SSOManager sm = new SSOManager(); SSOEntity response = null; // one servlet…
tagged with: design-patterns
has comment: http://stackoverflow.com/comment/31385904
has answer: http://stackoverflow.com/a/20915215
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31384735
type: Question
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/20908375
accepted answer: http://stackoverflow.com/a/20915215
has answer: http://stackoverflow.com/a/20908375
has comment: http://stackoverflow.com/comment/31385431
has comment: http://stackoverflow.com/comment/31384899
has answer: http://stackoverflow.com/a/20911040

http://stackoverflow.com/comment/31432835
score: 0
has text: Welcome to StackOverflow; I hope your question has been answered. You should [accept](http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) whichever answer answered your question.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20907872

http://stackoverflow.com/a/20885382
downvote count: 0
answers question: http://stackoverflow.com/q/20883852
has body: This is the best i could come up with.. Other suggestions are welcome. UserFactorsRecord userFactRec = create.fetchOne(UserFactors.USER_FACTORS, UserFactors.USER_FACTORS.FACTOR_ID.eq(factorId).and(UserFactors.USER_FACTORS.USER_ID.eq(userId))); userFactRec.setValue(value); userFactRec.store();
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/31508681
type: Comment
comment on: http://stackoverflow.com/a/20960343
has text: actually that's what I had before and I had the same problem. The way I have it up there just seems more fancy to me :) but thanks!
type: AnswerComment
score: 0

http://stackoverflow.com/q/21001232
accepted answer: http://stackoverflow.com/a/21021293
favorite count: 0
possible better answer: http://stackoverflow.com/a/21009799
tagged with: android
has answer: http://stackoverflow.com/a/33165348
has answer: http://stackoverflow.com/a/21009799
has answer: http://stackoverflow.com/a/21021293
has body: How do i add an external library and nested external libraries to an android project? My project structure (Not allowed to change) Apps/ App1/ build.gradle settings.gradle libraries/ library1/ build.grade settings.gradle library2/ build.grade settings.gradle library3/ build.grade settings.gradle library4/ build.grade settings.gradle App1 App1/build.gradle buildscript { ... } apply plugin: 'android' dependencies { compile fileTree(dir: 'libs', include: '*.jar') compile project(':..:libraries:library1') compile project(':..:libraries:library2') compile project(':..:libraries:library3') compile project(':..:libraries:library4') } android { ... } App1 does not directly depend on library3 or library4, however, it will complain if i don't include them in the dependencies in the build.gradle file and the settings.gradle file. So, i have them included just to stop it from complaining. App1/settings.gradle include ':' include '..:libraries:library1' include '..:libraries:library2' include '..:libraries:library3' include '..:libraries:library4' library1 library1/build.gradle buildscript { ... } apply plugin: 'android-library' dependencies { compile fileTree(dir: 'libs', include: '*.jar') compile project(':..:library3') compile project(':..:library4') } android { ... } library1/settings.gradle include ':' include '..:library3' include '..:library4' library2..4 library2..4/build.gradle buildscript { ... } apply plugin: 'android-library' dependencies { compile fileTree(dir: 'libs', include: '*.jar') } android { ... } library2..4/settings.gradle include ':' When trying to gradlew clean build on App1 i get the following error: FAILURE: Build failed with an exception. * Where: Build file '/home/user/projects/branches/branch1/Apps/libraries/library1/build.gradle' line: 15 * What went wrong: A problem occurred evaluating project ':..:library:library1'. &gt; Project with path ':..:library3' could not be found in project ':..:library:library1'. Line 15 is compile project(':..:library3'…
score: 14
type: AnsweredQuestion
tagged with: build
tagged with: android-gradle-plugin
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38952578
tagged with: gradle
type: Question
upvote count: 14
answer count: 3
has title: Android Gradle adding external library and nested external libraries to a project

http://stackoverflow.com/comment/31356155
type: AnswerComment
score: 0
type: Comment
has text: can you elaborate regarding number 3? why is it bad to use wait \notify on thread instance?
comment on: http://stackoverflow.com/a/20870564

http://stackoverflow.com/q/20889670
has comment: http://stackoverflow.com/comment/31351395
score: -1
has comment: http://stackoverflow.com/comment/31350856
has answer: http://stackoverflow.com/a/20889826
has comment: http://stackoverflow.com/comment/31351118
answer count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/31351165
favorite count: 0
has comment: http://stackoverflow.com/comment/31351125
has comment: http://stackoverflow.com/comment/31351506
has comment: http://stackoverflow.com/comment/31350894
has title: Recursion. nCr and nPr code. Giving out weird answers
has comment: http://stackoverflow.com/comment/31351195
has comment: http://stackoverflow.com/comment/31351265
has body: public class PermComb { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Insert n"); int n=input.nextInt(); System.out.println("Insert r"); int r=input.nextInt(); double C = factorial(n)/(factorial(n-r)*factorial(r)); //Finding C. System.out.println("Therefore: nCr = " + C); double P = factorial(n)/(factorial(n-r)); //Finding P. System.out.println("Therefore: nPr = " + P); } public static double factorial(double num) { if(num==1) return 1; else return num = factorial(num-1)*num; } Now it's giving out weird answers on set on values like (20,10), (30,15), (19,8), (20,2). Why? Thanks.
upvote count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31351073
type: Question
tagged with: recursion
has answer: http://stackoverflow.com/a/20889821
has answer: http://stackoverflow.com/a/20890258

http://stackoverflow.com/comment/31629553
score: 0
has text: Hi, could you check the edit and the [link](https://community.jboss.org/thread/205646)? I think this is your problem.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21015257

http://stackoverflow.com/q/20946198
possible better answer: http://stackoverflow.com/a/20946360
has title: Why are these signed bytes being read as unsigned bytes with LWJGL?
has comment: http://stackoverflow.com/comment/31459572
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/20946360
has answer: http://stackoverflow.com/a/20954750
accepted answer: http://stackoverflow.com/a/20954750
type: AnsweredQuestion
has body: When you upload a ByteBuffer (java lang object) which stores signed bytes, with the LJWGL function, glBufferData(), it turns out the correct way for openGL to interpret the data on the corresponding buffer is with GL_UNSIGNED_BYTE. Why is this? LWJGL does not seem to be converting the ByteBuffer to some other format, here is the source for the glBUfferData() function. public static void glBufferData(int target, ByteBuffer data, int usage) { ContextCapabilities caps = GLContext.getCapabilities(); long function_pointer = caps.glBufferData; BufferChecks.checkFunctionAddress(function_pointer); BufferChecks.checkDirect(data); nglBufferData(target, data.remaining(), MemoryUtil.getAddress(data), usage, function_pointer); } Any idea why? Edit: I see why you guys may think there needs to be no conversion because unsigned bytes and bytes are stored the same way. But let me clarify, I put integral values of 1 2 3 4 5, etc, into this bytebuffer, presumably as signed bytes because that's what java handles. So these bytes are storing 12345 when using a signed interpretation, presumably. So why does openGL read 12345 with a unsigned interpretation instead of the signed interpretation, is the question. note that the significance of the data is an index buffer.
has comment: http://stackoverflow.com/comment/31458220
tagged with: opengl
score: 1
tagged with: java
tagged with: lwjgl
has comment: http://stackoverflow.com/comment/31459285
upvote count: 1
type: Question

http://stackoverflow.com/comment/67432216
has text: @squirrelsareduck Just thought I'd mention that I was learning C++ just last year and data structures such as Linked Lists and Vectors were being taught as part of the main content as if they were still completely viable solutions to a number of different problems. They each have their uses for reducing the amount of time taken to access certain elements since they're constructed differently on the inside. I'm not sure that you would need to delve so deep into this for Java development but for C++ development it seems more crucial.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20941689
score: 0

http://stackoverflow.com/comment/31313970
comment on: http://stackoverflow.com/q/20869325
type: QuestionComment
type: Comment
has text: yes basically thats the main issue data inside array list is not as expected. I am basically creating array list of hash map but its returning arraylist with incorrect hash maps when viewed. Its a very strange issue i guess there is some problem in converting it into object. The array list is getting converted into byte array but i guess its members i.e. hash maps are not getting converted into byte array in proper manner somewhat like deepcopy and shallow copy thing i believe. DO i need to change the conversion logic so as to ensure entire object is converted into byte array
score: 0

http://stackoverflow.com/comment/31505761
type: AnswerComment
has text: Did you read the other answers? This won't work because of the default namespace declaration.
type: Comment
comment on: http://stackoverflow.com/a/20971219
score: 1

http://stackoverflow.com/comment/31396835
type: Comment
has text: @arshajii I prefer the method from apache instead of `Chars.indexOf()`, since it deals better with a potential `null` array as input.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20913437

http://stackoverflow.com/comment/31566543
score: 0
comment on: http://stackoverflow.com/q/21004147
type: QuestionComment
type: Comment
has text: Have you tried explicitly waiting (eg: `Thread.sleep`)? For example, you know that the text should appear within a few seconds of typing in the input. Rather than having selenium figure out when it should check the element. The condition of visibility should satisfy that, but maybe it doesn't. Have you printed out what the current HTML is before you try to get the element? To verify that your input has been typed in correctly.

http://stackoverflow.com/a/21015257
accepted answer of: http://stackoverflow.com/q/20982711
answers question: http://stackoverflow.com/q/20982711
has body: Check the spec, ch. 3.1 "Service Implementation Bean" (emphasis mine): The implementation bean MAY reference a service endpoint interface by using the @WebService.endpointInterface annotation. [...] In this case, the service implementation bean MUST NOT include any JSR-181 annotations other than @WebService and @HandlerChain. So could you try removing the @WebMethod annotation from the method in the class (the annotation in the interface method should suffice) and moving the @SOAPBinding to the interface? Additionally the EJB method is marked final. This is probably the problem (ref).
type: AcceptedAnswer
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/31629553
downvote count: 0
has comment: http://stackoverflow.com/comment/31628802
score: 1

http://stackoverflow.com/comment/31528238
type: Comment
type: QuestionComment
has text: What attempts have you made to debug this?
comment on: http://stackoverflow.com/q/20983111
score: 0

http://stackoverflow.com/comment/31413285
type: AnswerComment
type: Comment
has text: You're right! Now the spaceship appears when I added the lines ` ufoNode.setLocalScale(300f); ufoNode.setLocalTranslation((new Vector3f(10f, 10f, 180010f)));` Please see the updated question and tell me if I can improve.
comment on: http://stackoverflow.com/a/20922405
score: 0

http://stackoverflow.com/a/20884554
answers question: http://stackoverflow.com/q/20884521
type: Answer
has body: You are not deleting the file before writing in it.
upvote count: 1
downvote count: 1
score: 0

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/20957504
tags question: http://stackoverflow.com/q/20982317
tags question: http://stackoverflow.com/q/20994151
tags question: http://stackoverflow.com/q/21011609
type: Tag
tags question: http://stackoverflow.com/q/21000654

http://stackoverflow.com/q/20904063
favorite count: 0
accepted answer: http://stackoverflow.com/a/20918365
tagged with: testng
type: AnsweredQuestion
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/31396150
tagged with: gradle
tagged with: unit-testing
has comment: http://stackoverflow.com/comment/31379391
type: Question
has comment: http://stackoverflow.com/comment/31377912
has comment: http://stackoverflow.com/comment/31383700
has answer: http://stackoverflow.com/a/20918365
has title: Gradle "test" task does not fail where it should be
tagged with: tdd
has body: Hello I am new to Gradle. We just switch from Maven to Gradle and I have some difficulties in understanding of Gradle test task. Here is my class: public class Money { private final int amount; private final String currency; public Money(int amount, String currency) { if (amount &lt; 0) { throw new IllegalArgumentException("illegal amount: [" + amount + "]"); } if (currency == null || currency.isEmpty()) { throw new IllegalArgumentException("illegal currency: [" + currency + "]"); } //this.amount = 15; this.amount = amount; this.currency = currency; } public int getAmount() { return amount; } public String getCurrency() { return currency; } } And here is my test (using TestNG): @Test public class MoneyManyValuesTest { public void testConstructor() { Money money = new Money(10, "USD"); assertEquals(money.getAmount(), 10); assertEquals(money.getCurrency(), "USD"); money = new Money(20, "EUR"); assertEquals(money.getAmount(), 20); assertEquals(money.getCurrency(), "EUR"); } } When I run test (with gradle "test" task) everything looks like OK. But then I want my test to fail, so I tweak last row of my test like this: assertEquals(money.getCurrency(), "EUR want error here"); Run gradle "test" again and test still passes with msg: 2:40:26 PM: Executing external task 'test'... money:compileJava UP-TO-DATE money:processResources UP-TO-DATE money:classes UP-TO-DATE money:compileTestJava money:processTestResources UP-TO-DATE money:testClasses money:test BUILD SUCCESSFUL What is going on here? Here is my build script apply plugin: 'idea' apply plugin: 'eclipse' apply plugin: 'java'; apply plugin: 'eclipse' repositories { mavenCentral() } dependencies { testCompile 'org.testng:testng:6.3.1' testCompile 'org.mockito:mockito-all:1.9.0' testCompile 'org.easytesting:fest-assert:1.4' testCompile 'org.hamcrest:hamcrest-all:1.1' } test { useTestNG() } }
answer count: 1
downvote count: 0
score: 1

http://stackoverflow.com/a/20860014
has comment: http://stackoverflow.com/comment/31296947
score: 0
has comment: http://stackoverflow.com/comment/31297281
has comment: http://stackoverflow.com/comment/31796923
has comment: http://stackoverflow.com/comment/31297586
answers question: http://stackoverflow.com/q/20859846
type: Answer
has comment: http://stackoverflow.com/comment/31297492
has comment: http://stackoverflow.com/comment/31295807
has comment: http://stackoverflow.com/comment/31297451
has body: The sj:head tag is used in the HTML head tag body. Try to move the tag to the head tag. &lt;head&gt; &lt;sj:head jqueryui="true" jquerytheme="redmond" /&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt;
has comment: http://stackoverflow.com/comment/31297668
has comment: http://stackoverflow.com/comment/31297288
has comment: http://stackoverflow.com/comment/31297139
has comment: http://stackoverflow.com/comment/31297063

http://stackoverflow.com/comment/31381880
score: 0
type: Comment
has text: There is no `@PostConstruct` annotation in `PropUtil` class only two `@Autowired`.
comment on: http://stackoverflow.com/a/20906326
type: AnswerComment

http://stackoverflow.com/comment/31486164
type: Comment
comment on: http://stackoverflow.com/q/20960487
type: QuestionComment
has text: (Your "Spidey sense" is not that far off, though. How arrays are handled is one of the major irregularities of the Java language and JVM architecture. It could have been done much more uniformly.)
score: 0

http://stackoverflow.com/q/21012231
has answer: http://stackoverflow.com/a/21013913
tagged with: jta
tagged with: weblogic11g
score: 0
accepted answer: http://stackoverflow.com/a/21013913
answer count: 2
tagged with: jpa
possible better answer: http://stackoverflow.com/a/21013049
favorite count: 0
has answer: http://stackoverflow.com/a/21013049
has body: Can we set the JTA datasource name in properties file , which will be read in persistance.xml of application.
type: AnsweredQuestion
tagged with: java
upvote count: 1
has title: Can we set JTA datasource name in properties file
downvote count: 1
type: Question

http://stackoverflow.com/comment/57363568
type: AnswerComment
comment on: http://stackoverflow.com/a/21009989
type: Comment
has text: @thatJavaNerd I use `FXCollections.observableList(List)`, but it doesn't update as "true" ObservableList would update. It looks like it waits for another event to happen, and then it updates.
score: 0

http://stackoverflow.com/q/20941185
has body: I am creating a musicplayer that has a table showing songs from a folder (like a playlist). My problem is that the next row being added has the same result (name) as the previous one. In my folder "tracks" there is track1, track2, track 3. If I use: File tracksFolder = new File("tracks"); final File[] tracks = tracksFolder.listFiles(); Vector&lt;Vector&lt;Object&gt;&gt; data = new Vector&lt;Vector&lt;Object&gt;&gt;(); Vector&lt;Object&gt; row = new Vector&lt;Object&gt;(); for (int i = 0; i &lt; tracks.length; i++) { System.out.println(tracks[i]); row.add(tracks[i].toString()); data.add(row); } Vector&lt;String&gt; headers = new Vector&lt;String&gt;(); headers.add("Song"); final JTable table = new JTable( data, headers ); // some more code It returns in console: tracks/track 1.wav tracks/track 2.mp3 tracks/track 3.flac but my table: tracks/track 1.wav tracks/track 1.wav tracks/track 1.wav The weirdest thing is that it works in my console!
tagged with: file
tagged with: swing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31449469
tagged with: java
has title: Java: File[] to JTable
type: Question
has answer: http://stackoverflow.com/a/20941310
accepted answer: http://stackoverflow.com/a/20941310
answer count: 1
tagged with: directory
has comment: http://stackoverflow.com/comment/31449572
has comment: http://stackoverflow.com/comment/31449651
score: 0

http://stackoverflow.com/comment/31468588
has text: This simply shouldn't be an Enum. You should look up the purpose of Enums because this clearly isn't the case in which you should be creating an Enum. Also, I believe only other Enums can subclass Enum.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20951615

http://stackoverflow.com/comment/31322116
comment on: http://stackoverflow.com/a/20873888
has text: Cannot cast from View to EditText and The method getText() is undefined for the type EditText
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31433289
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/20933087
has text: can you try like this... set OnDismissListener for Dialog and do longOperation() in that listener...

http://stackoverflow.com/q/21005841
type: Question
has answer: http://stackoverflow.com/a/21031391
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31591257
tagged with: http://stackoverflow.com/tag/xml
has title: Jaxb dont discovery correct son of my base class
type: UnansweredQuestion
score: 1
tagged with: jaxb
upvote count: 1
has body: In a personal project i have the following xml structures to make my own java classes: first: <response> getcredits aptalaser 193 second: <response> getMsgInfoByID c36d7ee5-16f9-4193-9a75-0537e590e9d3 +17036231081 [4] 10958 INBOX 2011.10.17 13:10:26 2011.10.17 13:10:26 2011.10.17 13:10:26 <callbackid/> 0 SMPP0 defin_admin <optionalfield name="30" value="35333131572D31303133322D303530364E2D333434544600"/> <optionalfield name="8528" value="017F"/> SMS:TEXT Test message third: <response> sendmessage 0 Message accepted for delivery 0f06bbd9-0894-4fb4-9c4b-68e29363d299 aptalaser 8588430260 SMS:TEXT Bom dia cara. The structures are divided in two places: a action to indicating the method acessed and the data section: a generic portion with will change the content dinamically in response to access a different method. Following this idea i decide create a Response class with two field: a String action and a field Data: The Response class: /* omite desnecessary imports */ @XmlRootElement(name = "response") @XmlAccessorType(XmlAccessType.PROPERTY) public class Response { private String action; private Data data; public String getAction() { return action; } /* omitted set methds */ @XmlElementRef public Data getData() { return data; } @Override public String toString() { String template = "( action: %s, data: %s )"; return String.format(template, this.action, this.data); } } The Data class, the base class for all Data sections @XmlSeeAlso({ GetInfoMessageData.class, GetAccountData.class, SendMessageData.class }) public class Data { } The GetAccountClass to represent account retrieve information /* omite desnecessary imports */ @XmlRootElement(name = "data") @XmlAccessorType(XmlAccessType.PROPERTY) public class GetAccountData extends Data { private List account; public List getAccount() { return account; } /* omitted set methos */ @Override public String toString() { return String.format("Account( %s )", this.account); } public static class Account { private String username; pr…
has comment: http://stackoverflow.com/comment/31571388
tagged with: java
has comment: http://stackoverflow.com/comment/31570265
tagged with: inheritance

http://stackoverflow.com/comment/31545392
has text: why your adapter holds that getImages call? What is its purpose?
comment on: http://stackoverflow.com/q/20993033
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21064625
downvote count: 0
type: Answer
has body: As the previously quoted wiki entry says the console view is primarily intended for simple ports of traditional code which uses System.out.print and the like. A few plugins such as the SVN and CVS code use the Console view to provide the traditional output from commands but also provide additional views and dialogs which provide more or better information. So if you are developing an Eclipse plugin from scratch I would say you create your own view(s). Hopefully you can provide more actions for manipulating your data than are available in the Console view. If appropriate you could also provide the console view like SVN does.
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/20936087

http://stackoverflow.com/a/22009656
answers question: http://stackoverflow.com/q/20878052
has body: Did you enter a username and/or password under wrapper.app.account or wrapper.ntservice.account (with corresponding password) in the wrapper configuration file? If so, try commenting them out, maybe you have a problem with the user-account.
type: Answer
has comment: http://stackoverflow.com/comment/54479550
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/comment/31291270
type: Comment
has text: Is name a column name or the name of a variable that you need to replace in your method ?
comment on: http://stackoverflow.com/q/20858100
score: 0
type: QuestionComment

http://stackoverflow.com/q/20971187
score: 0
tagged with: java
upvote count: 1
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/31551872
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31532338
tagged with: resin
tagged with: migration
has comment: http://stackoverflow.com/comment/31538882
tagged with: migrate
tagged with: tomcat
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/20972078
has comment: http://stackoverflow.com/comment/44067448
has title: How to Migrate a web project running on resin server to tomcat
has body: I have a web project which is already running on resin but I want to deploy the whole project in tomcat server (i.e., I want to migrate the server) I think only web.xml should be changed so I tried following changes I have web.xml in resin as <?xml version="1.0" encoding="UTF-8"?> <multipart-form enable="true" upload-max="50M" /> <resin:Forward regexp="^/static/([\d|-]+)/(css|js|images|html)/(.*)$" target="/$2/$3"> <gemini:filter.ExpiresFilter> 31556926000 </gemini:filter.ExpiresFilter> </resin:Forward> <mime-mapping extension=".php" mime-type="text/plain" /> <mime-mapping extension=".jsp" mime-type="text/plain" /> <mime-mapping extension=".jspf" mime-type="text/plain" /> <mime-mapping extension=".jspx" mime-type="text/plain" /> <session-config enable-url-rewriting="false" /> UTF-8 true <filter-mapping url-pattern='*' filter-name="gzip" /> Cron Job Scheduler Manager com.leonardo.email.CronJobHandler PrintActionItems com.leonardo.PrintActionItems PrintActionItems /PrintActionItems DeleteActionItemFile com.leonardo.DeleteActionItemFile DeleteActionItemFile /DeleteActionItemFile I want to change this web.xml according to Tomcat I changed it as below: <?xml version="1.0" encoding="UTF-8"?> <multipart-form enable="true" upload-max="50M" /> default /css/* default /js/* default /html/* default /images/* default /static/* default *.php default *.jsp default *.jspf default *.jspx default /WEB-INF/* <session-config enable-url-rewriting="false" /> UTF-8 true Cron Job Scheduler Manager com.leonardo.email.CronJobHandler PrintActionItems com.leonardo.PrintActionItems PrintActionItems /PrintActionItems DeleteActionItemFile com.leonardo.DeleteActionItemFile DeleteActionItemFile /DeleteActionItemFile But, while running tomcat it gives following errors org.apache.tomcat.util.modeler.Registry registerComponent SEVERE: Null component Catalina:type=JspMonitor,name=jsp,WebModule=//localhost/, J2EEApplication=none,J2EEServer=none org.apache.catalina.startup.HostConfig deployDirectory SEVE…

http://stackoverflow.com/comment/31434673
comment on: http://stackoverflow.com/a/20933761
score: 1
type: AnswerComment
type: Comment
has text: Have you clicked through Maroun's "Indeed" hyperlink above? I believe that answer covers it.

http://stackoverflow.com/a/20971478
upvote count: 3
type: Answer
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/20970788
has body: You have indeed already been given the answer, although what you have is not an infinite loop, but infinite recursion, which will eventually cause a StackOverflowError. Here's what happens: new GUI() calls new nupuVajutus(). This creates a new nupuVajutus object by calling its constructor. Because nupuVajutus extends GUI, this means a nupuVajutus object is a GUI object with additional functionality. Therefore, because it is a GUI object, a GUI constructor needs to be called. The nupuVajutus constructor does not explicitly call a super constructor, so it implicitly calls the GUI() (no argument) constructor before executing. In this new call to the GUI() constructor, another new nupuVajutus() call is encountered, and so on, ad infinitum... It seems to me you need to do some more research around Object Oriented Programming, in particular the topics of sub-classing, inheritance, object instances, and encapsulation. There are plenty of resources available to help you. After you extracted your ActionListener into a separate file, you should not have changed it to extend GUI. That extends the class (which is like a blueprint) not an instance (which is like a something built using that blueprint) - remember: you can create multiple instances of a class. Previously, the "nupuVajutus" ActionListener was an inner class, so it had access to all of the enclosing class' fields and methods. Now that it is no longer an inner class, it needs to be passed a reference to the GUI instance so that it can access its methods. Something like this: public class NupuVajutus implements ActionListener { private final GUI gui; public NupuVajutus(GUI gui) { this.gui = gui; } public void actionPerformed(ActionEvent e) { // The GUI instance can now be accessed through the gui field, for example: gui.something(); // ... } } And in the GUI() constructor: NupuVajutus nV = new NupuVajutus(this); To be honest, though, there is nothing wrong with keeping your ActionListener as an inner class. If you're …

http://stackoverflow.com/a/20963169
has comment: http://stackoverflow.com/comment/31573033
accepted answer of: http://stackoverflow.com/q/20963110
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20963110
has body: Looks like you're sleeping for ~1000ms (well 950 to be exact because your last operation is not being sent to the serial device) plus the time needed to perform the writes over your serial connection. That's a pretty long time to do nothing. Remove the Thread.sleep(50) call and put the entire contents of the onClick into the run method of the following code: AsyncTask.execute(new Runnable { @Override public void run() { // talk to device here } }); Then, ask a different question about the quick writes crashing your connection.
type: Answer
has comment: http://stackoverflow.com/comment/31494223
has comment: http://stackoverflow.com/comment/31494299
has comment: http://stackoverflow.com/comment/31493596
downvote count: 0
score: 1

http://stackoverflow.com/a/20972483
type: Answer
has body: Using an element collection here might be a better option. An element collection works well for providing relationships with attributes. It could look like this in your Orders class: @ElementCollection private Map&lt;Item, Integer&gt; itemQuantities = new HashMap&lt;Item, Integer&gt;(); EDIT: You can use @ElementCollection when the value type of the Map is a basic type or an Embeddable. Integer is a basic type. If you decide to use an entity as the value type of the Map, you have to use @OneToMany or @ManyToMany The key type has no influence on the annotation selection in this case, so you could use an Item or a Long as key, without having to change the annotation. This does however have an impact on the physical mapping annotations you can use.
score: 0
accepted answer of: http://stackoverflow.com/q/20972328
answers question: http://stackoverflow.com/q/20972328
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31509514

http://stackoverflow.com/q/20911705
answer count: 1
has title: Dependence between Activity and createpdf function
has body: I'd like to create som pdf files in an android app. I found a tutorial and it works fine, but... I use my own function createPDF() in my Activity. My question is: how can I use (for instance TextView tv1) to populate a paragraph by using the inner createPDF() function? Some example code public class GenPDF extends Activity { TextView tv1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.genpdf); createPDF(); } public void createPDF() { Document doc = new Document(); Paragraph p1 = new Paragraph(//my text from textview goes here//); doc.add(p1); } Just for example, how can I put some text from tv1 (which is a TextView) to Paragraph p1?
tagged with: android
tagged with: http://stackoverflow.com/tag/pdf
type: AnsweredQuestion
tagged with: itext
type: Question
has answer: http://stackoverflow.com/a/20911915
accepted answer: http://stackoverflow.com/a/20911915
tagged with: java
score: 0

http://stackoverflow.com/comment/47361813
type: Comment
has text: This is bad! If you ever update your tomcat installation and replace your catalina.sh newrelic stop working. New Relic should come up with a better solution!! There aren't many distributions that are used and the agent could try to look into at least the most used ones where the actual path of tomcat_home is.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20861652

http://stackoverflow.com/q/20984323
accepted answer: http://stackoverflow.com/a/20988275
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/20988275
favorite count: 0
tagged with: parsing
tagged with: http://stackoverflow.com/tag/xml
has title: How to add an element in this XML file using DOM parser?
has answer: http://stackoverflow.com/a/20985988
type: AnsweredQuestion
has body: I want to know how can I modify this XML file, <?xml version="1.0"?> 12345 into a XML file like this using DOM parser in Java, <?xml version="1.0" encoding="UTF-8" ?> 2013-09-09 12345 I have tried this but doesn't work, public class Test { public static final String xmlFilePath = "src/vnx.xml"; public static final String xml2FilePath = "src/input2.xml"; public static void main(String argv[]) { try { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); Document document = documentBuilder.parse(xmlFilePath); Element version = document.createElement("heat"); version.appendChild(document.createTextNode("2013-09-09")); document.appendChild(version); TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource domSource = new DOMSource(document); StreamResult streamResult = new StreamResult(new File(xml2FilePath)); transformer.transform(domSource, streamResult); } catch (ParserConfigurationException pce) { pce.printStackTrace(); } catch (TransformerException tfe) { tfe.printStackTrace(); } catch (IOException ioe) { ioe.printStackTrace(); } catch (SAXException sae) { sae.printStackTrace(); } } } It returns a parsing error. Any suggestion would be really helpful. Thanks a lot!
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21201107
has comment: http://stackoverflow.com/comment/31530818
tagged with: dom
type: Question
possible better answer: http://stackoverflow.com/a/20985988
tagged with: javascript

http://stackoverflow.com/a/69863612
has comment: http://stackoverflow.com/comment/132799249
has body: There is actually an O(n) runtime complexity solution for this task, so this is a humble attempt to share that. The trick to go from the proposed O(n * loglogn) solutions to O(n) is to calculate the maximum gap between any two peaks (or a leading or trailing peak to the corresponding endpoint). This can be done while building the peak hash in the first O(n) loop. Then, if the gap is 'g' between two consecutive peaks, then the minimum group size must be 'g/2'. It will simply be 'g' between start and first peak, or last peak and end. Also, there will be at least one peak in any group from group size 'g', so the range to check for is: g/2, 1+g/2, 2+g/2, ... g. Therefore, the runtime is the sum over d = g/2, g/2+1, ... g) * n/d where 'd' is the divisor'. (sum over d = g/2, 1 + g/2, ... g) * n/d = n/(g/2) + n/(1 + g/2) + ... + (n/g) if g = 5, this n/5 + n/6 + n/7 + n/8 + n/9 + n/10 = n(1/5+1/6+1/7+1/8+1/9+1/10) If you replace each item with the largest element, then you get sum &lt;= n * (1/5 + 1/5 + 1/5 + 1/5 + 1/5) = n Now, generalising this, every element is replaced with n / (g/2). The number of items from g/2 to g is 1 + g/2 since there are (g - g/2 + 1) items. So, the whole sum is: n/(g/2) * (g/2 + 1) = n + 2n/g &lt; 3n. Therefore, the bound on the total number of operations is O(n). The code, implementing this in C++, is here: int solution(vector&lt;int&gt; &amp;A) { int sizeA = A.size(); vector&lt;bool&gt; hash(sizeA, false); int min_group_size = 2; int pi = 0; for (int i = 1, pi = 0; i &lt; sizeA - 1; ++i) { const int e = A[i]; if (e &gt; A[i - 1] &amp;&amp; e &gt; A[i + 1]) { hash[i] = true; int diff = i - pi; if (pi) diff /= 2; if (diff &gt; min_group_size) min_group_size = diff; pi = i; } } min_group_size = min(min_group_size, sizeA - pi); vector&lt;int&gt; hash_next(sizeA, 0); for (int i = sizeA - 2; i &gt;= 0; --i) { hash_next[i] = hash[i] ? i : hash_next[i + 1]; } for (int group_size = min_group_size; group_size &lt;= sizeA; ++group_size) { if (sizeA % gro…
has comment: http://stackoverflow.com/comment/132798911
score: 0
answers question: http://stackoverflow.com/q/20886486
type: Answer

http://stackoverflow.com/comment/31452833
type: QuestionComment
comment on: http://stackoverflow.com/q/20918663
has text: There's no use of Apache Commons Logging in the JavaMail jar files, so I suspect the real problem is somewhere else.
score: 0
type: Comment

http://stackoverflow.com/comment/31584278
has text: I'm using your code line I'm getting BadPaddingException pad block currupted.
type: AnswerComment
comment on: http://stackoverflow.com/a/21013617
type: Comment
score: 0

http://stackoverflow.com/a/20915799
has body: I vote for Option 1. Schedule should know how to create itself from a String or an HTML page. None of that logic should be in drawSchedule, whose job should simply be, as one might guess, to draw a Schedule. You want to separate the concerns of building a Schedule from drawing it. Since this won't be too hard to do, you might as well do it. But be careful trying to be too elegant too soon. As Bob Martin advises in Agile Software Development, Principles, Patterns, and Practices with "taking the first bullet" and Nathan Marz advises with "suffering-oriented programming," don't be so quick to be as "pretty" as possible. Make everything work first; then refactor to a more elegant approach only when the pain of not doing so makes it worth it.
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/20915634
has comment: http://stackoverflow.com/comment/31400979
downvote count: 0

http://stackoverflow.com/comment/75119172
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21017453
has text: How to take care of null?

http://stackoverflow.com/q/21013793
has answer: http://stackoverflow.com/a/21014285
has answer: http://stackoverflow.com/a/21013976
has comment: http://stackoverflow.com/comment/31584430
tagged with: drag-and-drop
has comment: http://stackoverflow.com/comment/31584526
type: AnsweredQuestion
tagged with: android
has body: I am now implementing a drag and drop operation . In this operation drag from a relative layout to anther one is allowed . If there's a child in a layout and another image is drag to it the images must exchange position . Here's my problem when i cast a view to view group , Class cast exception occurs . I really don't know how to solve it as I'm a new to android . The error line at log cat points at this ((ViewGroup)parent).addView(nextChild). Please give me advice . Sorry if my question bother you . This is my Log cat output : 01-09 01:57:27.829: E/AndroidRuntime(2021): FATAL EXCEPTION: main 01-09 01:57:27.829: E/AndroidRuntime(2021): Process: com.example.barnyar, PID: 2021 01-09 01:57:27.829: E/AndroidRuntime(2021): java.lang.ClassCastException: android.view.View cannot be cast to android.view.ViewGroup 01-09 01:57:27.829: E/AndroidRuntime(2021): at com.example.barnyar.MainActivity$MyDragListener.onDrag(MainActivity.java:751) 01-09 01:57:27.829: E/AndroidRuntime(2021): at android.view.View.dispatchDragEvent(View.java:17371) 01-09 01:57:27.829: E/AndroidRuntime(2021): at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1300) 01-09 01:57:27.829: E/AndroidRuntime(2021): at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1286) 01-09 01:57:27.829: E/AndroidRuntime(2021): at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1286) 01-09 01:57:27.829: E/AndroidRuntime(2021): at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1286) 01-09 01:57:27.829: E/AndroidRuntime(2021): at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1286) 01-09 01:57:27.829: E/AndroidRuntime(2021): at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1286) 01-09 01:57:27.829: E/AndroidRuntime(2021): at android.view.ViewRootImpl.handleDragEvent(ViewRootImpl.java:5026) 01-09 01:57:27.829: E/AndroidRuntime(2021): at android.view.ViewRootImpl.access$800(ViewRootImpl.java:96) 01-09 01:57:27.829: E/AndroidRuntime(2021): at android.view.ViewRootImpl$ViewRootHand…
possible better answer: http://stackoverflow.com/a/21013976
has comment: http://stackoverflow.com/comment/31584223
favorite count: 0
linked to: http://stackoverflow.com/q/17562147
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/21014032
linked to: http://stackoverflow.com/q/496928
has title: java.lang.ClassCastException: android.view.View cannot be cast to android.view.ViewGroup
has comment: http://stackoverflow.com/comment/31584448
tagged with: java
has answer: http://stackoverflow.com/a/21013948
has comment: http://stackoverflow.com/comment/31584260
answer count: 4
has comment: http://stackoverflow.com/comment/31584332
score: 2
has comment: http://stackoverflow.com/comment/31584322
downvote count: 0
accepted answer: http://stackoverflow.com/a/21014032

http://stackoverflow.com/comment/31464010
has text: A) "It doesn't work" is not a useful problem description. B) If you try to compile that code, it tells you ***exactly*** what's wrong: *"variable userList might not have been initialized"*
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20949451

http://stackoverflow.com/a/20970030
answers question: http://stackoverflow.com/q/20969923
has comment: http://stackoverflow.com/comment/31504047
upvote count: 3
has comment: http://stackoverflow.com/comment/31503905
has comment: http://stackoverflow.com/comment/31503448
type: Answer
has body: seconds / secondsInterval will be carried out in integer arithmetic which means that any remainder is lost. Pre-multiplying by 1.0 will force the calculation to be carried out in floating point: 1.0 * seconds / secondsInterval (P.S. Eventually, your cast (int)secondsSpecial will give you trouble if secondsSpecial gets large: you need to rethink that. One idea would be to drop all your int types. Then, as a workaround to Calendar.add having an int as the interval argument, convert secondsSpecial to years and seconds and add the intervals successively.)
downvote count: 0
has comment: http://stackoverflow.com/comment/31503203
score: 3
has comment: http://stackoverflow.com/comment/31504051

http://stackoverflow.com/a/20859789
score: 0
has body: I don't think so. I always use a while loop to do this. And why that declaration of main function? I don't understand the DateFormat thing. It is the first time I see that. The main function doesn't return anything.
type: Answer
answers question: http://stackoverflow.com/q/20859688

http://stackoverflow.com/comment/31557161
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20954443
has text: I sign the jar with java 6 , because that is being used for development in our project. But the client , (browser from which I am accessing the web application) has java 7

http://stackoverflow.com/comment/31512468
comment on: http://stackoverflow.com/a/20975018
has text: @mattforsythe Sorry, another brain freeze moment... fixed now.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/20875309
has comment: http://stackoverflow.com/comment/31324994
type: Question
has comment: http://stackoverflow.com/comment/31324877
has comment: http://stackoverflow.com/comment/31324889
tagged with: java
has comment: http://stackoverflow.com/comment/31324854
has comment: http://stackoverflow.com/comment/31324940
has body: Hello I'm trying to do this homework and I should write a method that gets some information from other methods that I wrote. (e.g. car type,dates,extras etc.) .So my question is, can i use return values of these methods in my final method without calling them again? This is my main method: public class Homework3 { public static void main(String[] args) { Scanner input = new Scanner(System.in); char customer = 'O'; int numberOfCustomers = 0; int totalEarning= 0; while(customer != 'N'){ System.out.println("Car Type is " + promptForCarType()); System.out.println("Car rented for " + calculateDays() + " days."); promptForExtras(); System.out.printf("\nTotal : %d TL",calculateTotal() ); totalEarning += calculateTotal(); numberOfCustomers ++; System.out.println("Number of customers : " + numberOfCustomers); System.out.println("Total amount earned : " + totalEarning); while(customer != 'N' || customer != 'Y'){ System.out.println("A new customer? (Y/N)"); customer = input.next().charAt(0); customer = Character.toUpperCase(customer); } } } And I should use car type, days, extras in my calculateTotal() method. I also tried to assign other methods' return values as variables and using them in my final method as parameters but didn't work.For example i tried to write something like this : public static int calculateTotal(){ int total=0; int time = calculateDays(); int rate = (time / 7)*5 + (time % 7); if(promptForCarType().equals("Economy")) total += 50*rate; else if(promptForCarType().equals("Midsize")) total += 70*rate; else if(promptForCarType().equals("Fullsize")) total += 100*rate; total += promptForExtras() * time; return total; } but when i call calculateTotal() in my main method, it automatically calls calculateDays() again
upvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/20875424
has comment: http://stackoverflow.com/comment/31324891
has comment: http://stackoverflow.com/comment/31324900
has title: Is it possible to use return value of a method in another method?
type: AnsweredQuestion
score: -3
downvote count: 3
tagged with: methods
accepted answer: http://stackoverflow.com/a/20875424

http://stackoverflow.com/a/20952555
has body: String parsedText = output.toString(); boolean E = false; boolean W = false; boolean C = false; boolean I = false; boolean Skip5 = false; Scanner scanner = new Scanner(parsedText); while (scanner.hasNextLine()) { String line = scanner.nextLine(); Skip5 = false; if (line.startsWith("Errors")){ E = true; W = false; C = false; I = false; Skip5 = true;//start over with next line } if(line.startsWith("Warnings")){ E = false; W = true; C = false; I = false; Skip5 = true;//start over with next line } if(line.startsWith("Compliance")){ E = false; W = false; C = true; I = false; Skip5 = true;//start over with next line } if(line.startsWith("Instructional")){ E = false; W = false; C = false; I = true; Skip5 = true;//start over with next line } //Step 5 if(!Skip5){ if(I){ System.out.println("Instructional " + line.toString()); } if(E){ System.out.println("Error " + line.toString()); } if(W){ System.out.println("Warning " + line.toString()); } if(C){ System.out.println("Compliance " + line.toString()); } } }
type: Answer
answers question: http://stackoverflow.com/q/20951710
score: 0

field
tags question: http://stackoverflow.com/q/20935474
tag name: field
tags question: http://stackoverflow.com/q/20992938
type: Tag

vaadin
tags question: http://stackoverflow.com/q/20974420
tags question: http://stackoverflow.com/q/20990899
tag name: vaadin
type: Tag
tags question: http://stackoverflow.com/q/20978242
tags question: http://stackoverflow.com/q/20966623
tags question: http://stackoverflow.com/q/20884823
tags question: http://stackoverflow.com/q/20970196
tags question: http://stackoverflow.com/q/20943738
tags question: http://stackoverflow.com/q/20997479
tags question: http://stackoverflow.com/q/21006026
tags question: http://stackoverflow.com/q/21005268

http://stackoverflow.com/comment/31540916
has text: Doing media programming with Java is not easy at all ;-)
comment on: http://stackoverflow.com/a/20969527
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31517484
type: AnswerComment
has text: I found the problem... rookie mistake.. in: playerTwoSecondRowLinearLayout.addView(view, playersSecondRowIndex); I use playerSecondRowIndex which I use also in other class... Ive changed it and so far no problems... thx for the help :)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20976164

http://stackoverflow.com/q/20981445
has answer: http://stackoverflow.com/a/21007182
answer count: 3
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/20981835
has answer: http://stackoverflow.com/a/20981835
has comment: http://stackoverflow.com/comment/31575733
has comment: http://stackoverflow.com/comment/31574388
accepted answer: http://stackoverflow.com/a/21007182
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21019069
score: 1
tagged with: maven
upvote count: 1
tagged with: git
has comment: http://stackoverflow.com/comment/31586718
type: Question
has body: I tried my best to get a multi-module Maven project synced with GitHub using EGit, but I've failed. The structure of the project is like this: parent (pom) child-one (jar) child-two (jar) I tried this simple approach: Completely blank copy of Eclipse JDT and an empty workspace Create a new GitHub repository and initialize it with a README.md file Clone that repository to Eclipse Create the parent (pom) project Create two children (jar) projects, add simple main classes, everything works at this point Now comes the tricky part. Do I share just my parent project? Or children as well? Well, it seemed logical to me to share the parent only. However when I did, my build path went completely crazy and Eclipse could no longer find main classes. Then I restarted Eclipse. Issues persisted. Then I "disconnected" the project with the repository and logically EGit randomly deleted one of the children on the file system, and made the Eclipse project completely unusable (no classes would display, all structure was gone). I previosly had an episode where EGit randomly deleted one of my repositories and that time it wasn't just a test, it was my actual latest changes to the codebase. Is this plugging completely bugged out or am I missing something? (I followed the basic tutorial on setting it all up, and have my SSH keys configured properly.) What should I do to properly push a local Maven multi-module project to GitHub, and be able to clone it on a completely different PC out of nothing?
has title: How am I supposed to work with multi-module Maven projects with EGit?
tagged with: java
tagged with: egit
has comment: http://stackoverflow.com/comment/31572643
tagged with: eclipse
linked to: http://stackoverflow.com/q/15425640

http://stackoverflow.com/q/20856833
tagged with: apache-tomee
score: 0
has answer: http://stackoverflow.com/a/21284295
tagged with: jpa
tagged with: openejb
answer count: 1
has title: TomEE embedded configuration for test with HSQLDB setup
accepted answer: http://stackoverflow.com/a/21284295
type: AnsweredQuestion
tagged with: java
has body: I'm trying to override my Datasource configuration for unit tests as explained here : http://tomee.apache.org/embedded-configuration.html But I'm facing some WARNINGs and some properties are not taking into account properly : Infos - Cannot find the configuration file [conf/openejb.xml]. Will attempt to create one for the beans deployed. Infos - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service) Infos - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager) Infos - Configuring Service(id=customDS, type=Resource, provider-id=Default JDBC Database) Infos - Creating TransactionManager(id=Default Transaction Manager) Infos - Creating SecurityService(id=Default Security Service) Infos - Creating Resource(id=customDS) WARNING - Property "JdbcUsername " not supported by "customDS" WARNING - Property "JdbcPassword " not supported by "customDS" WARNING - Property "JdbcUrl " not supported by "customDS" WARNING - Property "JdbcDriver " not supported by "customDS" My custom DS is configured like this : Properties p = new Properties(); // Datasource p.put("customDS", "new://Resource?type=javax.sql.DataSource"); p.put("customDS.JdbcDriver ", "org.hsqldb.jdbc.JDBCDriver"); p.put("customDS.JdbcUrl ", "jdbc:hsqldb:file:target/custom"); p.put("customDS.JdbcUsername ", "sa"); p.put("customDS.JdbcPassword ", ""); // JPA p.put("javax.persistence.jtaDataSource", "openejb:Resource/customDS"); // EclipseLink p.put("competbet.eclipselink.target-database", "org.eclipse.persistence.platform.database.HSQLPlatform"); p.put("competbet.eclipselink.ddl-generation", "create-or-extend-tables"); context = EJBContainer.createEJBContainer(p).getContext(); The non test config works fine : &lt;resources&gt; &lt;Resource id="JTA_Datasource" type="javax.sql.DataSource"&gt; # http://tomee.apache.org/containers-and-resources.html # configure the pool DataSourceCreator = ${bd.datasourceCrea…
type: Question
tagged with: datasource

http://stackoverflow.com/comment/31392067
type: Comment
has text: @JonSkeet It holds boolean information, and a createRandom method that i call when normal mode starts. That method creates an int that either holds the value 0 or 1, which in turn sets the squares corresponding boolean values. The Square can be correct or incorrect.
comment on: http://stackoverflow.com/q/20911130
score: 0
type: QuestionComment

http://stackoverflow.com/q/20951027
has body: I understand that a Content Resolver accepts requests from clients, and resolves these requests by directing them to the Content Provider with a distinct authority. I was going through vogellas tutorial, specifically the queryCalendar method, and I noticed that there are no calls for Content Provider. I only see code for Content Resolver: ContentResolver cr = getContentResolver(); Why are there no calls for the Content Provider?
tagged with: android-contentresolver
score: 2
has title: Understanding content provider and resolver
has answer: http://stackoverflow.com/a/24192997
favorite count: 0
has answer: http://stackoverflow.com/a/20951147
upvote count: 2
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/37350028
tagged with: java
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/31472672
has text: it was just some dummy text rather than me copying the whole thing
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/20953335

http://stackoverflow.com/comment/31424466
has text: Account account = accountService.findById(item.getValue()); nobody told us, restrict that JList can be based on 2D array only
score: 0
comment on: http://stackoverflow.com/q/20928163
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31407224
comment on: http://stackoverflow.com/q/20919355
has text: Real device. It is working on lenovo Tab but to working on Zolo Android mobile.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/31685898
type: Answer
answers question: http://stackoverflow.com/q/20969513
upvote count: 3
score: 3
downvote count: 0
has body: First of all, check if your http server should be forwarding the headers. You you're using nginx, this should work proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; If you're already done that, you can accomplish that using Tomcat's RemoteIpValve &lt;Valve className="org.apache.catalina.valves.RemoteIpValve" remoteIpHeader="X-Forwarded-For" requestAttributesEnabled="true" internalProxies="127.0.0.1" /&gt; That way, when you call request.getRemoteAddr(), it will be providing the right information.

http://stackoverflow.com/q/20905219
type: Question
has answer: http://stackoverflow.com/a/20908887
has body: I am trying to run on Tomcat a Spring 3 + Struts 2 + Hibernate web app, but it fails to start with NullPointerException for autowired field. I have checked other similar questions but couldn't solve my problem. I am new to Spring and Struts. mvc-dispatcher-servlet.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd 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"> <context:component-scan base-package="com.se.pl.prm.controller" /> <mvc:annotation-driven /> /WEB-INF/pages/ .jsp </beans> applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:lang="http://www.springframework.org/schema/lang" xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd http://www.springframework.org/schema…
has answer: http://stackoverflow.com/a/20905388
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/31390617
has comment: http://stackoverflow.com/comment/31380032
has comment: http://stackoverflow.com/comment/31379843
accepted answer: http://stackoverflow.com/a/20908887
possible better answer: http://stackoverflow.com/a/20906326
has answer: http://stackoverflow.com/a/20906326
tagged with: spring
has title: Spring @Autowired field returns null
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/20931859
answer count: 2
tagged with: file-io
possible better answer: http://stackoverflow.com/a/20931932
tagged with: bufferedreader
has answer: http://stackoverflow.com/a/20931932
has answer: http://stackoverflow.com/a/20931939
accepted answer: http://stackoverflow.com/a/20931939
tagged with: dictionary
has comment: http://stackoverflow.com/comment/31431120
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31431163
tagged with: java
has title: Take Strings from Text file and assign each line to value (2 at a time and insert into LinkedHashMap)
has comment: http://stackoverflow.com/comment/31431117
has body: What I'm trying to do is, load a Text file, then take the values from each line and assign them to a variable in my program. Every two lines, I will insert them into a LinkedHashMap (As a pair) The problem with a buffered reader is, all I can seem to do is, read one line at a time. Here is my current code: public static void receiver(String firstArg) {// Receives // Input // File String cipherText; String key; String inFile = new File(firstArg).getAbsolutePath(); Path file = new File(inFile).toPath(); // File in = new File(inFile); try (InputStream in = Files.newInputStream(file); BufferedReader reader = new BufferedReader( new InputStreamReader(in))) { String line = null; while ((line = reader.readLine()) != null) { // System.out.println(line); String[] arrayLine = line.split("\n"); // here you are // splitting // with whitespace cipherText = arrayLine[0]; // key = arrayLine[1]; System.out.println(arrayLine[0] + " " + arrayLine[1]); cipherKeyPairs.put(arrayLine[0], arrayLine[1]); } } catch (IOException x) { System.err.println(x); } The problem is, it can't find the arrayLine[1] (for obvious reasons). I need it to read two lines at a time without the array going out of bounds. Any idea how to do this, so that I can store them into my LinkedHashMap, two lines at a time as separate values.
type: Question
has comment: http://stackoverflow.com/comment/31431126
has comment: http://stackoverflow.com/comment/31431146
has comment: http://stackoverflow.com/comment/31431175
has comment: http://stackoverflow.com/comment/31431139
score: 0

http://stackoverflow.com/comment/31443629
type: Comment
has text: @user3147325 that's exactly ths use case for a httpservlerwrapper. Overwrite the gatPathInfo method in the wrapper to return the pathinfo you need.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20937980

http://stackoverflow.com/comment/31584801
score: 0
type: QuestionComment
type: Comment
has text: disconnect() is in your finally statement which is outside catch statement. So need to handle MQException thrown by disconnect() as it is a cached exception. Signature of method is `public void disconnect() throws MQException`.
comment on: http://stackoverflow.com/q/21013531

http://stackoverflow.com/comment/31588091
type: Comment
type: QuestionComment
score: 2
has text: Chrome extensions such as `REST console` will do it. If you want to give simple access to non-techie users, you should think about providing them a web UI over your REST services.
comment on: http://stackoverflow.com/q/21013890

http://stackoverflow.com/q/20933454
has comment: http://stackoverflow.com/comment/31434002
linked to: http://stackoverflow.com/q/1732348
score: 0
answer count: 1
has body: I'm currently attempting to parse some HTML in Java using RegEx. On smaller test samples of the live code it works, but when trying it against the live code the regex engine breaks the stack. Here is the code and the RegEx I'm using. /** * RegEx Explanation: * "(?i)" - Turn on case insensitive mode * " .+? " - Match the format for a group name * "(?-i)" - Turn off case insensitive mode * "(.|\\r|\\n)" - Match all the text following the group name incl. newlines * "(?=((?i) .+? (?-i))" - and lookahead for the start of a new group, make the match lazy and use case-insensitive mode * "+?)" - Make the lookahead lazy, close out the capture group. */ Pattern filterPattern = Pattern.compile("(?i)( .+? )(?-i)(.|\\r|\\n)+?(?=((?i) .+? (?-i))+?)"); Matcher match = filterPattern.matcher(content); ArrayList<String> groups = new ArrayList<String>(); // Retrieve the matches found by the RegEx while(match.find()) { if(match.groupCount() > -1) { groups.add(match.group(0)); } } The live html is a board list (http://menu.2ch.net/bbsmenu.html), but the general format is: Group name Name of the board This is repeated a number of times with varying number of links. I avoided using a regular HTML parser like JSoup simply because the format was consistent and easier to target with RegEx in a first pass to extract the sections. The stack overflow occurs when I call group(). Other questions stated that this is due to the group() call in Java having no bounds on recursion depth so it'll run till it hits the stack limit. I'm not very good at RegEx, which may be why I'm missing a potentially easier expression. I suspect the recursion problem is occurring at the alternation (.|\r|\n), but it could be just as easily occurring due to too many groups. I don't know. Is there a better expression to avoid the catastrophic recurssion?
has comment: http://stackoverflow.com/comment/31433964
accepted answer: http://stackoverflow.com/a/20933832
has comment: http://stackoverflow.com/comment/31435406
tagged with: regex
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31435469
has comment: http://stackoverflow.com/comment/31433971
tagged with: java
has title: Java RegEx Group StackOverflow
has answer: http://stackoverflow.com/a/20933832
has comment: http://stackoverflow.com/comment/31435168
type: Question

http://stackoverflow.com/q/20960942
has answer: http://stackoverflow.com/a/20981245
has answer: http://stackoverflow.com/a/20961806
answer count: 3
tagged with: playframework
possible better answer: http://stackoverflow.com/a/20981245
has answer: http://stackoverflow.com/a/21053885
favorite count: 0
has body: I am trying to install Play, and have been going through the tutorial. I have also tried for a couple hours now reading through the installation guide. Yet, I cannot find what it is that I need to add to the environment variables in order to get this to Play to work. I also am a little confused on how javac is suppose to work with this, as my understanding through another video is that I needed to add a path to javac as well. There is also this question that asks a very similar question, but the terminology is above me, and I would like to not mess this up.
has title: Installing Play! framework on Windows 8.1: What do I add to the path?
tagged with: scala
tagged with: path
accepted answer: http://stackoverflow.com/a/20961806
score: 2
type: AnsweredQuestion
upvote count: 3
tagged with: java
linked to: http://stackoverflow.com/q/10573654
downvote count: 1
type: Question
tagged with: frameworks

http://stackoverflow.com/a/20859442
has body: Do you have to do it all in one line? Simple enough to break it down to pieces, like this for instance: public static void main(String[] args) { String test = "(1,2),(3,4),(5,6)"; String[] firstSplit = test.split("\\),\\("); for (String token : firstSplit) { token = token.replaceAll("[\\(\\)]*", ""); System.out.println(token); } }
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/20859278
downvote count: 0

http://stackoverflow.com/comment/44067448
type: Comment
type: QuestionComment
has text: One thing you probably have to do is to remove the reference to `com.caucho.filters.GzipFilter`. I believe that is part of Resin, not your webapp.
score: 1
comment on: http://stackoverflow.com/q/20971187

http://stackoverflow.com/q/20873523
has title: JAXB converts @XmlElementRefs and @XmlElements to xs:choice
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/20885857
has body: I have 4 classes. Person class, and abstract ContactInformation with Phone and Address class extending it. @XmlRootElement @XmlAccessorType(XmlAccessType.NONE) public class Person { @XmlElement(required = true, nillable = false) private String first; @XmlElement(required = true, nillable = false) private String last; @XmlElementWrapper(name = "contacts") @XmlElementRefs({ @XmlElementRef(name = "phone", type = Phone.class, required = true), @XmlElementRef(name = "address", type = Address.class, required = true) }) private final List<ContactInfomation> contacts = new ArrayList<>(); } ContactInformation is used only as container: public abstract class ContactInfomation { /* empty class */ } Phone class: @XmlRootElement @XmlAccessorType(XmlAccessType.NONE) public class Phone extends ContactInfomation { @XmlElement(required = true, nillable = false) private String number; } And Address class: @XmlRootElement @XmlAccessorType(XmlAccessType.NONE) public class Address extends ContactInfomation { @XmlElement(required = true, nillable = false) private String country; @XmlElement(required = true, nillable = false) private String city; } The problem is when I change @XmlElementrefs to @XmlElements in Person class, nothing happens. JAXB maps them to xs:choice. The XML output is same as before and schemagen generates the same schema as before. Here is a sample output: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> majid azimi US Los Angles US New York 5551037 And here is the schema: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="address" type="address"/> <xs:element name="person" type="person"/> <xs:element name="phone" type="phone"/> <xs:complexType name="person"> <xs:sequence> <xs:element name="first" type="xs:string"/> <xs:element name="last" type="xs:string"/> <xs:element name="contacts" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:choice minOccurs="0" maxOccurs="unb…
upvote count: 7
answer count: 1
tagged with: java
tagged with: jaxb
accepted answer: http://stackoverflow.com/a/20885857
type: AnsweredQuestion
downvote count: 0
score: 7
favorite count: 0
type: Question

http://stackoverflow.com/comment/31531795
type: AnswerComment
score: 0
type: Comment
has text: Wait... what? No - what do you mean?
comment on: http://stackoverflow.com/a/20984597

http://stackoverflow.com/comment/31480027
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20957407
has text: Every implementation for SET has different purposes and pros/cons. If your starting with HashSet it means you want a list of Unique Values. If you want a HashMap it means you want key/value pairs. And a TreeMap means you want your key/value pairs to be ordered by Key. Each Data Structure has a specific purpose.
type: Comment

http://stackoverflow.com/comment/31544222
type: AnswerComment
type: Comment
has text: Yeah, it's the same in my case. But I want that the desktopPane to be transparent, not to be filled in that grey/blue color. Is possible? Thank you.
comment on: http://stackoverflow.com/a/20990385
score: 0

http://stackoverflow.com/comment/31534410
type: Comment
type: QuestionComment
has text: I edited my post to place exv.setAdapter(new MyAdapter(context)); in dbVersion.java, and I also added the LogCat that has some useful info. Thank you once again for your help!
comment on: http://stackoverflow.com/q/20983559
score: 0

http://stackoverflow.com/a/43676588
downvote count: 0
score: 5
has body: I had the same Error today. Then I performed a Clean on Tomcat Server, which told me there are several Maven POMs missing. So I performed a Maven Update Project (Eclipse: Right Click on Project -> Maven -> Update Projects.. -> Select your needed Projects). This solves the Problem for me.
has comment: http://stackoverflow.com/comment/91707976
type: Answer
answers question: http://stackoverflow.com/q/20854848
upvote count: 5

http://stackoverflow.com/comment/31485799
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20959453
has text: my mistake.. I accidentally left out what I have tried so far...I have tried to replace what I have in the action field with..."Hello" even tried to put https://www.google.com and it still didnt work.. on eclipse when I would do this.. fill the form out, submit it, it should go onto the next page/servlet or whatever you say it should go to.. works on eclipse.. but not when I deploy and run it from tomcat(terminal)
score: 0

http://stackoverflow.com/q/21008641
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31577509
tagged with: ssl
accepted answer: http://stackoverflow.com/a/21017907
downvote count: 0
answer count: 1
favorite count: 0
has title: SSL Elasticsearch
tagged with: elasticsearch
has body: I have an es_client (java/dropwizard) application. It communicates with the elastic search just fine over plain text connection. I have followed the instructions at https://github.com/sonian/elasticsearch-jetty to set up SSL for es client. However when I start my es_client it reports every 5 seconds the following: INFO [2014-01-08 23:02:14,814] org.elasticsearch.client.transport: [Karolina Dean] failed to get node info for [#transport#-1][inet[localhost/127.0.0.1:9443]], disconnecting... ! org.elasticsearch.transport.NodeDisconnectedException: [][inet[localhost/127.0.0.1:9443]][cluster/nodes/info] disconnected How can I go about figuring this one out? Thanks, Maciej
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/21017907
type: Question

http://stackoverflow.com/a/20953807
type: Answer
score: 2
has body: In your function radixSort you have defined array of size 10 holds 10 "empty slots", but you forgot to initialize all of the slots. The change in your code will be like the following: public static void radixSort(int[] numbers) { Queue[] queues = new Queue[10]; Arrays.fill(queues, new Queue()); // Queue is interface you need to implement it // or you need to choose specific type of // queues [PriorityQueue, LinkedBlockingQueue, ...] for(int i = 0; i &lt; numbers.length; i++) { if(numbers[i] % 10 == i) { queues[i].insert(numbers[i]); System.out.println(queues[i]); } } }
upvote count: 2
has comment: http://stackoverflow.com/comment/31472347
downvote count: 0
answers question: http://stackoverflow.com/q/20953563

http://stackoverflow.com/comment/31507204
comment on: http://stackoverflow.com/q/20972176
score: 0
type: Comment
type: QuestionComment
has text: @ParkashKumar Not helping. It's just not so easy, not at all. It is not nearly detailed enough, and this is not the only problem I've had. Aparently I can't even mix BuffereReader and ObjectInputStream: http://stackoverflow.com/questions/6315247/java-io-streamcorruptedexception-invalid-stream-header-75720002

http://stackoverflow.com/a/20856184
answers question: http://stackoverflow.com/q/20855811
type: Answer
has body: The code from the link does not show the buildShortArray method. You need to transform List&lt;Short&gt; into array short[]: List&lt;Short&gt; music1 = ...; short[] arrayMusic1 = buildShortArray(music1); You could write the method buildShortArray like this: public short[] buildShortArray(List&lt;Short&gt; list) { short[] array = new short[list.size()]; for(int i = 0; i &lt; list.size(); i++) { array[i] = list.get(i); } return array; } However, i'd like to warn you, copy-pasting code is never a good idea.
score: 0
accepted answer of: http://stackoverflow.com/q/20855811
type: AcceptedAnswer

http://stackoverflow.com/comment/31366368
type: AnswerComment
comment on: http://stackoverflow.com/a/20897781
type: Comment
has text: doc.setCharacterAttributes(selectionStart,selectionEnd-selectionStart+1, asNew, true); will remove all the rest styles as well. So if you remove bold the italick will be removed also.
score: 1

http://stackoverflow.com/a/20999219
has comment: http://stackoverflow.com/comment/31557552
score: 4
has comment: http://stackoverflow.com/comment/31558425
accepted answer of: http://stackoverflow.com/q/20998026
has comment: http://stackoverflow.com/comment/31557150
answers question: http://stackoverflow.com/q/20998026
has body: Like this: &lt;p:column id="col1"&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="Your Label" id="hLabel" /&gt; &lt;p:contextMenu for="hLabel" style="font-size:11px!important; text-align:left!important; margin-left: 0px!important;"&gt; &lt;c:forEach items="#{dyna.columnnameslist}" var="ccm"&gt; &lt;p:menuitem value="#{ccm}"/&gt; &lt;/c:forEach&gt; &lt;/p:contextMenu&gt; &lt;/f:facet&gt; &lt;p:column&gt;
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31557074
type: Answer

http://stackoverflow.com/comment/31465664
type: AnswerComment
has text: I don't think that this is a solution because i do not bind to any service from my app. At list i didn't write the code to do this. The binding might be proceeded in some of the libs which i use, but they are all jar files. I have no idea how to open them. PS: However thanks for the answer. And i wish you a happy new year too.
comment on: http://stackoverflow.com/a/20947366
type: Comment
score: 0

http://stackoverflow.com/q/20955595
upvote count: 4
has comment: http://stackoverflow.com/comment/31476775
tagged with: apache-poi
has title: Excel formula not updating on row delete from java application using Apache POI
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31476708
tagged with: excel
tagged with: java
has comment: http://stackoverflow.com/comment/31478494
score: 4
has body: I'm using Apache POI in my application to write data to an excel file. I've an excel file template and a few formulas are also there in it. In my application, i use the excel template, write into it ,then delete unused rows and calculate formulas in the end. I'm using SUM formula in the file. The problem is when rows are deleted, the SUM formula is not updating,due to which error values are coming up in excel. Example : the formula being used is : for cell B215 : SUM(B15:B214). in the application,after writing to the file i delete unused rows. now I've data till 70th row in the file.All other rows have been deleted. So my formula should get updated to : SUM(B15:B69) for cell B70. But in the file it's still showing the formula as SUM(B15:B214). Hence the value of that cell is "VALUE# Code snippet : File file = new File(path) InputStream is = new FileInputStream(file) POIFSFileSystem fs = new POIFSFileSystem(is) HSSFWorkbook wb = new HSSFWorkbook(fs) HSSFSheet excelSheet int[] indexArray = populateSheet(excelSheet) //indexArray is array with 3 values as startrow, lastrow, and first empty row. removeBlankRows(excelSheet,indexArray) //evaluate formula FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator() for(HSSFRow r : excelSheet) { for(HSSFCell c : r) { if(c.getCellType() == Cell.CELL_TYPE_FORMULA) { String formula = c.getCellFormula(); evaluator.evaluateFormulaCell(c) } } } private void removeBlankRows(HSSFSheet sheet, int[] shiftInfo){ for(int i = shiftInfo[2]; i &lt;= shiftInfo[1]; ++i) { sheet.removeRow(sheet.getRow(i)) } //Shift up the rows def startRow = shiftInfo[1]+1 def endRow = sheet.getLastRowNum() def rowCount = -1* (shiftInfo[1] - shiftInfo[2] + 1) sheet.shiftRows(startRow, endRow, rowCount) }
type: Question
has answer: http://stackoverflow.com/a/21635189
has comment: http://stackoverflow.com/comment/31477170
answer count: 1
favorite count: 0
tagged with: excel-formula

http://stackoverflow.com/comment/31444358
type: AnswerComment
has text: Unfortunately I used this query before but also doesn't work. I tried to set the table schema in db2 to be "db2admin" using query and check current schema using a query. it changed. After that if I browse the table schema its the same "yasmin" doesn't change.
type: Comment
comment on: http://stackoverflow.com/a/20925956
score: 0

http://stackoverflow.com/comment/31503959
has text: ... your ... your coding formatting ... the horror ....
comment on: http://stackoverflow.com/q/20970565
type: Comment
type: QuestionComment
score: 6

http://stackoverflow.com/comment/31796229
type: Comment
has text: I know the basics about drawing Connections, the same examples are there on above blog. But the question asked above is somewhat tricky. I am stuck at that point. Anyway, thanks for your suggestion.
comment on: http://stackoverflow.com/a/21074051
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31342015
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20884369
type: Comment
has text: Okay, thank you. I will have to research the idea of composition then, and then find a way to use it in my program. Thanks for pointing me in the right direction!

http://stackoverflow.com/comment/31376693
score: 0
type: Comment
has text: @RossC I am learning the basics,through video tutorials of mybringback.com (is it good?).Yeah,you're right but the documentation is bit boring and the words used to explain things there are too complicated,for me. I don't know what to do?
type: QuestionComment
comment on: http://stackoverflow.com/q/20903401

http://stackoverflow.com/comment/31356711
comment on: http://stackoverflow.com/q/20878854
has text: Can you post your connection string without your server's ip and username/pass and the method which queries the database?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20963970
type: Question
has comment: http://stackoverflow.com/comment/31642480
has answer: http://stackoverflow.com/a/28676288
has body: I'm attempting to implement a simple Grizzly web server that, upon receipt of an HTTP request, will: Process the specified filters Echo the request back to the sender I am submitting the request from soapUI and seeing behavior that I don't expect: RunServer.java: public class RunServer{ public static final String HOST = "localhost"; public static final int PORT = 5151; public static void main(String[] args) { final HttpServer server = HttpServer.createSimpleServer(); NetworkListener listener = new NetworkListener("echoCalls", "localhost", 5151); FilterChainBuilder filterChainBuilder = FilterChainBuilder.stateless(); filterChainBuilder.add(new TransportFilter()); filterChainBuilder.add(new StringFilter(Charset.forName("UTF-8"))); //filterChainBuilder.add(new StringFilter(Charset.forName("ISO-8859-1"))); //filterChainBuilder.add(new StringFilter(Charset.forName("ASCII"))); filterChainBuilder.add(new MyEchoFilter()); listener.setFilterChain(filterChainBuilder.build()); server.addListener(listener); server.getServerConfiguration().addHttpHandler(new MyEchoHandler(), "/echo"); try{ server.start(); System.out.println("Press any key to stop the server..."); System.in.read(); }catch(IOException ioe){ System.err.println(ioe.toString()); }finally{ server.stop(); } } } MyEchoFilter.java: public class MyEchoFilter extends BaseFilter{ public NextAction handleRead(FilterChainContext ctx)throws IOException{ System.err.println("&gt;&gt;&gt;MyEchoFilter.handleRead()..."); //|why not working? no response, eventual time out. soapui just hangs up after return NextAction... final Object peerAddress = ctx.getAddress(); final Object message = ctx.getMessage(); ctx.write(peerAddress, message, null); return ctx.getStopAction(); } public NextAction handleWrite(FilterChainContext ctx) throws IOException{ System.err.println("&gt;&gt;&gt;MyEchoFilter.handleWrite()..."); return ctx.getStopAction(); } public NextAction handleConnect(FilterChainContext ctx) throws IOException{ System.err.println("…
tagged with: servlets
answer count: 2
has answer: http://stackoverflow.com/a/21051757
downvote count: 0
favorite count: 0
has title: Grizzly 2.2.19 FilterChain vs HttpHandler
tagged with: soapui
has comment: http://stackoverflow.com/comment/31520677
type: UnansweredQuestion
tagged with: grizzly
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/48199946
type: AnswerComment
comment on: http://stackoverflow.com/a/20990321
type: Comment
has text: Provided link is broken
score: 0

http://stackoverflow.com/comment/57697700
score: 0
comment on: http://stackoverflow.com/a/20900801
type: Comment
has text: One case may occurs, if it downloads the file from remote server, so the xsd always be the latest version, so if a element be defined in the latest version but not the version which our project used(lower version), what will happened? The xml processor loads the xsd from the local jar, and can't recognize the element definition.
type: AnswerComment

http://stackoverflow.com/comment/31561448
type: QuestionComment
has text: I kind of need guidance, a place to start from. I have absolutely no idea how to do this.
comment on: http://stackoverflow.com/q/21001618
score: 0
type: Comment

http://stackoverflow.com/q/20956566
has comment: http://stackoverflow.com/comment/31477679
type: Question
score: 0
tagged with: jdbc
has body: I save stock data in a mySql table @ frame 1 minute, so that 1 row is 1 minute data. Data saved are as follow Since market session ranges from 0900 up to 1730, I have 511 rows for each day. I need to compress (aggregate) these intra-day data into 1 daily data (one row only), so that daily open -> first intra-day open value (0900 open value) daily high -> highest value for all 511 intra-day value rows daily low -> lowest value for all 511 intra-day value rows daily close -> latest intra-day traded value (1730 close value) daily volume -> sum of all 511 intra-day volume value rows I need to perform this compression as fast as possibile since I would plot hundreds of daily data. Any help really appreciated: here is my full code import importexportdata.DataItem; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.LinkedList; import java.util.logging.Level; import java.util.logging.Logger; public class AggregateByDay { String dbTabName = ""; String sTimeFrom = ""; String sTimeTo = ""; short iTotBar = 0; boolean volumeFieldIsOnTable; LinkedList&lt;DataItem&gt; data_aggregated = null; Dividends dividendsHdl = null; Connection con = null; ResultSet rs = null; Statement st = null; PreparedStatement selectReview=null; Statement stmtPrepareInitRow=null; ResultSet rsSelectPrepareInitRow = null; public AggregateByDay(String dbTabName, String timeFrom, String timeTo, short iTotBar, boolean volumeFieldIsOnTable, Dividends dividendsHdl){ this.dbTabName = dbTabName; this.sTimeFrom = timeFrom; this.sTimeTo = timeTo; this.iTotBar = iTotBar; this.volumeFieldIsOnTable = volumeFieldIsOnTable; this.dividendsHdl = dividendsHdl; } private void connectToDb(){ try { Class.forName("com.mysql.jdbc.Driver"); //String connectionUrl = "…
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31477611
has comment: http://stackoverflow.com/comment/31477738
has comment: http://stackoverflow.com/comment/31477670
tagged with: java
tagged with: mysql
has title: How to compress (aggregate) data as fast as possible?

http://stackoverflow.com/q/20933367
answer count: 1
tagged with: matlab
has comment: http://stackoverflow.com/comment/31437476
tagged with: java
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31434922
tagged with: arrays
tagged with: jar
has answer: http://stackoverflow.com/a/20971114
accepted answer: http://stackoverflow.com/a/20971114
has title: Easiest way to load user-specified double[][] array into java program?
type: Question
has comment: http://stackoverflow.com/comment/31433891
tagged with: input
has comment: http://stackoverflow.com/comment/31434700
has comment: http://stackoverflow.com/comment/31434857
has body: I am creating a program in java that ned to take in a double[][] array that will be specified by the user. The java program will be executed from MATLAB, where it is fairly easy to create a large array fast. Hence, the example of my program would be something like this: First create some array in MATLAB: T = 1:5:200; Y = sin(T); X = [T,Y]; Next is to start the java program from matlab: system('java -jar jarname.jar') Then my challenge comes. I need to load the matrix X into the Java program upon execution, since I need this data to make the computation. What do you recon is the best/easiest/least computative method to load this array into my program? Thanks in advance!
has comment: http://stackoverflow.com/comment/31435464
linked to: http://stackoverflow.com/q/11255627
score: 0

http://stackoverflow.com/comment/31566369
type: AnswerComment
type: Comment
has text: That would be too cumbersome as I have many properties I have model classes on server and in android app so converting these model objects using gson both on server as well as android app
comment on: http://stackoverflow.com/a/21003773
score: 0

http://stackoverflow.com/a/20868993
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20861752
type: Answer
has body: Since nobody gave me an answer to my question (although they all of you did provide useful info and i think you for that) I will post the solution i found (but have not yet implemented) I am using libgdx to create my applications so after looking and searching for a way to have eclipse automatically include libs when generating an android project, i realized that the answer was obvious (but not easy to do)... i downloaded the libgdx source from github, learned how to use command line git and ant, and followed their instructions to get the source running. i now have the setup ui project working out of source. and am beginning my day by trying to get the libs i use included in the setup... i know its possible and will edit this post with information on if/how i managed to accomplish this lofty goal

aggregate
tags question: http://stackoverflow.com/q/20904065
tag name: aggregate
type: Tag

http://stackoverflow.com/comment/31592252
has text: For one thing, Java only uses milliseconds as timestamps; most DBs default to nanoseconds (or only seconds) - having mismatches between app/db is a good way to lose something. Limiting your DB to id's by timestamp is a good way to limit your db throughput, if you get a lot of requests suddenly. Use timestamps to record date/time information. Use an id (usually integer) for uniquely identifying rows.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21017616

http://stackoverflow.com/comment/32068898
has text: this isn't true, Runnable hasn't any issue, nor described in your comment, this description talking about why don't to use SwingWorker (has long and large buggy history, and quite often repeating), nor for production code, sure everything is up to you, Runnable is best of choices for FileIO, XxxStream, Socket, JDBC
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21016898
type: Comment

http://stackoverflow.com/comment/31366452
comment on: http://stackoverflow.com/a/20897811
score: 0
type: AnswerComment
type: Comment
has text: @JqueryLearner I don't care. You also pasted all of his code back for no reason, still with two errors, which I have mentioned in my edit.

client-server
tags question: http://stackoverflow.com/q/20981455
type: Tag
tags question: http://stackoverflow.com/q/20937040
tags question: http://stackoverflow.com/q/20942863
tag name: client-server
tags question: http://stackoverflow.com/q/20879673
tags question: http://stackoverflow.com/q/20942821

http://stackoverflow.com/comment/37410416
score: 0
comment on: http://stackoverflow.com/q/20986661
has text: Agree with Ved... Whoever is implementing this WSDL has either not implemented certain features or the namespace is pointing to a WSDL declaration which does not include the function. Personally, I'm a bit taken aback by this ONVIF choice of WSDL.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20993977
score: 1
has body: In basic terms, Garbage Collection works by walking the object graphs from a number of predefined roots. Anything not accessible from those roots is garbage, therefore one object referencing another is irrelevant unless either can be accessed from one or more roots. It's all explained in more detail in How Garbage Collection Really Works.
upvote count: 1
answers question: http://stackoverflow.com/q/20993746
type: Answer
downvote count: 0

http://stackoverflow.com/comment/31366429
comment on: http://stackoverflow.com/q/20896386
score: 0
has text: why do you want to create new table for new connection ? ,why not add as new row ..
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31379653
score: 0
type: Comment
type: QuestionComment
has text: @mKorbel, are you reffering to what I asked MadProgrammer? (just making sure)
comment on: http://stackoverflow.com/q/20902662

http://stackoverflow.com/comment/31521432
comment on: http://stackoverflow.com/a/20978541
type: AnswerComment
score: 0
type: Comment
has text: Eclipse doesn't know. Serializability is only detected at runtime when you try it. What syntax or semantic rule exactly do you think eclipse should have warned about?

http://stackoverflow.com/q/20908987
tagged with: illegalargumentexception
score: 0
has comment: http://stackoverflow.com/comment/31387325
answer count: 1
has answer: http://stackoverflow.com/a/20912634
type: UnansweredQuestion
tagged with: java
tagged with: bufferedimage
type: Question
has title: Trying to Draw a 24bit image in Java
has body: I have an image that where each pixel is 4 byte i.e. red mask is 0xFF0000 green is 0xFF00 and blue 0xFF. I read in the image and pass it to a function as function(byte imgBuff,int w,int h) I then have void fun(byte imgBuff,int w,int h) { Graphics g; BufferedImage img; DataBuffer dBuffer = new DataBufferByte(imgBuff, w * h); WritableRaster wr = Raster.createPackedRaster(dBuffer,w,h,24,null); DirectColorModel dcm = new DirectColorModel(24,0xFF0000,0xFF00,0xFF); img = new BufferedImage(dcm,wr,false,null); g = getGraphics(); g.drawImage(img,x,y,w,h,null); } But when I run I get Exception in thread "Thread-23" java.lang.IllegalArgumentException: Raster sun.awt.image.SunWritableRaster@1d82ed7 is incompatible with ColorModel DirectColorModel: rmask=ff0000 gmask=ff00 bmask=ff amask=0 How do I go from bytebuffer via PackedRaster to Buffered Image for 24bit over four bytes

http://stackoverflow.com/q/20999071
has answer: http://stackoverflow.com/a/20999131
tagged with: java
has comment: http://stackoverflow.com/comment/31565304
has answer: http://stackoverflow.com/a/20999172
score: -1
has comment: http://stackoverflow.com/comment/31556634
type: Question
downvote count: 2
has comment: http://stackoverflow.com/comment/31556683
has answer: http://stackoverflow.com/a/20999147
has comment: http://stackoverflow.com/comment/31556440
answer count: 3
upvote count: 1
has title: How to set value to label/text
has body: I'm trying to do basic calculation for a program and I want the output to be in the label and some in text boxes, how do I do that?? parts of the code are as below. There are other things that add to the quantity but I only show this one. int quantity = 0; int sum = 0; if(jToggleButton3.isSelected()) { quantity = quantity + 1; } sum = quantity; quantityLabel = quantity; sumLabel = sum; I want the quantity and sum to be output both in labels, how can I do that?? In vb it's like lblquantity.text = quantity; but here I have no idea and I can't find any links that teach this(Also what is the proper naming convention) Edit: Thanks a lot guys, got it working !
favorite count: 0
tagged with: jlabel
type: UnansweredQuestion
tagged with: swing

http://stackoverflow.com/comment/31394311
has text: Yes, it is an IBM mainframe. I don't have much info on the REST service, other than the fact that it is not written in Java. And I am running a jar from the java command line from z/OS shell. There is a non-https endpoint as well (which works just fine) but before moving my project to production, I need to start using the https endpoint.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20912282
score: 0

http://stackoverflow.com/comment/31544757
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20992496
has text: My project is at a stage where I cannot revert back, it means a lot of rework, also I am working in a platform where use of Joda is not suggested(mobile).

http://stackoverflow.com/a/20882754
score: 0
has body: ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); list.add("xxx"); Object[] array = list.toArray(); for (int i = 0; i &lt; array.length; i++) { System.out.println(" value = " + array[i].toString()); }
type: Answer
answers question: http://stackoverflow.com/q/20876580

http://stackoverflow.com/q/20935904
has answer: http://stackoverflow.com/a/21071354
upvote count: 13
has comment: http://stackoverflow.com/comment/31540155
has comment: http://stackoverflow.com/comment/31440861
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
accepted answer: http://stackoverflow.com/a/20991394
type: Question
has body: So I've come to a point where I need to implement an SQLite database for my app. Following "The Busy Coder's guide to Android Development" I have created a DatabaseHelper class that extends SQLiteOpenHelper. One of my use cases is to run a query against the database and display the results on a ListView within a Fragment (I use fragments from the support library). From what I understand, using managedQuery() is not really appropriate and even if it were it isn't recommended due to the fact that some of the logic encapsulated inside this method is actually executed on the main thread, specifically reQuery() which to my understanding is performed when the Activity is restarted. So I've been trying to get acquainted with the Loader class for the first time, only to see this: "The only supplied concrete implementation of a Loader is CursorLoader, and that is only for use with a ContentProvider" My initial thought was to implement my own content provider and perhaps prevent other apps from getting access to it, then I read the following in the ContentProvider documentation via developer.android.com: "You don't need a provider to use an SQLite database if the use is entirely within your own application." I've also been playing with this: https://github.com/commonsguy/cwac-loaderex Yet I am not familiar with this project, and not sure if it can be used on a production environment. So, right now all I can think of is creating a bunch of AsyncTask instances within my Fragment and manage their lifecycle appropriately, make sure they're cancelled whenever needed and whatnot. Are there any other options?
has answer: http://stackoverflow.com/a/21018744
has title: Android: Fragments, SQLite and Loaders
tagged with: sqlite
downvote count: 0
possible better answer: http://stackoverflow.com/a/20990556
has answer: http://stackoverflow.com/a/20997929
favorite count: 0
has answer: http://stackoverflow.com/a/20990556
answer count: 5
tagged with: android
has comment: http://stackoverflow.com/comment/31546782
has answer: http://stackoverflow.com/a/20991394
score: 13

http://stackoverflow.com/comment/31469784
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/20952200
type: Comment
has text: Agree with (and upvoted) @janos. "mvn eclipse:eclipse" and "mvn eclipse:clean" make it significantly easier.

http://stackoverflow.com/q/21010003
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/92251500
type: Question
has comment: http://stackoverflow.com/comment/31578856
answer count: 2
has title: Is there a good XML parser for light-scanning an XML file to get the byte offsets of elements?
has comment: http://stackoverflow.com/comment/92215794
downvote count: 0
has comment: http://stackoverflow.com/comment/31577888
has answer: http://stackoverflow.com/a/21010277
has comment: http://stackoverflow.com/comment/55952165
tagged with: stax
linked to: http://stackoverflow.com/q/43366566
has comment: http://stackoverflow.com/comment/31577880
has comment: http://stackoverflow.com/comment/92217203
has comment: http://stackoverflow.com/comment/92314284
favorite count: 0
tagged with: parsing
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/55863316
has comment: http://stackoverflow.com/comment/74974728
has answer: http://stackoverflow.com/a/52641473
type: UnansweredQuestion
upvote count: 7
has body: We have a system where we're processing XML files where the file itself is too large to fit in memory. As part of processing, we want to quickly scan through to record the offset of relevant elements, so that later on, we can seek immediately to those elements and parse just the piece we want (since the smaller slice of the file would fit in memory, we can afford to use a DOM or whatever for that part.) Obviously we could just write our own XML parser from scratch, but before making yet another XML parser, I wanted to see if there were any other options available. What follows is a list of the things we already know about. Using StAX should work, but doesn't. Here's a demonstration of that. I made an XML example where there are characters longer than one byte to demonstrate that the returned byte offset is not correct once you start passing these characters. Note that even though the method in the API is called getCharacterOffset(), the documentation says that it returns the byte offset if you passed in a byte stream - which is what this code is doing. @Test public void testByteOffsetsFromStreamParser() throws Exception { // byte counts are size required for UTF-8, I checked using Ishida's tool. String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" " \n" " \u305A\u308C\u306A\u3044\u3067\u307B\u3057\u3044 \n" + " \u305A\u308C\u306A\u3044\u3067\u307B\u3057\u3044 \n" + " \u305A\u308C\u306A\u3044\u3067\u307B\u3057\u3044 \n" + " \n"; byte[] xmlBytes = xml.getBytes("UTF-8"); assertThat(xmlBytes.length, is(equalTo(171))); // = 171 from above String implToTest = "com.sun.xml.internal.stream.XMLInputFactoryImpl"; //String implToTest = "com.ctc.wstx.stax.WstxInputFactory"; XMLInputFactory factory = Class.forName(implToTest).asSubclass(XMLInputFactory.class).newInstance(); factory.setProperty("javax.xml.stream.isCoalescing", false); factory.setProperty("javax.xml.stream.supportDTD", false); XMLEventReader reader = factory.createXMLEventReader( new ByteArrayInputStream(xm…
has comment: http://stackoverflow.com/comment/92243757

http://stackoverflow.com/comment/37686062
type: Comment
comment on: http://stackoverflow.com/a/23630457
type: AnswerComment
has text: Yes, you're right ! I've edited againg and put same implementation I'm using in my codebase
score: 0

http://stackoverflow.com/comment/31480040
type: Comment
comment on: http://stackoverflow.com/a/20957551
score: 0
type: AnswerComment
has text: I am novice in Guava. I am investigating this tool

http://stackoverflow.com/comment/31397900
score: 0
type: Comment
has text: [evil](http://www.emacswiki.org/emacs/Evil) is a Vim emulation layer which can emulate Vim's `gd` or "Goto Gefinition" command (line 2326 of evil-commands.el). Unfortunately, you'll enable vim emulation if you use it. It works very well, and since I love vim keybindings, I use it happily. However, many emacs users consider `evil` just that: a horrible compromise with the enemy :).
comment on: http://stackoverflow.com/a/20913196
type: AnswerComment

http://stackoverflow.com/comment/31401806
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20916071
has text: I think you could define a function that produces intervals out of streamed data. If you deal with anything that is expressed in minutes, seconds, hours you can convert date to these units and then split. If you deal with days, weeks, etc then you would have to extract those units using something like JodaTime. Leap seconds perhaps can be ignored.
score: 0

http://stackoverflow.com/a/20913992
has comment: http://stackoverflow.com/comment/31403630
accepted answer of: http://stackoverflow.com/q/20913711
upvote count: 2
answers question: http://stackoverflow.com/q/20913711
type: AcceptedAnswer
has body: You are "shadowing" the pw variable inside of your openPrintWriterStream() method by providing a parameter with the same name - pw - as a field in the class. See http://docs.oracle.com/javase/tutorial/java/javaOO/arguments.html, the "Parameter Names" section: A parameter can have the same name as one of the class's fields. If this is the case, the parameter is said to shadow the field. Shadowing fields can make your code difficult to read and is conventionally used only within constructors and methods that set a particular field. There are several approaches to fix this: As matt forsythe suggests, quit passing the PrintWriter as an argument to openPrintWriterStream(), and then lazily construct it only if it is null. Initialize the PrintWriter in the DDHLogger(String filePath, String yourfilename) constructor, since you have all the information you need there to construct the PrintWriter, like the code sample below. The second approach allows you to clean up your code somewhat by removing all the calls to openPrintWriterStream(pw). public DDHLogger(String filePath, String yourfilename) { System.out.println("filePath: " + filePath); System.out.println("yourfilename: " + yourfilename); //String fileName = "C:\\Users\\home-1\\Desktop\\" + yourfilename; String fileName = filePath + yourfilename; System.out.println("fileName::--&gt; " + fileName); // file = new File(fileName);//Creates the file file = new File(fileName);//Creates the file System.out.println("file: " + file); try { fw = new FileWriter(file, true); //INSTANTIATE PRINTWRITER HERE pw = new PrintWriter(fw); } catch (IOException e) { e.printStackTrace(); }//allows append to the file without over writing. The TRUE keyword is used for append } Finally, remove the DDHLogger() or make it it private, since classes in the same package can still use it to create DDHLoggers without the required File and FileWriter, potentially causing NullPointerExceptions in the future.
has comment: http://stackoverflow.com/comment/31399026
type: Answer
has comment: http://stackoverflow.com/comment/31398308
score: 2
downvote count: 0

http://stackoverflow.com/q/20885361
tagged with: struts2
score: 0
has body: I have a dynamic web application using struts2 that works perfectly. I have a JDBC application that works perfectly (all it does is print a table out in the console). After I put the two together all that was left was to add authentication to the run configuration and I'd be done... I've already put the sqljdbc_auth.dll to the WEB-INF/lib I've tried to add this line to Tomcat v7.0 Server at localhost -Djava.library.path="C:\Program Files (x86)\jdbc\sqljdbc_4.0\enu\auth\x86" but it doesn't do anything This driver is not configured for integrated authentication. ClientConnectionId:6495... It's the line that got my JDBC application working just fine. Would there be some syntax error I'm missing or another method for me to pass an argument that I'm not aware of?
has comment: http://stackoverflow.com/comment/31619891
answer count: 1
has title: using JDBC within dynamic web application
tagged with: jdbc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20885607
accepted answer: http://stackoverflow.com/a/20885607
tagged with: java
tagged with: web-applications
type: Question

http://stackoverflow.com/q/20967823
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/31498958
score: -1
has comment: http://stackoverflow.com/comment/31499375
tagged with: jtable
has title: After adding a column another column hides in my table
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/31515472
favorite count: 0
has comment: http://stackoverflow.com/comment/31499263
has body: I have a table which contains number of columns. I added a column of CheckBox components by createCell method. that added column should be the first column (the column of index 0). My problem simply when I run the code the that previously first column (Student-Number) is not displayed . It seems to me the added column covered the next column. How to solve this problem please? TableModel model = new DefaultTableModel( new String[] {"Student-Number","Student-name","Degree"} ,ob) { public boolean isCellEditable(int row, int col) { return true; } }; Table table = new Table(model,true) { protected Component createCell(Object value, final int row, final int column, boolean editable) { if (column == 0) { CheckBox cod= new CheckBox ("cod"); return cod; } return super.createCell(value, row, column, editable); } } ;
has answer: http://stackoverflow.com/a/20971463
tagged with: lwuit
has comment: http://stackoverflow.com/comment/31499606
tagged with: tablemodel
upvote count: 0
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/33867890
type: Comment
type: QuestionComment
has text: I'm just going to leave both [java] and [javascript] in the question until you figure out which language you're using... please retag it accordingly.
comment on: http://stackoverflow.com/q/21013550
score: 0

http://stackoverflow.com/comment/31352789
type: Comment
has text: @Laurence Can U explain in terms of code
score: 0
comment on: http://stackoverflow.com/q/20890483
type: QuestionComment

http://stackoverflow.com/comment/31383974
has text: @PaulHarris +1 for using a service. Using a trusted service is better than storing it on the server, IMO. It simplifies the application -- only the client is concerned with time storage/access as opposed to both client and server.
type: Comment
comment on: http://stackoverflow.com/a/20906611
type: AnswerComment
score: 0

http://stackoverflow.com/a/20940423
upvote count: 1
has comment: http://stackoverflow.com/comment/31448926
has comment: http://stackoverflow.com/comment/31448480
type: Answer
answers question: http://stackoverflow.com/q/20940398
has comment: http://stackoverflow.com/comment/31448461
has comment: http://stackoverflow.com/comment/31448537
has comment: http://stackoverflow.com/comment/31447947
downvote count: 0
has comment: http://stackoverflow.com/comment/31448404
has comment: http://stackoverflow.com/comment/31448280
has body: Use a TreeMap to store the Pilot with their flying hours, then Java automatically sorts it for you based on the value (make that the hours). Set Up A HashTree public static Map&lt;String, Integer&gt; pilots = new TreeMap&lt;String, Integer&gt;(); Then to add values to it: pilots.put(pilot, pilotHours); In your case, you could use some code looking like this (from the given code): import java.util.Map; import java.util.TreeMap; public class Test { public static Map&lt;String, Integer&gt; pilots = new TreeMap&lt;String, Integer&gt;(); public static void main(String[] args) { int arr[] = { 50, 150, 100, 250, 200, 24, 376, 541, 56, 164 }; int arrLength = arr.length; for (int i = 0; i &lt; arrLength - 1; i++) { int min = i; for (int k = i + 1; k &lt; arrLength; k++) { if (arr[k] &lt; arr[min]) { min = k; } } if (i != min) { int temp = arr[i]; arr[i] = arr[min]; arr[min] = temp; } } for (int j = 0; j &lt; arrLength; j++) { System.out.println(arr[j] + " "); } for (int p = 0; p &lt; arrLength; p++) { int pilotHours = arr[p]; String pilot = "PILOT NAME, HOWEVER YOU GET IT"; pilots.put(pilot, pilotHours); } System.out.println(pilots); } } Tell me how it goes, after adjusting it to fit your code. The main answer/suggestion would be to use a TreeMap
has comment: http://stackoverflow.com/comment/31448566
has comment: http://stackoverflow.com/comment/31448419
score: 1
has comment: http://stackoverflow.com/comment/31448207

http://stackoverflow.com/a/20955025
upvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20954781
has body: Java by default supports integer arithmetic. To get the result in float or double(decimal point values),we should perform operation on the float or double data type. for eg : double x = 3.0/2.0 will give you x as 1.5 :) but, double x = 3/2 will give you 1,which you won't prefer in this case :( Hope,this helps you
downvote count: 1
score: -1
has comment: http://stackoverflow.com/comment/31476186

http://stackoverflow.com/q/20891285
has title: Custom record reader for custom binary format
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: hadoop
downvote count: 0
has body: In Hadoop v2 I need to create a RecordReader and/or an InputFormat based on some large binary formats stored in HDFS. The files are basically concatenated records with the following structure: 4-byte constant string "FOOO" 8-byte integer record length n1 n1-byte rest of the record 4-byte constant string "FOOO" 8-byte integer record length n2 n2-byte rest of the record 4-byte constant string "FOOO" 8-byte integer record length n3 n3-byte rest of the record 4-byte constant string "FOOO" 8-byte integer record length n4 n4-byte rest of the record ... To know all of the boundary points, I'd therefore need to scan through the entire file. Are there any examples of custom readers/formats that address structures like this? I'm hoping to avoid pre-computing all the split points in advance, I'd rather stream in each record as the mapper needs it so I don't have to waste a loop through the data. But even if I do have to pre-compute the split points, I don't know how to write a custom splitter so I'd appreciate a pointer to something like that too if possible. One point to note: the "payload" of each record is essentially arbitrary binary data, and may contain the "FOOO" 4-byte constant in it as far as I know. So if an input split falls somewhere in the middle of a record, I can't necessarily just advance to the next instance of "FOOO" to find the next record, nor would that be an efficient way to manage record-finding since it means scanning all the data rather than just the headers and seeking to the necessary locations.
tagged with: binary-data
favorite count: 0
tagged with: recordreader
type: UnansweredQuestion

http://stackoverflow.com/q/21014891
has title: Modifying an object or primitive using a void method
has comment: http://stackoverflow.com/comment/31586185
answer count: 2
linked to: http://stackoverflow.com/q/40480
tagged with: primitive
has comment: http://stackoverflow.com/comment/31586133
downvote count: 1
has answer: http://stackoverflow.com/a/21015055
tagged with: java
type: UnansweredQuestion
upvote count: 0
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/21014990
has comment: http://stackoverflow.com/comment/31586060
type: Question
has body: Consider line 2 and line 3 in the following code..... class ModifyObjects { static void modifyString1(String s){ s = "xyz"; //Or any other operations } static String modifyString2(String s){ s = "xyz"; return s; //Or any other operations } static void modifyPrimitive1(int i){ i=9; } static int modifyPrimitive2(int i){ i=9; return i; } } public class Operations { public static void main(String[] args) { // TODO Auto-generated method stub String st1 = "abcd"; String st2 = "qwerty"; String st3; int i1=0, i2; st1 = "xyz"; //line 1 System.out.println("st1: " + st1); ModifyObjects.modifyString1(st2); System.out.println("st2: " + st2); //line 2 st3 = ModifyObjects.modifyString2(st2); System.out.println("st3: " + st3); System.out.println("st2: " + st2); ModifyObjects.modifyPrimitive1(i1); System.out.println("i1: " + i1); //line 3 i2 = ModifyObjects.modifyPrimitive2(i1); System.out.println("i2: " + i2); } } line 2 gives st2 as qwerty (does not modify. Should be xyz.) line 3 gives i1 = 0 (does not modify. Should be 9.) This looks a bit odd. Here is the ouput: st1: xyz st2: qwerty st3: xyz st2: qwerty i1: 0 i2: 9 Also at line 1 a new string object "xyz" is created right? I think "abcd" is just not being referenced from here.
tagged with: void
score: -1

http://stackoverflow.com/q/20867175
tagged with: spring
linked to: http://stackoverflow.com/q/18166845
upvote count: 1
has comment: http://stackoverflow.com/comment/31309135
has body: I'm having an issue with Spring's @Fetch annotation. My model is very similar to the one discussed here, and the example given works perfectly. Here's what my model looks like: @NodeEntity public class Person { @Indexed private String name; @Fetch @RelatedTo(type="OWNS", direction=Direction.OUTGOING) //or no direction, same thing private Set&lt;Car&gt; cars; } @NodeEntity public class Car { @Indexed private String description; @RelatedTo(type="OWNS", direction=Direction.INCOMING) private Person person; } The only difference between what is presented in the previous question and my model is that @Fetch annotation. If you want Spring to fetch the contents of this field when using Repositories, you have to use this. Unfortunately, this causes String to go into a loop, creating new instances of the same two objects over and over until it blows the heap. I can't seem to get around this, no matter what I do I either get stuck in a loop, or I don't get anything out of the Repository. There is virtually no mention of this anywhere online. I'm thinking I'm googling the wrong thing, because this seems like a really common use case. IS there a workaround to this? EDIT: Possibly relevant: I am using a standalone Neo4j server, so SDN is operating over HTTP. I've noticed a few other weird, unmentioned behaviors as I've been developing in addition to this one. I'm starting to think that SDN's HTTP support is the culprit, and that having a standalone Neo4j server is somehow a weird thing. Almost every example/tutorial in existence for using Spring with Neo4j uses the embedded server.
tagged with: java
type: UnansweredQuestion
answer count: 0
downvote count: 0
tagged with: neo4j
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31342721
has title: Spring Neo4j relationship infinite loop
tagged with: spring-data-neo4j
type: Question
has comment: http://stackoverflow.com/comment/31336705

http://stackoverflow.com/comment/31550180
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20994664
has text: Have you tried `${pageScope[section + 'items'].date}`?
score: 0

http://stackoverflow.com/comment/31401344
has text: A nitpick: the JVM is what runs your program. The *compiler* is what compiles it.
score: 3
comment on: http://stackoverflow.com/q/20915991
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27287221
upvote count: 1
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20867066
has body: Copy the same jar in the below location as well ans try C:\Cisco\CallStudio\eclipse\plugins\com.audiumcorp.studio.elements.core_9.0.1-SNAPSHOT\lib

http://stackoverflow.com/a/20989188
has body: abstract class foo { public abstract void bar(); public void moo() { System.out.println("some code"); this.bar(); System.out.println("more code"); } } now if moo is called, the underlying implementation of bar will be used, it is just a small paradigm shift from what you want. so your end user would call moo instead of bar, but he still needs to implement bar
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20989066

http://stackoverflow.com/q/20867912
tagged with: reference
type: AnsweredQuestion
tagged with: biginteger
has answer: http://stackoverflow.com/a/20867930
tagged with: java
has title: Object passed to method in java works on original copy
type: Question
tagged with: object
score: 0
accepted answer: http://stackoverflow.com/a/20867930
answer count: 2
linked to: http://stackoverflow.com/q/8933557
has answer: http://stackoverflow.com/a/20867940
has body: I have Sample class with one field and I am doing following things: Calling method with object of this class as a parameter. Make some operations on this object. Original object got changed after all. I am doing same thing with BigInteger class object and it works different. Why is that so? My class: public class Sample { private int number; public int getNumber(){ return number; } public void setNumber(int number){ this.number = number; } public Sample add(int number){ this.number += number; return this; } } Invocation: public class Main { public static void main(String[] args) { Main m = new Main(); BigInteger b1 = new BigInteger("5"); Sample s1 = new Sample(); s1.setNumber(3); System.out.println(s1.getNumber()); Sample s2 = m.checkSample(s1); BigInteger b2 = m.checkBig(b1); System.out.println(s1.getNumber()+" "+s2.getNumber()); System.out.println(b1.toString()+" "+b2.toString()); } public Sample checkSample(Sample k){ k = k.add(5); return k; } public BigInteger checkBig(BigInteger big){ big = big.add(new BigInteger("2")); return big; } } Output: 3 8 8 5 7
possible better answer: http://stackoverflow.com/a/20867940

http://stackoverflow.com/comment/31414648
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20923346
score: 2
has text: You really should learn what an [SSCCE](http://sscce.org) and learn to correctly post one. A long wall of code and two lines of description will most likely get you no answers.

http://stackoverflow.com/a/20899101
has body: I would suggest simple solution that I have used. Use a condition and after writing the 2nd row, i.e. the heading row, use AutosizeColumn() it will change the cell width according to the header width and then the width will remain as it is.
has comment: http://stackoverflow.com/comment/31378312
score: 5
type: AcceptedAnswer
upvote count: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/20896517
answers question: http://stackoverflow.com/q/20896517
downvote count: 0

http://stackoverflow.com/q/20852811
possible better answer: http://stackoverflow.com/a/44048735
has answer: http://stackoverflow.com/a/20861652
has answer: http://stackoverflow.com/a/44048735
favorite count: 0
has answer: http://stackoverflow.com/a/44983620
tagged with: newrelic
has answer: http://stackoverflow.com/a/35980827
type: AnsweredQuestion
has title: Unable to install new relic on linux using tomcat server
has comment: http://stackoverflow.com/comment/31281551
tagged with: java
has answer: http://stackoverflow.com/a/20852914
has answer: http://stackoverflow.com/a/49539407
has body: I have created account on new relic and downloaded zip for new relic agent and uploaded to /etc directory in my linux machine(tomcat server). As per documentations, I follow the following code cd /etc/newrelic java -jar newrelic.jar install But I am getting following error: Dec 31, 2013 06:14:04 +0000 NewRelic 1 INFO: Agent is using Logback ***** ( ( o)) New Relic Java Agent Installer ***** Installing version 3.2.3 ... Could not edit start script because: .:. Could not locate a Tomcat, Jetty, JBoss, JBoss7 or Glassfish instance in /etc Try re-running the install command with the -s &lt;AppServerRootDirectory&gt; option or from &lt;AppServerRootDirectory&gt;/newrelic. If that doesn't work, locate and edit the start script manually. No need to create New Relic configuration file because: .:. A config file already exists: /etc/newrelic/newrelic.yml ***** Install incomplete ***** Next steps: For help completing the install, see https://newrelic.com/docs/java/new-relic-for-java Can anyone give me solution for this?
type: Question
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/31281486
answer count: 6
tagged with: tomcat
score: 4
tagged with: linux
accepted answer: http://stackoverflow.com/a/20852914

http://stackoverflow.com/q/20900985
has comment: http://stackoverflow.com/comment/31409313
score: 0
answer count: 1
has body: I write an application using cometd with bayeux server to send/receive message between server and client But when cometd create websocket to server, server always return code 400: "WebSocket connection to 'ws://localhost:8080/APServer/cometd' failed: Unexpected response code: 400" My client configure cometd: cometd.configure({ url: cometURL, logLevel: 'debug', appendMessageTypeToURL: false }); cometd.addListener('/meta/handshake', _metaHandshake); cometd.addListener('/meta/connect', _metaConnect); cometd.websocketEnabled = true; cometd.handshake(); My server web.xml as below: <?xml version="1.0" encoding="UTF-8"?> 30 3.main.html cometd org.cometd.server.CometdServlet 1 <!--init-param> transports org.cometd.websocket.server.WebSocketTransport </init-param--> true logLevel 3 cometd /cometd/* configuration jp.co.ntt.lab.multiline.web.init.ConfigurationServlet 2 cross-origin org.eclipse.jetty.servlets.CrossOriginFilter true cross-origin /cometd/*
tagged with: cometd
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31408685
has title: Establish websocket in cometd unsuccessful
tagged with: bayeux
type: Question
has answer: http://stackoverflow.com/a/20923151
tagged with: java

http://stackoverflow.com/a/21003073
upvote count: 2
has body: If stopping to use the deprecated method doesn't break backward compatibility I prefer to move to new API, nothing is mandatory but the effort is so small that I prefer to have code without warnings
answers question: http://stackoverflow.com/q/21002996
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/q/20852961
has title: hash code overriding in java
downvote count: 4
upvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/2265503
favorite count: 0
type: UnansweredQuestion
score: -4
duplicate of: http://stackoverflow.com/q/27581
linked to: http://stackoverflow.com/q/27581
tagged with: hashcode
tagged with: java
type: Question
has body: I am writing simple code by overriding hashcode and equels method can any one plz expline me how that will work exactly if i overried or not overried in my class. class HexToDec { public static void main(String[] args) { Test t = new Test(); // Test t1 = new Test("Aamir", true, "good lead, choclate hero"); Test t3 = new Test(); Test t4 = new Test(); t4.setName("ranjith"); System.out.println("a1.hashCode() = " + t); System.out.println("a2.hashCode() = " + t4); System.out.println("a1.hashCode() = " + t3.hashCode()); System.out.println("a2.hashCode() = " + t4.hashCode()); // System.out.println("is a1 == a2 " + (t == t1)); System.out.println("is a1.equals(a2) " + (t3.equals(t4))); } }
has comment: http://stackoverflow.com/comment/31281708
has answer: http://stackoverflow.com/a/20853001
has comment: http://stackoverflow.com/comment/31281734

http://stackoverflow.com/a/20880641
has comment: http://stackoverflow.com/comment/48763662
has comment: http://stackoverflow.com/comment/31334672
has comment: http://stackoverflow.com/comment/31334403
type: Answer
has body: You forgot to close your input tags: &lt;form:input id="hdd" placeholder="HDD size" path="hdd"&gt; should be &lt;form:input id="hdd" placeholder="HDD size" path="hdd" /&gt; Also note that the following is invalid: &lt;form:button type="submit" class="btn"&gt;Save&lt;/button&gt; The closing tag (&lt;/button&gt;) must match the opening tag (&lt;form:button&gt;)
downvote count: 0
score: 23
accepted answer of: http://stackoverflow.com/q/20880577
type: AcceptedAnswer
upvote count: 23
answers question: http://stackoverflow.com/q/20880577
has comment: http://stackoverflow.com/comment/137880095

http://stackoverflow.com/comment/31468932
comment on: http://stackoverflow.com/q/20951710
has text: The problem I had with reg ex is that each line does not start with for example "Errors". It alternates. Could you possibly show me an example of what you had in mind?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/20857567
tagged with: http-status-code-404
answer count: 0
score: 1
has body: I have a Google App Engin webapp written in JAVA. Routing should is done based on the settings in app.yaml which includes: handlers: - url: /testPage jsp: /testPage.jsp When I tried to access /testPage I got a 404 error. It turned out I have placed the JSP in a sub folder of /war instead of directly inside it. What I want to know is if there is some way to get from JAVA/GAE a more detailed description of the 404 error saying where did it actually look for the file that it failed to find? (I am working with eclipse 4.3.1 if that is relevant info) Thanks
tagged with: java
type: Question
tagged with: debugging
downvote count: 0
has title: Debugging (GAE) java 404 errors app routes
favorite count: 0
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/q/20866134
type: AnsweredQuestion
tagged with: java
downvote count: 2
has body: How can I change coordinates to bottom left corner? I know that's in Java the coordinates begin from Top=Left corner, but I'm asking if can someone help me how can I change it to begin (0,0) coordinates from Bottom-Left corner?
has answer: http://stackoverflow.com/a/20866149
has title: Change coordinates to bottom left corner
type: Question
has comment: http://stackoverflow.com/comment/31307440
score: -2
accepted answer: http://stackoverflow.com/a/20866171
tagged with: coordinate
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/31307086
favorite count: 0
tagged with: java-2d
possible better answer: http://stackoverflow.com/a/67213304
has answer: http://stackoverflow.com/a/67213304
has answer: http://stackoverflow.com/a/20866171

http://stackoverflow.com/a/22552889
score: 2
downvote count: 0
has body: You can use the hibernate dialect api for retrieving sequence. see : http://docs.jboss.org/hibernate/orm/3.2/api/org/hibernate/dialect/Dialect.html From below example, you can see how to use dialect to get sequence details public static void main(String[] args) { Connection jdbcConnection = null; try { jdbcConnection = DriverManager.getConnection("", "", ""); String sequenceName = "xyz" ; // name of sequence for check System.out.println("Check Sequence :" + checkSequenceName(sequenceName, jdbcConnection)); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { if(jdbcConnection != null) { try { jdbcConnection.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } public static boolean checkSequenceName(String sequenceName, Connection conn) throws JDBCConnectionException, SQLException { DialectResolver dialectResolver = new StandardDialectResolver(); Dialect dialect = dialectResolver.resolveDialect(conn.getMetaData()); if ( dialect.supportsSequences() ) { String sql = dialect.getQuerySequencesString(); if (sql!=null) { Statement statement = null; ResultSet rs = null; try { statement = conn.createStatement(); rs = statement.executeQuery(sql); while ( rs.next() ) { if(sequenceName.equals(rs.getString(1))) { return true; } } } finally { if (rs!=null) rs.close(); if (statement!=null) statement.close(); } } } return false; } If you don't desire to use hibernate, then you have to crate custom sequential specific implementation. Sample code for custom implementation interface SequenceQueryGenerator { String getSelectSequenceNextValString(String sequenceName); String getCreateSequenceString(String sequenceName, int initialValue, int incrementSize); String getDropSequenceStrings(String sequenceName); String getQuerySequencesString(); } class OracleSequenceQueryGenerator implements SequenceQueryGenerator { @Override public String getSelectSequenceNextValString(String sequenceName) { return "se…
answers question: http://stackoverflow.com/q/20948536
has comment: http://stackoverflow.com/comment/70440842
upvote count: 2
has comment: http://stackoverflow.com/comment/70442006
type: Answer

http://stackoverflow.com/q/20886795
has title: Populate ListView from List<Object>
has answer: http://stackoverflow.com/a/20886827
accepted answer: http://stackoverflow.com/a/20886827
has body: Basically I have a list of objects of class Ingredient which looks like this: class Ingredient { public int id; public String name; public Ingredient(String name) { this.name = name; } } so each object from list have a name. Now to use ArrayAdapter I need to have a List of strings filled with names. Is there any way to use ArrayAdapter with my list of Ingredients? This is how it looks right now List&lt;Ingredient&gt; ingredientsList= new ArrayList&lt;Ingredient&gt;(); ingredientsList.add(new Ingredient("foo")); ingredientsList.add(new Ingredient("bar"));
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: android-arrayadapter
tagged with: java
has answer: http://stackoverflow.com/a/20886910
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/20886910
favorite count: 0
tagged with: listview
upvote count: 3
tagged with: android-listview
tagged with: android

http://stackoverflow.com/comment/31484313
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20958768
has text: If it is a desktop application and your operations are executed on UI thread then you have a place for changes.

http://stackoverflow.com/comment/31448443
comment on: http://stackoverflow.com/q/20940520
score: 0
type: QuestionComment
has text: I use glBindAttribLocation in the createShaderProgram method, I also tried glGetAttribLocation, still nothing.
type: Comment

http://stackoverflow.com/comment/31658973
has text: The websocket protocol sucks, and you will need to use a library/framework that has done all the hard work for you. Or you can do it all your self but it will take you a loooong time.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/20898224
type: AnswerComment

http://stackoverflow.com/q/20940195
answer count: 1
tagged with: lighting
tagged with: opengl
tagged with: glsl
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/20940494
has title: Getting world position for deferred rendering light pass
type: UnansweredQuestion
has body: I have recently began to build some kind of deferred rendering pipeline for the engine I am working on but I'm stuck at reconstructing the world position from depth. I have looked at quite a few examples where the explain that you need either a world position texture or a depth texture to then use for the correct distance and direction calculation of the light. My problem is that the so called position texture which assumably is the world position doesn't seem to give me correct data. Therefore I tried to find alternative ways of getting a world position and some have suggested that I should use a depth texture instead but then what? To make it all more clear this picture shows the textures that I currently have stored: Position(Top left), Normal(Top right), Diffuse(Bottom left) and Depth(Bottom right). For the light pass I am trying to use a method which works fine if used in the first pass. When I try the same method for the light pass with the exact same variables it stops working. Here's my Geometry Vertex Shader: #version 150 uniform mat4 projectionMatrix; uniform mat4 viewMatrix; uniform mat4 modelMatrix; in vec4 in_Position; in vec3 in_Normal; in vec2 in_TextureCoord; out vec3 pass_Normals; out vec4 pass_Position; out vec2 pass_TextureCoord; out vec4 pass_Diffuse; void main(void) { pass_Position = viewMatrix * modelMatrix * in_Position; pass_Normals = (viewMatrix * modelMatrix * vec4(in_Normal, 0.0)).xyz; pass_Diffuse = vec4(1,1,1,1); gl_Position = projectionMatrix * pass_Position; } Geometry Fragment shader: #version 150 core uniform sampler2D texture_diffuse; uniform mat4 projectionMatrix; uniform mat4 viewMatrix; uniform mat4 modelMatrix; in vec4 pass_Position; in vec3 pass_Normals; in vec2 pass_TextureCoord; in vec4 pass_Diffuse; out vec4 out_Diffuse; out vec4 out_Position; out vec4 out_Normals; void main(void) { out_Position = pass_Position; out_Normals = vec4(pass_Normals, 1.0); out_Diffuse = pass_Diffuse; } Light Vertex Shader: #version 150 in vec4 in_…
tagged with: deferred-rendering
type: Question

http://stackoverflow.com/a/20930527
type: Answer
has comment: http://stackoverflow.com/comment/31428666
has comment: http://stackoverflow.com/comment/31428780
has comment: http://stackoverflow.com/comment/31428702
upvote count: 5
has comment: http://stackoverflow.com/comment/31428685
answers question: http://stackoverflow.com/q/20930511
score: 5
has comment: http://stackoverflow.com/comment/31428809
has body: Since String is final (designed as immutable) you need to create every time new Strings. For repeated times I recommend to use StringBuilder and then (after all char additions) convert it to String via toString()-method.
downvote count: 0

http://stackoverflow.com/a/20884369
has comment: http://stackoverflow.com/comment/31342015
score: 0
has comment: http://stackoverflow.com/comment/31341696
has comment: http://stackoverflow.com/comment/31342186
has comment: http://stackoverflow.com/comment/31341506
has comment: http://stackoverflow.com/comment/31341044
has comment: http://stackoverflow.com/comment/31340961
has comment: http://stackoverflow.com/comment/31345722
has comment: http://stackoverflow.com/comment/31341475
has comment: http://stackoverflow.com/comment/31341590
type: Answer
has body: The reason is that you have never actually initialized that array in the instance of OtherClass you have just created. When the instance of OtherClass is created, that snippet of code that you have in Main init() method: b[0] = 4; Is never executed for the OtherClass instance b array, which is an entirely different variable in memory than the b array that exists for the Main class instance. That is the reason you don't see that '4' in the array
answers question: http://stackoverflow.com/q/20884251

http://stackoverflow.com/q/20911990
tagged with: for-loop
has comment: http://stackoverflow.com/comment/31393568
has answer: http://stackoverflow.com/a/20912042
tagged with: variables
tagged with: boolean
has answer: http://stackoverflow.com/a/20912026
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31393724
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31393562
possible better answer: http://stackoverflow.com/a/20912026
has body: I've got this code fragment: private static int counter = 0; public static void main(String[] args) { int x = 1; for (test('1'); test('2') &amp;&amp; (x &lt;= 2); test('3')) { x++; test('4'); } System.out.println(" Counter=" + counter); } static boolean test(char num) { System.out.print(" " + num); counter++; return true; } Why does the forloop doing here? I thought that the first statement in a for loop has to be the initialization of a variable and that this will not compile, but it runs and puts the output: 1 2 4 3 2 4 3 2 Counter=8 What is the boolean doing here?
type: Question
accepted answer: http://stackoverflow.com/a/20912042
answer count: 2
has title: For-loop with boolean instead of variable initialization
upvote count: 2
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/31393911

http://stackoverflow.com/q/20957221
accepted answer: http://stackoverflow.com/a/20957551
downvote count: 2
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/20957551
has body: I have this issue: source list - different integers destination - only even integers source list. Can I solve this problem using guava transform?
type: AnsweredQuestion
upvote count: 0
tagged with: guava
tagged with: java
has comment: http://stackoverflow.com/comment/31478938
type: Question
tagged with: transformation
has comment: http://stackoverflow.com/comment/31478927
score: -2
has comment: http://stackoverflow.com/comment/31479036
has title: It is possible to achieve that the destination collection has different length than source using guava transform?
has comment: http://stackoverflow.com/comment/31479550

http://stackoverflow.com/q/20984608
score: 0
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/20987363
tagged with: cursor
has body: I'm receiving a nullPointerException error, during one of methods and I can't seem to work out why one of my variables(csID) is becoming null. here is the method: public String getSubjectBasedOnHID(int hID) { String selectQuerySubjectForHomework = "SELECT sID FROM homework WHERE hID = '" + hID + "';"; HashMap&lt;String, String&gt; sIDD = new HashMap&lt;String, String&gt;(); SQLiteDatabase database = this.getReadableDatabase(); Cursor cursorGetsID = database.rawQuery(selectQuerySubjectForHomework, null); if (cursorGetsID.moveToFirst()) { HashMap&lt;String, String&gt; temp = new HashMap&lt;String, String&gt;(); temp.put("sID", cursorGetsID.getString(0)); sIDD = temp; } String csID = sIDD.get("sID").toString(); String Subject = csID; return Subject; }; csID becomes null (I think), which causes the program to crash, any help would be greatly Appreciated! logCat: 01-07 18:58:45.854: E/AndroidRuntime(2630): Caused by: java.lang.NullPointerException 01-07 18:58:45.854: E/AndroidRuntime(2630): at com.compfour.homework.dataBaseTools2.getSubjectBasedOnHID(dataBaseTools2.java:284) Thank you, in advance.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20984670
tagged with: nullpointerexception
type: Question
accepted answer: http://stackoverflow.com/a/20987363
tagged with: android
has title: NullPointerException Android Java
possible better answer: http://stackoverflow.com/a/20984670
has comment: http://stackoverflow.com/comment/31531075

http://stackoverflow.com/q/20991763
linked to: http://stackoverflow.com/q/20968597
tagged with: popup
has answer: http://stackoverflow.com/a/20991840
upvote count: 1
type: Question
tagged with: imageview
score: 1
tagged with: java
has body: I have a big image which contains different sections. What I want is different PopUps should open when the user touches different sections of the ImageView. For instance, see this Image below: In this image, what I want is that when the user clicks 1st square, Popup 1 should open, on square 2 popup should open. How to achieve this please.? Moreover, I want the ImageView still be zoom and pan enabled. Please help.
has answer: http://stackoverflow.com/a/20993729
has title: PopUp window to be opened to touches within an Imageview
answer count: 2
downvote count: 0
favorite count: 0
tagged with: zooming
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/31322771
type: Comment
comment on: http://stackoverflow.com/a/20873989
type: AnswerComment
score: 0
has text: No you already do it in the `fragment.Liste.setListTier....();` I am saying you have to perform the addition AND the notifyDataSetChanged inside of the same Runnable. Your textRecu should be added in the same runnable on the UIThread

http://stackoverflow.com/comment/31442345
type: Comment
comment on: http://stackoverflow.com/a/20928416
type: AnswerComment
score: 0
has text: JRebel doesn't remote the technical limitations of the JVM platform in regards to hot deployment on live systems. It is designed purely as a development tool and the EULA restricts its use in production. There is another tool by the same vendor -- LiveRebel (http://zeroturnaround.com/software/liverebel/) which is aimed at application deployment automation, so you may want to take a look. If interested, ask for the demo via the website.

http://stackoverflow.com/q/20987636
type: Question
has comment: http://stackoverflow.com/comment/31536317
score: 3
has comment: http://stackoverflow.com/comment/31536363
tagged with: simpledateformat
possible better answer: http://stackoverflow.com/a/20987793
tagged with: java
tagged with: date
has answer: http://stackoverflow.com/a/20987793
has answer: http://stackoverflow.com/a/20987898
has comment: http://stackoverflow.com/comment/31536359
has title: How to parse "dd-MM" date format to get current year?"
downvote count: 0
has answer: http://stackoverflow.com/a/20994992
has answer: http://stackoverflow.com/a/20988730
has answer: http://stackoverflow.com/a/20987785
favorite count: 0
has comment: http://stackoverflow.com/comment/31536495
has answer: http://stackoverflow.com/a/50679552
tagged with: android
accepted answer: http://stackoverflow.com/a/20987898
answer count: 10
has body: I have to parse "17-Jun" format date using Java.But the problem is when I try to parse "dd-MM" format using SimpleDateFormat it is returning as "Wed Jun 17 00:00:00 IST 1970".Is it possible to get current(2014) year instead of 1970. My result: 17/JUNE/1970 Expected result: 17/JUNE/2014
tagged with: date-parsing
type: AnsweredQuestion
upvote count: 3
has answer: http://stackoverflow.com/a/20988219
has answer: http://stackoverflow.com/a/20988718
has answer: http://stackoverflow.com/a/20988107
has answer: http://stackoverflow.com/a/20987922

http://stackoverflow.com/comment/31377779
comment on: http://stackoverflow.com/q/20904010
has text: With a text editor you do not have debugging, error handling, etc. ... Check this [link](https://www.cise.ufl.edu/~bn0/jsp_eclipse_tutorial/).
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31482196
type: Comment
has text: Mapping is mandatory for a servlet...
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/20958755

http://stackoverflow.com/comment/31476047
has text: Because rootView is defnied in the `Fragment` not in the `setupCommand`
type: Comment
comment on: http://stackoverflow.com/a/20955617
score: 0
type: AnswerComment

size
type: Tag
tag name: size
tags question: http://stackoverflow.com/q/20933931
tags question: http://stackoverflow.com/q/20915010
tags question: http://stackoverflow.com/q/20889571

tesseract
tags question: http://stackoverflow.com/q/20904110
type: Tag
tag name: tesseract

http://stackoverflow.com/q/21009487
has comment: http://stackoverflow.com/comment/31669394
score: 2
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/31578469
has answer: http://stackoverflow.com/a/21060866
type: Question
accepted answer: http://stackoverflow.com/a/21060866
tagged with: graphics
has comment: http://stackoverflow.com/comment/31577460
has title: Scaling Graphics (Beginning Java Programmer)
tagged with: java
tagged with: scaling
upvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/31576754
has body: I am Chris. I am fairly new to coding, I don't know many terms, this is my third and most successful attempt at learning Java. Yeah, It didn't work out so much was I was younger. Anyhow, I am trying to create a game but I'm having a slight problem. I made a 16 x 16 image as my character, however - as expected- it shows up as fairly small. I have absolutely no clue how to make it larger. Here is the code: package code; import java.awt.Graphics; public class Skeleton extends Loop{ //Should extend Applet? private static final long serialVersionUID = 1L; public void init(){ Thread th= new Thread(this); th.start(); offscreen = createImage(120,160); // 120, 160 d = offscreen.getGraphics(); addKeyListener(this); //15:43 } public static final int HEIGHT = 120; //Original Height/Width= "120 x 160" public static final int WIDTH = 160; public static final String TITLE= "Test Game BETA"; public static final int SCALE = 3; public void paint(Graphics g) { d.clearRect(0, 0, 160, 120); //Error Here, Scale perhaps? -Disregard //0, 0, 160, 120 d.drawImage(him, x, y, this); //12:17 http://www.youtube.com/watch?v=XmRD0PlAXEY g.drawImage(offscreen, 0, 0, this); } public void update(Graphics g){ paint(g); } //Finished at 15:33 ERROR w/ the circle -Fixed } //2D Tile Engine Must be Created
favorite count: 0
has comment: http://stackoverflow.com/comment/31622765
has comment: http://stackoverflow.com/comment/31578449
has comment: http://stackoverflow.com/comment/31576963

http://stackoverflow.com/a/21014367
has comment: http://stackoverflow.com/comment/31585300
has comment: http://stackoverflow.com/comment/31585201
has comment: http://stackoverflow.com/comment/31585512
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31585391
has comment: http://stackoverflow.com/comment/31585706
has comment: http://stackoverflow.com/comment/31586658
has comment: http://stackoverflow.com/comment/31585363
has comment: http://stackoverflow.com/comment/31585345
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/21014305
has comment: http://stackoverflow.com/comment/31585156
has comment: http://stackoverflow.com/comment/31585318
has body: There is not guarantee how they will run it depends on OS scheduler. There is nothing better than this Thread a = new ThreadA(); Thread b = new ThreadB(); a.start(); b.start();
has comment: http://stackoverflow.com/comment/31585131

http://stackoverflow.com/a/20923485
has comment: http://stackoverflow.com/comment/31414849
has comment: http://stackoverflow.com/comment/31414792
has comment: http://stackoverflow.com/comment/31414746
has comment: http://stackoverflow.com/comment/31415115
downvote count: 0
answers question: http://stackoverflow.com/q/20923372
has comment: http://stackoverflow.com/comment/31416361
upvote count: 11
type: Answer
score: 11
has body: Not more powerful in the sense that you could write something in Java that would be impossible to replicate in PHP. I'm not familiar with PHP, but there's most likely similar frameworks and libraries that have been created for PHP that exist already in Java (such as an ORM framework like JPA). Stateful EJBs aren't that special (and not that common either). You can readily store information in the session whether you're using Java or PHP. This isn't really a suitable question for SO either, since programming languages are different and frameworks are different and you'll never find the "best" something, because that doesn't really exist. Solution: learn both.

http://stackoverflow.com/comment/31586044
type: Comment
score: 2
has text: @Rugal but that was the thing OP was asking for. This is the same thing as `-source` and `-target` options of javac, compiler plugin doesn't add any functional benefit there.
type: AnswerComment
comment on: http://stackoverflow.com/a/21014705

http://stackoverflow.com/comment/31350343
has text: FYI, that format is the standard [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20881258

http://stackoverflow.com/comment/31486786
has text: @assylias sorry, but that question doesn't have an answer for what I'm looking for.
score: 0
comment on: http://stackoverflow.com/q/20950304
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31364878
score: 0
comment on: http://stackoverflow.com/q/20896848
type: Comment
type: QuestionComment
has text: Really? You're typing `echo %PATH%` and getting nothing at all?

http://stackoverflow.com/q/20867685
has comment: http://stackoverflow.com/comment/33658488
score: 1
tagged with: java
type: Question
tagged with: webservice-client
downvote count: 0
tagged with: .net
has body: I have a simple java web service for which request xml look like below. <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.jfoundation.com/WebService/WebServiceService"> <soapenv:Header> <Code>CMB username_here password_here </soapenv:Header> <soapenv:Body> <web:registerUser> email_here fax_number_here mobile_phone_number_here </web:registerUser> </soapenv:Body> </soapenv:Envelope> Now, i am trying to consume this web service in .Net 4.0, i am able to create the service reference and create the proxy object using the framework generated class. But i don't know how to pass the soap header details via the client. Below is the code snippet which calls the Web service. But it fails since i am not able to pass the header which captures following information such as Code, Username, Password WebServiceClient objClientProxy = new WebServiceClient(); registerUserDetailsRQ objUserDetailsEntity = new registerUserDetailsRQ() { emailID = "", fax = "", mobile = ""}; objClientProxy.registerUser(objUserDetailsEntity); Appreciate if someone can help on this..
has title: Consume a java web service in .Net
has comment: http://stackoverflow.com/comment/33637254
favorite count: 0
answer count: 0
tagged with: wcf
type: UnansweredQuestion
tagged with: soap
upvote count: 1

http://stackoverflow.com/q/20866917
has answer: http://stackoverflow.com/a/20866979
linked to: http://stackoverflow.com/q/911462
possible better answer: http://stackoverflow.com/a/20866945
has comment: http://stackoverflow.com/comment/31308431
has answer: http://stackoverflow.com/a/20866938
tagged with: arrays
accepted answer: http://stackoverflow.com/a/20866938
favorite count: 0
has answer: http://stackoverflow.com/a/20866989
has comment: http://stackoverflow.com/comment/31314295
downvote count: 4
answer count: 4
type: AnsweredQuestion
upvote count: 0
has title: Complicated array traversal and element removal
has answer: http://stackoverflow.com/a/20866945
has comment: http://stackoverflow.com/comment/31308341
tagged with: java
has body: Given an array of four Points produce a new array/vector/arraylist (whatever is easier) with the same Points but if there are Points with duplicate X values, only save the Point which has the highest Y value. For example: If given (3, 2), (3, 1), (1, 2), (1, 1) this method should output only (3, 2) and (1, 2). If given (3, 2), (3, 3), (3, 4), (3, 5) this method should output only (3, 5). Any ideas on how I should proceed with this? My solutions keep running into a ConcurrentModificationException. (for each point a in array) { (for each point b in newArray) { (if a and b have the same x and a has a greater y) { remove a add b } else { add b } }
score: -4
type: Question

http://stackoverflow.com/a/20946491
has comment: http://stackoverflow.com/comment/31460112
score: 2
has comment: http://stackoverflow.com/comment/31460712
has comment: http://stackoverflow.com/comment/31460895
accepted answer of: http://stackoverflow.com/q/20944273
answers question: http://stackoverflow.com/q/20944273
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31460075
type: Answer
has body: I want to change the background color of an already present pdf to transparent or white According to the PDF specification ISO 32000-1, section 11.4.7: Ordinarily, the page shall be imposed directly on an output medium, such as paper or a display screen. The page group shall be treated as an isolated group, whose results shall then be composited with a backdrop colour appropriate for the medium. The backdrop is nominally white, although varying according to the actual properties of the medium. However, some conforming readers may choose to provide a different backdrop, such as a checker board or grid to aid in visualizing the effects of transparency in the artwork. PDF viewers most often do use this white backdrop. Thus, if your PDF on standard viewers displays a different color in the back, this normally is due to some area filling operation(s) somewhere in the page content stream. Thus, there is not a simple single attribute of the PDF to set somewhere but instead you have to parse the page content, find the operations which paint what you perceive as background, and change them. There are numerous different operations which may be used for this task, though, and these operations may also be used for other purposes than background coloring. Thus, there is not the method to change backgrounds. If you have a single specific PDF or PDFs generated alike, please provide a sample document to allow helping you to find find a way to change the perceived background color. PS: The PDLayoutAttributeObject.setBackgroundColor method you found refers to the creation of so called Layout Attributes which specify parameters of the layout process used to produce the appearance described by a document’s PDF content. [...] NOTE The intent is that these parameters can be used to reflow the content or export it to some other document format with at least basic styling preserved. (section 14.8.5.4 in the PDF specification ISO 32000-1) Thus, they are provided only in PDFs intended for co…
upvote count: 2

http://stackoverflow.com/comment/31590719
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21017564
type: AnswerComment
has text: I've made this change to my code now I'm getting an error on the line public static void main(String[] args) { even though there is no red x next to that line of the code, heck there isn't anything even wrong with that line of the code. @Gaurav

http://stackoverflow.com/comment/31377172
type: Comment
has text: how to initiate the dozermapping.xml from java class
comment on: http://stackoverflow.com/a/20903605
score: 0
type: AnswerComment

http://stackoverflow.com/q/20908204
has answer: http://stackoverflow.com/a/20976914
has title: How do i perform Gravity data push from HttpServlet
score: 0
tagged with: graniteds
type: UnansweredQuestion
tagged with: spring
tagged with: http
linked to: http://stackoverflow.com/q/21092781
tagged with: java
has body: Last few days i was playing with GranideDS tutorials (using Spring server and AIR client) https://github.com/graniteds-tutorials/graniteds-tutorial-data "This tutorial shows how to build a simple data application that manages a database of user accounts. All connected clients are notified and synchronized with data updates using a GraniteDS long polling channel." Unfortunately i cannot find any GraniteDS javascript client library or example. I created an HttpServlet to manage (add Entity for example) persistense context using http (ajax) requests. my TestServlet.java @WebServlet("/TestServlet") public class TestServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(this.getServletContext()); AccountService srvObject = (AccountService) wac.getBean("testService"); //testService mean spring service annotation parameter Account emp = new Account(); emp.setName(request.getParameter("name")); emp.setEmail(request.getParameter("email")); srvObject.save(emp); response.getWriter().println("OK"); } } This method adds an entity correctly but connected client's data are NOT syncronized. How can i notify all clients about new changes? UPDATE: I was trying to change DataEnabled's publish to PublishMode.ON_COMMIT @DataEnabled(topic="dataTopic", publish=DataEnabled.PublishMode.ON_COMMIT, useInterceptor=true) add to application-context.xml &lt;graniteds:tide-data-publishing-advice/&gt; In this case both air application and servlet causing server error: SEVERE: Could not register synchronization for ON_COMMIT publish mode, check that the Spring PlatformTransactionManager supports it and that the order of the TransactionInterceptor is lower than the order of TideDataPublishingInterceptor And &lt;graniteds:tide-data-publishing-advice order="-1"/&gt; does not h…
tagged with: servlets
type: Question
answer count: 1

http://stackoverflow.com/comment/31353673
score: 3
comment on: http://stackoverflow.com/q/20890974
has text: Please tag your question with the language you're using.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31571916
has text: You could also try setting -Dswing.defaultlaf=<your system LAF class name> on the command line, to see if that makes a difference.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21006776

http://stackoverflow.com/comment/31551574
comment on: http://stackoverflow.com/q/20996063
has text: @BenjaminDale: Sure, you can use Joda to compare dates, just as you can use the standard API to compare dates. What's the advantage of Joda when solving exactly this problem?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31513829
comment on: http://stackoverflow.com/q/20974169
type: Comment
has text: My real interest is in knowing to what extent should I be protecting against bad implementations. I'm surprised to hear "not at all" so far. I'm not asking for a code review. I am asking, however, if there are any overhead or other negative consequences (beyond having to maintain the code) to actually using something like the IW class. I've updated the original post.
score: 0
type: QuestionComment

http://stackoverflow.com/a/20896843
score: 0
answers question: http://stackoverflow.com/q/20896705
type: Answer
has body: // try this way private EditText weight; private EditText mark; @Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.main); LinearLayout layout = new LinearLayout(this); weight = new EditText(this); mark = new EditText(this); mark.setInputType(InputType.TYPE_CLASS_NUMBER); weight.setInputType(InputType.TYPE_CLASS_NUMBER); weight.setId(99); mark.setId(100); layout.addView(mark); layout.addView(weight); AlertDialog.Builder addwork = new AlertDialog.Builder(this); addwork.setView(layout); addwork.setPositiveButton("Add", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String coursename = ecoursename.getText().toString(); weight.setText("TEST"); try { if ((weight.getText().toString().trim().equals("")) || (mark.getText().toString().trim().equals(""))) { } else { } } catch (Exception e) { e.printStackTrace(); Toast invalidinputtoast = Toast.makeText(getApplicationContext(), "Please input a value", Toast.LENGTH_LONG); invalidinputtoast.show(); } } }); }

http://stackoverflow.com/comment/31372214
comment on: http://stackoverflow.com/q/20898531
type: Comment
type: QuestionComment
has text: @BalusC could you please explain `However, as it's an ajax request and there's no render information (the whole POST request is basically discarded during the security check forward), only the view state will be returned.` annotated from the post you have given. It is not very much clear to me.
score: 0

http://stackoverflow.com/q/20878702
answer count: 1
has answer: http://stackoverflow.com/a/20884116
tagged with: java
has title: How to explicitly specify the 'inverse' @OneToMany relationship in JPA
type: AnsweredQuestion
tagged with: jpa
downvote count: 0
accepted answer: http://stackoverflow.com/a/20884116
score: 1
favorite count: 0
type: Question
tagged with: eclipselink
tagged with: generics
has body: I am using JPA discriminators to obtain specific sub classes as follows (class names changed for simplicity) @Entity @Table(name="TYPE") @Inheritance(strategy=InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name="SUB_TYPE", discriminatorType=DiscriminatorType.INTEGER) public class Type { @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="TID") private Foo foo; } @Entity @DiscriminatorValue("1") public class Type1 extends Type { //Type1 stuff } //Other Type subclasses As you can see "Type" class is in a many-to-one relationship with the Foo class, however in generics as Set&lt;Type1&gt; is not a subtype of Set&lt;Type&gt; we cannot just speicify the 'inverse' relationship in Foo as Set&lt;Type&gt; types; Therefore my Foo class uses wildcards but also ensures that only subclasses of Type can be set as types as follows; @Entity @Table(name="FOO") public class Foo { //bi-directional one-to-many association to Type @OneToMany(mappedBy="foo") Set&lt;?&gt; types; public Set&lt;?&gt; getTypes() { return types; } public void setTypes(Set&lt;? extends Type&gt; types) { this.types = types; } } The question is - how do I explicitly tell JPA that the Set should be of type 'Type'? If this is not possible, what are my alternatives to setting this inverse relationship, while still using discriminators?
upvote count: 1

http://stackoverflow.com/comment/31338930
comment on: http://stackoverflow.com/q/20883328
score: 0
type: Comment
type: QuestionComment
has text: Actually there is a lot more wrong here. Your use of ` ` and ` ` is complete messed up, your embedding of the `<c:when>` statements is wrong, nested without wrapping `<c:choose>` and then your requirement for a sorted list is a bit weird since you'll either have one value or 3, but that is it.

http://stackoverflow.com/q/20928320
has comment: http://stackoverflow.com/comment/31424543
favorite count: 0
has answer: http://stackoverflow.com/a/20928414
tagged with: javac
linked to: http://stackoverflow.com/q/5981460
accepted answer: http://stackoverflow.com/a/20928589
linked to: http://stackoverflow.com/q/11546075
possible better answer: http://stackoverflow.com/a/20928414
type: AnsweredQuestion
upvote count: 31
has comment: http://stackoverflow.com/comment/31424815
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/31424828
score: 29
type: Question
linked to: http://stackoverflow.com/q/18811606
has comment: http://stackoverflow.com/comment/31424792
linked to: http://stackoverflow.com/q/4997513
has answer: http://stackoverflow.com/a/20928589
tagged with: optimization
has body: javac has an interesting -O option: Optimizes compiled code by inlining static, final and private methods. Note that your classes may get larger in size. This option seems to not be popular (hidden?), I've just discovered it today, on CodeCup 2014 page. -O is not mentioned in the official documentation nor in man javac... Strange. In accepted answer to similar question, we can read that: Optimization in Java is mostly done by the JIT compiler at runtime. Hence there is no point trying to instruct it to optimize a certain way at compile time (when it is creating only bytecode anyway). The JIT will almost surely make better decisions on the spot, knowing the exact environment and observing the actual patterns of execution of specific parts of your code. My question is: Should I always use the -O option or not? In other words, the code always run faster with -O or does it make no difference at all? Maybe classes size can increase so much that the overall performance will drop? Or JVM will do the inlining anyway so it's better to leave it to that? Similar story was with gcc -O3 flag.
answer count: 3
has answer: http://stackoverflow.com/a/20928411
has comment: http://stackoverflow.com/comment/31424702
has title: Should I use javac -O option to optimize?

http://stackoverflow.com/a/20878745
has comment: http://stackoverflow.com/comment/70802598
accepted answer of: http://stackoverflow.com/q/20872393
score: 5
answers question: http://stackoverflow.com/q/20872393
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31347666
has comment: http://stackoverflow.com/comment/68529724
type: Answer
has comment: http://stackoverflow.com/comment/50547243
has body: Repository scanning will look for solrTemplate and create repository using provided template. As you need one template for each Solr core, you'll have to create both, template and repository manually. First create your repositories and custom implementations. public interface EventRepositoryCustom { Page&lt;Event&gt; findEvent(); } public interface EventRepository extends EventRepositoryCustom, SolrCrudRepository&lt;Event, String&gt; { } public class EventRepositoryImpl implements EventRepositoryCustom { private SolrTemplate eventTemplate; public EventRepositoryImpl(SolrTemplate eventTemplate) { this.eventTemplate = eventTemplate; } @Override public Page&lt;Event&gt; findEvent() { return eventTemplate.queryForPage(new SimpleQuery("*:*"), Event.class); } } Do the same for your TownRepository. Using Java Config for configuration. Same can be done with XML. @Configuration public class SolrContext { private static final String PROPERTY_NAME_SOLR_SERVER_URL = "solr.host"; @Resource private Environment environment; // Factory creates SolrServer instances for base url when requesting server // for specific core. @Bean public SolrServerFactory solrServerFactory() { return new MulticoreSolrServerFactory(new HttpSolrServer( environment.getRequiredProperty(PROPERTY_NAME_SOLR_SERVER_URL))); } // SolrTemplate for /solrServerUrl/towns @Bean public SolrTemplate townTemplate() throws Exception { SolrTemplate solrTemplate = new SolrTemplate(solrServerFactory()); solrTemplate.setSolrCore("towns"); return solrTemplate; } // SolrTemplate for /solrServerUrl/events @Bean public SolrTemplate eventTemplate() throws Exception { SolrTemplate solrTemplate = new SolrTemplate(solrServerFactory()); solrTemplate.setSolrCore("events"); return solrTemplate; } @Bean public EventRepository eventRepository() throws Exception { return new SolrRepositoryFactory(eventTemplate()) .getRepository(EventRepository.class, new EventRepositoryImpl(eventTemplate())); } @Bean public TownRepository townRepository()…
has comment: http://stackoverflow.com/comment/68528504
has comment: http://stackoverflow.com/comment/82223664
upvote count: 5

http://stackoverflow.com/a/20860827
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/20860578
answers question: http://stackoverflow.com/q/20860578
score: 0
has body: PopupWindows are not focusable by default. It may effect the Listviews to give false-positive , but if their container is not focused - they wont function normally. just set the popup's focusable attribute to true before showing it up.

http://stackoverflow.com/q/20917349
answer count: 1
has body: I'm making a client updater &amp; I'm getting an error in my cmd whilst trying to unzip the file. What it's supposed to do is: check if the file exists in the user's home (user.home), if it doesn't exist in the user's home, check if the file exists in the project's directory, if it doesn't exist in the project's directory, download the file; if it does, then unzip the file into the user's home. The error: Exists in Directory! file unzip : C:\Users\Ryan T\Desktop\Rezzion Updater\.rezzion.cache\rezzion.cache java.io.FileNotFoundException: .rezzion.cache\rezzion.cache\Data (The system cannot find the path specified) at java.io.FileOutputStream.open(Native Method) at java.io.FileOutputStream.&lt;init&gt;(Unknown Source) at java.io.FileOutputStream.&lt;init&gt;(Unknown Source) at rezzion.UnZip.unZipIt(UnZip.java:54) at rezzion.Downloader.&lt;init&gt;(Downloader.java:68) at rezzion.Downloader.main(Downloader.java:78) file unzip : C:\Users\Ryan T\Desktop\Rezzion Updater\.rezzion.cache\rezzion.cache\Data Image of Project Folder: my Downloader.java (Main Class): package rezzion; import java.awt.FlowLayout; public class Downloader extends JFrame { private static final long serialVersionUID = 1L; private static boolean exists = (new File(System.getProperty("user.home") + ".rezzion.cache")).exists(); private static boolean existsinDir = (new File("rezzion.cache.zip")).exists(); private static String site = "https://dl.dropboxusercontent.com/s/yoh4d17gfgnv2od/rezzion.cache.zip?dl=1&amp;token_hash=AAE1qdxL_-2y_arb8MBnk8AHSsuhLH1-lwSiGVc0ayQKXA"; private static String filename = "rezzion.cache.zip"; private static final String INPUT_ZIP_FILE = "rezzion.cache.zip"; private static final String OUTPUT_FOLDER = ".rezzion.cache"; private final int BUFFER = 1024; public Downloader() { JFrame frm = new JFrame(); JProgressBar current = new JProgressBar(0, 100); current.setBounds(35, 68, 326, 30); current.setValue(0); current.setStringPainted(true); frm.setVisible(true); frm.getContentPane…
has comment: http://stackoverflow.com/comment/31403823
has comment: http://stackoverflow.com/comment/31403748
has title: Java UnZipper error?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31403859
tagged with: java
has comment: http://stackoverflow.com/comment/31403800
type: Question
has comment: http://stackoverflow.com/comment/31403901
tagged with: unzip
has comment: http://stackoverflow.com/comment/31403876
has comment: http://stackoverflow.com/comment/31403809
score: 0
has answer: http://stackoverflow.com/a/20917377

http://stackoverflow.com/comment/53588926
score: 4
has text: use "UTF-16BE" to avoid the BOM.
type: Comment
comment on: http://stackoverflow.com/a/20899103
type: AnswerComment

http://stackoverflow.com/comment/31372329
comment on: http://stackoverflow.com/a/20900986
score: 0
type: Comment
has text: you can add you code to your question,press edit neqr your question
type: AnswerComment

http://stackoverflow.com/comment/31356392
comment on: http://stackoverflow.com/q/20892170
type: Comment
type: QuestionComment
score: 0
has text: [`SwingWorker`](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/)?

http://stackoverflow.com/q/21009578
has comment: http://stackoverflow.com/comment/31577194
type: AnsweredQuestion
downvote count: 0
score: 1
has body: spent a little time googling this and couldn't quite find what I was looking for. My app has it's own theme with a drawable that is used for the background of my entire app. When transitioning between activities though, the home screen background can be seen for a split second. How do I prevent the home screen's background from being seen? It's almost like the current activity goes away just before the new one is drawn on the screen, and so I'm left looking at the home screen wallpaper for a split second. Any ideas?
has comment: http://stackoverflow.com/comment/31577714
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/31577164
tagged with: background
has title: Background During Activity Transitions
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/21032065
accepted answer: http://stackoverflow.com/a/21032065
favorite count: 0
tagged with: themes
tagged with: android

http://stackoverflow.com/q/20894280
score: 0
upvote count: 1
tagged with: bufferedimage
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31360494
tagged with: java
has body: I am trying to make a program in Java that uses Perlin noise to make a black and white height map. I tried using the code from here to implement the noise. I used the code below to try to make the noise make a height map but what I get is something like this instead of getting a height map. BufferedImage img; img = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB ); int[] pixel = ((DataBufferInt)img.getRaster().getDataBuffer()).getData(); for(int i = 0; i &lt; (WIDTH*HEIGHT); i++) { pixel[i] = (int) perlin.PerlinNoise(i, i); }
tagged with: image
has answer: http://stackoverflow.com/a/20895644
answer count: 1
linked to: http://stackoverflow.com/q/19184419
tagged with: perlin-noise
tagged with: awt
favorite count: 0
has title: height map related issue
has comment: http://stackoverflow.com/comment/31360652
accepted answer: http://stackoverflow.com/a/20895644
type: AnsweredQuestion

http://stackoverflow.com/comment/31421694
type: Comment
has text: @Bohemian: It doesn't. Which makes sense, since boxing is allowed in the second phase and it won't find a suitable method in the first phase. At that point it will find 2 possible candidates and it will try all possibilities as far as I can tell.
comment on: http://stackoverflow.com/a/20924662
type: AnswerComment
score: 0

http://stackoverflow.com/a/20899649
has comment: http://stackoverflow.com/comment/31371858
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/20896733
has body: You might be able to do something with the TaskBar or TaskItem: TaskBar taskBar = Display.getDefault().getSystemTaskBar(); TaskItem taskItem = taskBar.getItem(null);
downvote count: 0

http://stackoverflow.com/comment/32239125
comment on: http://stackoverflow.com/q/20998418
score: 0
type: Comment
type: QuestionComment
has text: Put a log/`System.out.println(...)` in `ClientConnection.run()` in the EXIT block, and see if you get the same number of such printouts as you do interrupts, or monitor your `ThreadPoolExecutor` another way. If this is an educational exercise, then check out this post: http://stackoverflow.com/questions/7818248/java-socket-programming-with-concurrent-i-o

http://stackoverflow.com/q/20905754
answer count: 1
has body: Starting date is today and End date should be today's date+3 years.As an example Strating date is 3.1.2014 .End date is 3.1.2017 .I want to fill the jtable using 2D array. https://i.sstatic.net/eLR7F.jpg Date begindate = new Date(); Calendar cal = Calendar.getInstance(); cal.setTime(begindate); int today = cal.get(Calendar.DAY_OF_WEEK); cal.add(Calendar.YEAR, 3); Date enddate = cal.getTime(); Date currentdate = begindate; while (true) { if (currentdate.getTime() &gt;= enddate.getTime()) { break; } else { } Calendar c = Calendar.getInstance(); c.setTime(begindate); c.add(Calendar.DATE, x++); Date newdate = c.getTime(); int day = c.get(Calendar.DAY_OF_WEEK); currentdate = newdate; }
has comment: http://stackoverflow.com/comment/31380953
favorite count: 0
has answer: http://stackoverflow.com/a/20906170
has comment: http://stackoverflow.com/comment/31381202
type: AnsweredQuestion
upvote count: 0
tagged with: java
tagged with: hibernate
tagged with: swing
type: Question
score: -2
accepted answer: http://stackoverflow.com/a/20906170
downvote count: 2
has title: assign date values to 2D array to fill a jtable
has comment: http://stackoverflow.com/comment/31381450

http://stackoverflow.com/a/20858423
has body: You can use JSTL eq operator &lt;c:if out="${staff.staffRole eq 'Owner'}"&gt; ...... Or &lt;c:if out="${staff.staffRole == 'Owner'}"&gt; .....
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20857383

http://stackoverflow.com/comment/31308938
comment on: http://stackoverflow.com/q/20851342
type: Comment
score: 0
has text: with your kind permission, I will delete my "answer" which I now believe to be completely irrelevant to your cause.
type: QuestionComment

http://stackoverflow.com/a/20961399
has comment: http://stackoverflow.com/comment/31487729
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/20961376
score: 1
has body: Use InputMethodManager: InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0); for empty query string solution: Android SearchView.OnQueryTextListener OnQueryTextSubmit not fired on empty query string
has comment: http://stackoverflow.com/comment/31487749
downvote count: 0

http://stackoverflow.com/q/20977891
has title: Search by first name OR last name and specific related id?
tagged with: jdbc
tagged with: elasticsearch
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/20982878
has body: I am trying to find a person by first or last name all having the same building_id. For example someone will put in a name in a textfield which may be the first or last name. They'll all have the same building id. I cannot seem to find this in the documentation for elastic search. My result data looks like this: { took: 9, timed_out: false, _shards: { total: 5, successful: 5, failed: 0 }, hits: { total: 56, max_score: 1, hits: [ { _index: "jdbc", _type: "jdbc", _id: "5", _score: 1, _source: { first_name: "some first name", last_name: "some last name", building_id: 1 } }, ... ...
tagged with: search
accepted answer: http://stackoverflow.com/a/20982878
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31522538
favorite count: 0

http://stackoverflow.com/q/20941374
has title: ClassNotFoundException In a Bukkit java Plugin
tagged with: java
tagged with: bukkit
type: Question
tagged with: minecraft
has body: I'm trying to revive a plugin and im geting thir error: [03:01:18 ERROR]: Could not load 'plugins\Reporter.jar' in folder 'plugins' org.bukkit.plugin.InvalidPluginException: java.lang.ClassNotFoundException: me.f levasgr.rainbow.Reporter at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j ava:184) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks] at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager. java:308) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks] at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager .java:231) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks] at org.bukkit.craftbukkit.v1_7_R1.CraftServer.loadPlugins(CraftServer.ja va:255) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks] at org.bukkit.craftbukkit.v1_7_R1.CraftServer.&lt;init&gt;(CraftServer.java:23 3) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks] at net.minecraft.server.v1_7_R1.PlayerList.&lt;init&gt;(PlayerList.java:63) [c raftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks] at net.minecraft.server.v1_7_R1.DedicatedPlayerList.&lt;init&gt;(SourceFile:14 ) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks] at net.minecraft.server.v1_7_R1.DedicatedServer.init(DedicatedServer.jav a:126) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks] at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java :424) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks] at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:6 17) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks] Caused by: java.lang.ClassNotFoundException: me.flevasgr.rainbow.Reporter at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.7.0_25] at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.7.0_25] at java.security.AccessController.doPrivileged(Native Method) ~[?:1.7.0_ 25] at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.7.0_25] at org.bukkit.plugin.java.PluginClassLoader.findClass0(PluginClassLoader .java:80) ~[craftbukkit.jar:git-Bukki…
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/20941625
has answer: http://stackoverflow.com/a/34723811
type: UnansweredQuestion

http://stackoverflow.com/comment/31509174
comment on: http://stackoverflow.com/q/20970649
score: 0
type: Comment
type: QuestionComment
has text: Ah, yes it seems to be. I'll try and catch the header with a HttpURLConnection or similar. Thank you.

http://stackoverflow.com/comment/45145276
type: Comment
comment on: http://stackoverflow.com/a/20998961
has text: I just copied it from the `cloud-sdk` project: `repositories { mavenCentral() }`
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31663664
type: Comment
comment on: http://stackoverflow.com/a/20997209
has text: This sounds nice, but how do I get the "filteredValues collection" ? And about the other events, sort and paginate ? Thanks.
score: 0
type: AnswerComment

http://stackoverflow.com/a/20948683
has comment: http://stackoverflow.com/comment/31463374
has comment: http://stackoverflow.com/comment/31465122
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20948637
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31462404
answers question: http://stackoverflow.com/q/20948637
has body: if you define a return value you have to deliver one: public Account getAccount(int id){ Account found = null; for (Account account : accounts) { if(((Account)account).getId()==id){ found = ((Account)account); break; } } return found; } or public Account getAccount(int id){ for (Account account : accounts) { if(((Account)account).getId()==id){ return ((Account)account); } } return null; } found can be null in my example but you will always return Account or null. btw. You should use a generic list like that: List&lt;Account&gt; accounts; the advantage is that there is no typecast necessary.
type: Answer
has comment: http://stackoverflow.com/comment/31464572
score: 4
has comment: http://stackoverflow.com/comment/31464917

http://stackoverflow.com/comment/31421946
type: Comment
comment on: http://stackoverflow.com/q/20927046
score: 0
has text: Related: if it's a binary file: http://stackoverflow.com/questions/3624352/jump-on-specific-location-in-binary-file; if it's a text file: http://stackoverflow.com/questions/10102703/read-text-file-from-position-in-java
type: QuestionComment

http://stackoverflow.com/comment/31381932
has text: THANK you very much, it works fine. I haven't click on the image once i've upload it to get the link. thank you again
comment on: http://stackoverflow.com/a/20905535
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21007431
has comment: http://stackoverflow.com/comment/31573279
has title: read a txt file and manipulate the readLine strings
has comment: http://stackoverflow.com/comment/31573496
tagged with: arrays
has answer: http://stackoverflow.com/a/21008051
possible better answer: http://stackoverflow.com/a/21007732
accepted answer: http://stackoverflow.com/a/21008051
score: 0
answer count: 2
tagged with: string
has answer: http://stackoverflow.com/a/21007732
tagged with: parsing
has comment: http://stackoverflow.com/comment/31706656
has comment: http://stackoverflow.com/comment/31711620
has body: I would like to take this format: //Game, Team, Player, Position, Order, Sub----Not part of file 331027,24,7912,CF,1,1 331028,22,7913,P,1,1 331028,22,5909,1B,2,1 331028,22,8394,P,2,2 And display this data(order) based on a higher number for sub in a given order and the output will become: 331027,24,7912,CF,1 //player 7912 goes first for team 24 331028,22,7913,P,1 //player 7913 goes first for team 22 331028,22,8394,P,2 // player 8394 goes second for team 22 because he/she has higher 'Sub' order UPDATE: import java.io.BufferedReader; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; public class BattingOrder { String game_ID; String team_ID; String player_ID; String position; String battingOrder; String subOrder; public BattingOrder(String game, String team, String player, String place, String batter, String sub) { game_ID = game; team_ID = team; player_ID = player; position = place; battingOrder = batter; subOrder = sub; } @Override public String toString() { return game_ID + "," + team_ID + "," + player_ID + "," + position + "," + battingOrder; } public static void main(String[] args) throws IOException { FileInputStream fstream = new FileInputStream( "BatterInfo.txt"); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); List&lt;BattingOrder&gt; sortList = new ArrayList&lt;BattingOrder&gt;(); for (String line; (line = br.readLine()) != null;) { String delims = "[,]"; String[] parsedData = line.split(delims); sortList.add(new BattingOrder(parsedData[0], parsedData[1], parsedData[2], parsedData[3], parsedData[4], parsedData[5])); } for (BattingOrder order : sortList) { System.out.println(order); } br.close(); } } Current Output: 331027,24,7912,CF,1 331028,22,7913,P,1 331028,22,5909,1B,2 //This should be replaced by botto…
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/q/20884425
has title: How to get coloured Output on the Log file in java?
tagged with: styledtext
has comment: http://stackoverflow.com/comment/31341284
score: 2
has comment: http://stackoverflow.com/comment/31340824
has comment: http://stackoverflow.com/comment/31340965
has answer: http://stackoverflow.com/a/20884476
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31340738
has comment: http://stackoverflow.com/comment/31340784
has answer: http://stackoverflow.com/a/20884595
has body: I want to write a message in red colour on the log file in java using logger.debug method,is there any way to do it?
favorite count: 0
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/31340741
tagged with: logging
has answer: http://stackoverflow.com/a/20884580
has comment: http://stackoverflow.com/comment/31340729
tagged with: java
answer count: 3

http://stackoverflow.com/comment/31475010
has text: @njzk2 yup...I missed that completely! corrected it..thanks
comment on: http://stackoverflow.com/q/20955099
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31369426
has text: the question is incomprehensible. is impossible to answer.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20899467
score: 0

http://stackoverflow.com/comment/31375403
type: Comment
score: 0
has text: Marcin - your comment is not helpful. I know what the code does, I'm just not 100% on the terms for it.
comment on: http://stackoverflow.com/q/20901932
type: QuestionComment

http://stackoverflow.com/q/20851214
has answer: http://stackoverflow.com/a/20859857
downvote count: 0
has comment: http://stackoverflow.com/comment/31278514
favorite count: 0
tagged with: multithreading
has answer: http://stackoverflow.com/a/20859034
answer count: 4
accepted answer: http://stackoverflow.com/a/20880657
type: AnsweredQuestion
tagged with: java
tagged with: fork-join
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/48313140
tagged with: ejb
has answer: http://stackoverflow.com/a/20859333
score: 4
has title: Fork/Join for JavaEE app?
upvote count: 4
has body: I know that spinning off threads in a JavaEE application is a big no-no. However, I have an application that is a perfect candidate for Java's fork/join mechanism. But, since threads are not supposed to be created within an application, is there any way to make use of this within my EJB? I know that on WebSphere applications the async bean functionality provides this. However, my application is deployed on JBoss EAP 6.1, so this is not an option. Is there a "legal" way to accomplish fork/join within a JavaEE application?
possible better answer: http://stackoverflow.com/a/20859857
has answer: http://stackoverflow.com/a/20880657

http://stackoverflow.com/q/20925193
downvote count: 0
tagged with: resize
linked to: http://stackoverflow.com/q/9771924
has comment: http://stackoverflow.com/comment/31419049
has comment: http://stackoverflow.com/comment/31418811
answer count: 1
favorite count: 0
has title: Using ComponentAdapter to determine when Frame Resize is finished
has body: I'm using a simple ComponentAdapter to do something when the main JFrame window it's added to is resized. It's picking up the events without issue however I only want to act once a user has finished the resize. The componentResized() method fires multiple events for every pixel change of the resize and I don't want that as I need to scale an image when the window is resized and when it's done for every pixel it creates a huge lag. I tried using a MouseListener on the frame to detect mouse up and down events to set a boolean as to whether it was being currently resized or not, but the events were never being triggered. This is the simple ComponentAdapter: private class ResizeListener extends ComponentAdapter { public void componentResized(ComponentEvent e) { onResize(); } } And it is added to the frame in the constructor using this.addComponentListener(new ResizeListener()); The class is extending JFrame so it should be added to the frame. I tried using getContentPane().addComponentListener(new ResizeListener()); but that didn't make any difference. Any advice on a simple or effective way of only running the componentResized() method when the window is actually finished resizing would be appreciated. Goal I'm implementing a PDF reader which at the moment converts the page being viewed into a BufferedImage. When the user resizes the window I need to appropriately scale the image which means I can't let layout managers look after that for me. The number of componentResized events creates a huge lag as the image is being resized for every position along the user's resize path so I need to do it once the resize is finished.
tagged with: jframe
tagged with: componentlistener
accepted answer: http://stackoverflow.com/a/20926024
tagged with: swing
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/20926024
type: Question

http://stackoverflow.com/q/20852466
tagged with: java
tagged with: twitter
type: Question
has title: Implement a Twitter Like Feed(Data From Server) in a list view in Android
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: android
has body: I am looking for any suggestions/ways to implement a Twitter Like Data Feed in Android (Each Item is Clickable and opens a dialog /new activity screen on a click). The Data is fetched from server,implemented in java. IS there a common pattern/way to do this. we have implemented the server side code, serves data in JSON format. Any Suggestions/examples/references ?
has answer: http://stackoverflow.com/a/20853049

http://stackoverflow.com/comment/31352565
has text: Thank you, but I already tried that! It's really just the one line with the rendescript import, that doesn't changes automatically...
type: QuestionComment
comment on: http://stackoverflow.com/q/20875158
type: Comment
score: 0

http://stackoverflow.com/comment/31451834
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20942433
has text: It could also be prefixed with `abstract` and be an abstract method declaration in an abstract class.

http://stackoverflow.com/q/20887485
has answer: http://stackoverflow.com/a/20887526
tagged with: imageview
has title: Selector image change with background on press
tagged with: selector
tagged with: eclipse
possible better answer: http://stackoverflow.com/a/20887526
score: 0
answer count: 2
tagged with: android
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20887751
accepted answer: http://stackoverflow.com/a/20887751
has body: I have a background set in my activity_main.xml simply as that: &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/background4"&gt; And I also have this imageview: &lt;ImageView android:id="@+id/imageView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_marginTop="14dp" android:layout_toLeftOf="@+id/textView5" android:src="@drawable/contact" /&gt; and my selector.xml looks like that: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:state_pressed="true" android:drawable="@drawable/contact_pressed"/&gt; &lt;item android:state_focused="true" android:drawable="@drawable/contact"/&gt; &lt;item android:drawable="@drawable/contact"/&gt; &lt;/selector&gt; And nothing happens on image press
type: Question

sorting
tags question: http://stackoverflow.com/q/20896586
tags question: http://stackoverflow.com/q/20957596
tags question: http://stackoverflow.com/q/21011991
tags question: http://stackoverflow.com/q/20891277
tags question: http://stackoverflow.com/q/20957455
tags question: http://stackoverflow.com/q/20936818
tags question: http://stackoverflow.com/q/20902969
tags question: http://stackoverflow.com/q/20924481
tags question: http://stackoverflow.com/q/20945237
tags question: http://stackoverflow.com/q/20892992
tags question: http://stackoverflow.com/q/20903136
tags question: http://stackoverflow.com/q/20917617
tags question: http://stackoverflow.com/q/20859930
tags question: http://stackoverflow.com/q/20883397
type: Tag
tags question: http://stackoverflow.com/q/20950066
tags question: http://stackoverflow.com/q/20888333
tags question: http://stackoverflow.com/q/20946128
tags question: http://stackoverflow.com/q/20875546
tags question: http://stackoverflow.com/q/20923615
tags question: http://stackoverflow.com/q/20935931
tags question: http://stackoverflow.com/q/21011662
tags question: http://stackoverflow.com/q/20959246
tag name: sorting
tags question: http://stackoverflow.com/q/20987534
tags question: http://stackoverflow.com/q/20938318
tags question: http://stackoverflow.com/q/20974928
tags question: http://stackoverflow.com/q/20927971
tags question: http://stackoverflow.com/q/20978133
tags question: http://stackoverflow.com/q/20942518
tags question: http://stackoverflow.com/q/20951127
tags question: http://stackoverflow.com/q/20910696

wsdl
tags question: http://stackoverflow.com/q/20905926
tags question: http://stackoverflow.com/q/20901089
tags question: http://stackoverflow.com/q/20891073
tags question: http://stackoverflow.com/q/20947676
tags question: http://stackoverflow.com/q/20920693
tags question: http://stackoverflow.com/q/20891198
tags question: http://stackoverflow.com/q/20995472
tags question: http://stackoverflow.com/q/20890628
tags question: http://stackoverflow.com/q/20899520
type: Tag
tag name: wsdl
tags question: http://stackoverflow.com/q/20856880
tags question: http://stackoverflow.com/q/20967299

http://stackoverflow.com/q/20878280
favorite count: 0
type: Question
score: -2
has comment: http://stackoverflow.com/comment/31330018
has comment: http://stackoverflow.com/comment/31329876
tagged with: linked-list
has comment: http://stackoverflow.com/comment/31330033
answer count: 2
downvote count: 2
has body: Can anyone help me for below situation? List ll = new LinkedList(); ll.add(10); ll.add(20); ll.add("king"); ll.add(30); ll.add(40); I want the sum of all above integers in list.
has comment: http://stackoverflow.com/comment/31329942
tagged with: sum
has answer: http://stackoverflow.com/a/20878316
tagged with: java
type: UnansweredQuestion
upvote count: 0
has title: Retrieving integer values from LinkedList
has answer: http://stackoverflow.com/a/20878422

http://stackoverflow.com/q/21010178
has body: I don't work with JSON often, but I was having a bit of trouble just doing it in Android with no other libraries. I stumbeled upon Ion by Koush and I'd like to use it to retrieve weather data for London. The JSON api I will be using is from OpenWeather here. As far as I can tell the JSON is valid, so I am now stuck on the Android side of things. My end goal is to have an object/String that reports londons Main &gt; temp. This is my Android code, but I am unsure of what to do next. Any ideas? private void getTemperature() { Log.d(TAG, "2"); final JsonObject json = new JsonObject(); Ion.with(this, "http://api.openweathermap.org/data/2.5/weather?q=London,uk") .asJsonObject().setCallback(new FutureCallback&lt;JsonObject&gt;() { @Override public void onCompleted(Exception e, JsonObject result) { // do stuff with the result or error Log.d("TAG", "Complete"); //json = result; } }); } My code gets to the "Complete" log statement, but now I'm trying to set result to my json Object I created, so I un-comment //json = result, but I get an error in Eclipse. Any help? I would like this method to simply output the Main -&gt; Temp which (as of right now) is 284.51.
downvote count: 0
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/21010348
tagged with: android
has title: Using network library to pull down JSON
has answer: http://stackoverflow.com/a/21010235
upvote count: 2
tagged with: android-ion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/23038503
answer count: 3
accepted answer: http://stackoverflow.com/a/23038503
possible better answer: http://stackoverflow.com/a/21010235
tagged with: ion-koush
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/31390751
has text: then how should I call it?
comment on: http://stackoverflow.com/a/20909187
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21701362
score: 1
answers question: http://stackoverflow.com/q/20879485
accepted answer of: http://stackoverflow.com/q/20879485
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
has body: EJB 3.1 has (finally) standarized the global JNDI entries and your EJB code looks fine, what is failing , I think, is the config on your application.xml. Your env entry should look like this: logDirName java.lang.String /app/Project_Data/logs/ i.e. the container will set you entry under java:app/env/ by you. Cheers

http://stackoverflow.com/a/31586999
type: Answer
score: 1
answers question: http://stackoverflow.com/q/20854292
upvote count: 1
has body: You have to change: RequestHeader set X-Client-DN %{SSL_CLIENT_S_DN}e RequestHeader set X-Client-Verify %{SSL_CLIENT_VERIFY}e By: RequestHeader set X-Client-DN "%{SSL_CLIENT_S_DN_CN}s" RequestHeader set X-Client-Verify "%{SSL_CLIENT_VERIFY}s"
downvote count: 0

http://stackoverflow.com/comment/31400329
score: 1
comment on: http://stackoverflow.com/q/20895982
type: Comment
type: QuestionComment
has text: The C++ object needs to have a `QAndroidJniObject`. Alternatively, the java object can have a long pointer like in Qt Jambi. The two have to be synchronized though with some additional effort.

http://stackoverflow.com/comment/31584933
type: AnswerComment
type: Comment
has text: Str is the same as origstr, assuming you are extending op's example code. Airport -> 1234567 was a confusing description trying to describe identifying the index of the alphabetically sorted string, look at the expected outputs, where the relative alphabetical order is represented beneath each string
comment on: http://stackoverflow.com/a/21014093
score: 0

http://stackoverflow.com/comment/31530155
type: Comment
has text: Rather than trying to suss out the internal operations of Rabbit's nextDelivery() call (who knows or cares what queue implantation it is using), you should tell us what you are trying to do that you think you need to be able to intercept the interrupt state of the thread.
type: QuestionComment
comment on: http://stackoverflow.com/q/20983570
score: 1

http://stackoverflow.com/a/20930223
type: Answer
has body: public void onClick(View view) { class PostLogingDataTask extends AsyncTask&lt;Void,Void,Void&gt; { protected Void doInBackground (Void... t) { postLoginData(); } protected void onPostExecute(Void v){ // turns the text in the textview "Tbl_result" into a text string called "tblresult" TextView tblresult = (TextView) findViewById(R.id.tbl_result); // If "tblresult" text string matches the string "Login Successful! Please Wait..." exactly, it will switch to next activity if (tblresult.getText().toString().equals("Login Successful! Please Wait...")) { Intent intent = new Intent(this, Homepage.class); //take text in the username/password text boxes and put them into an extra and push to next activity EditText uname2 = (EditText)findViewById(R.id.txt_username); String username2 = uname2.getText().toString(); EditText pword2 = (EditText)findViewById(R.id.txt_password); String password2 = pword2.getText().toString(); intent.putExtra("username2", username2 + "&amp;pword=" + password2); startActivity(intent); } } } new PostLogingDataTask ().execute(); }
has comment: http://stackoverflow.com/comment/31428508
has comment: http://stackoverflow.com/comment/31428099
answers question: http://stackoverflow.com/q/20930182
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20930182
has comment: http://stackoverflow.com/comment/31428448
has comment: http://stackoverflow.com/comment/31428141

http://stackoverflow.com/comment/31305518
type: QuestionComment
has text: @kinyo Kanji literals *are* Java. The keywords and most class names are in English, but the language is quite specific about the acceptability of arbitrary Unicode. It may be a good idea to use Latin characters for linker symbols, but if you're dealing with Japanese text, use Japanese characters for your constants.
score: 1
comment on: http://stackoverflow.com/q/20865143
type: Comment

http://stackoverflow.com/comment/31352007
type: AnswerComment
comment on: http://stackoverflow.com/a/20885607
has text: I already tried that but it still says its not configured for integrated authentication.
type: Comment
score: 0

http://stackoverflow.com/comment/31569125
type: QuestionComment
has text: It hasn’t to do with English being your second language. The entire question is confused. Your are saying something about `switch` statements, then about a *concurrency problem*, and finally about *loops*. None of these artifacts has a relationship to the other. Well, besides that you might see them when programming in Java.
type: Comment
comment on: http://stackoverflow.com/q/21005383
score: 0

http://stackoverflow.com/q/21007630
has comment: http://stackoverflow.com/comment/31573285
has comment: http://stackoverflow.com/comment/31573394
linked to: http://stackoverflow.com/q/5413548
score: 0
has body: In here: The output should be 9, Why is 10? Can anybody explain me step by step?
has comment: http://stackoverflow.com/comment/31573306
has answer: http://stackoverflow.com/a/21007835
tagged with: static
has title: Constructors calling in Java
answer count: 4
has comment: http://stackoverflow.com/comment/31573217
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21007686
accepted answer: http://stackoverflow.com/a/21007686
tagged with: java
has answer: http://stackoverflow.com/a/21007741
possible better answer: http://stackoverflow.com/a/21007835
has answer: http://stackoverflow.com/a/21007846
type: Question

http://stackoverflow.com/comment/31399362
has text: This is really a regex question; you should tag it with the regex tag.
comment on: http://stackoverflow.com/q/20914975
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/20950387
answers question: http://stackoverflow.com/q/20949987
type: Answer
accepted answer of: http://stackoverflow.com/q/20949987
upvote count: 4
has body: The only one of those that is an image is Image. A more powerful sub-class of Image is BufferedImage. An ImageIcon is an image based Icon. ImageIO simply helps us to read and write images, and do other things with images. Be sure to check the JavaDocs for each. It adds more details. Image | BufferedImage | ImageIcon | ImageIO
score: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/20856943
has comment: http://stackoverflow.com/comment/31289013
score: 0
tagged with: service
has comment: http://stackoverflow.com/comment/31289152
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/31289201
has comment: http://stackoverflow.com/comment/31289080
tagged with: java
has body: I have one java application having only one class, which basically do certain things. Right now i need to run manually but actually i want to make it window service so that it run automatically at the back end. I have tried it out with Java Wrapper classes but it didn't work for me http://wrapper.tanukisoftware.com/doc/english/index.html I have stuck in it Can any body guide me how to make window service in java though wrapper class or with any other method.
answer count: 1
tagged with: window
has title: Create Window Service for java Application
has answer: http://stackoverflow.com/a/20856994

http://stackoverflow.com/comment/31365699
score: 2
has text: Play with your buffer size, it may/may not get faster.
comment on: http://stackoverflow.com/q/20897464
type: Comment
type: QuestionComment

remote-debugging
tag name: remote-debugging
type: Tag
tags question: http://stackoverflow.com/q/20930040

http://stackoverflow.com/comment/31592577
type: Comment
has text: WOW...Ok now I see ...great both links from Netbeans and here the Applet tag havent seen it before...Thank you very much
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21017512

http://stackoverflow.com/a/20962295
has comment: http://stackoverflow.com/comment/31489510
has comment: http://stackoverflow.com/comment/139987959
has comment: http://stackoverflow.com/comment/31489488
accepted answer of: http://stackoverflow.com/q/20962199
score: 1
answers question: http://stackoverflow.com/q/20962199
upvote count: 2
type: AcceptedAnswer
downvote count: 1
has body: Use two SimpleDateFormat objects - one to parse the initial String into a Date, and the other to format the resulting Date into a String. public String convert(String inputString) { SimpleDateFormat inputFormat = new SimpleDateFormat("MMddyyyy"); SimpleDateFormat outputFormat = new SimpleDateFormat("MMMM d, yyyy"); Date theDate = inputFormat.parse(inputString); return outputFormat.format(theDate); } You would probably want to create those two SimpleDateFormat objects as constants inside the class that has this method, but be aware that such an approach would make this method not thread safe.
type: Answer

http://stackoverflow.com/comment/31526052
type: QuestionComment
has text: You can't call the `remove` method on an array -- only `Object` methods.
score: 4
type: Comment
comment on: http://stackoverflow.com/q/20982043

http://stackoverflow.com/q/20953436
linked to: http://stackoverflow.com/q/2593029
has body: I know there have been quite a few similar questions but I cant find an answer to this one: I'm not very familiar with hibernate but I'm working on an app which contains an extremely slow hibernate query. This query is generated from a very simple query in the code: Criteria crit = session.createCriteria(clazz); // clazz is the class of the Entities to load return crit.list(); There are probably a lot of possibility which could make this query extremey slow (hibernate bindings, drivers, etc, etc.) but what I dont understand is the following: I set hibernate to output the SQL statements it performs. The code above is translated into an awfully long query containing 3 inner joins and 9 left outer joins, the result being displayed in a table with around 80 columns. I'm sure, however, that only this single SQL statement is produced by hibernate and executed for this code. I'm using H2 database. When I run the code within the application, it takes around 20 seconds to execute (result set contains approx 6000 rows) If I code within the application a call to Session.createSQLQuery(query).list() where query is the sql generated by hibernate for the code above, it takes approx 30 sec to execute. When I execute the SQL query directly using H2 shell or even browser client, it takes less than a second to execute. What could be the reason(s) for such a huge difference between those 3 ways of executing the same query. I would expect an overhead with hibernate, but not by this amount.
favorite count: 0
has comment: http://stackoverflow.com/comment/31556569
has comment: http://stackoverflow.com/comment/31475193
has comment: http://stackoverflow.com/comment/31497512
has comment: http://stackoverflow.com/comment/31474381
has comment: http://stackoverflow.com/comment/31532612
answer count: 0
has comment: http://stackoverflow.com/comment/31474281
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31553210
score: 2
has title: SQL query within hibernate extremely slow while very fast using SQL cient
downvote count: 0
tagged with: java
tagged with: hibernate
tagged with: h2
has comment: http://stackoverflow.com/comment/31474788
has comment: http://stackoverflow.com/comment/31474525
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/31473351

http://stackoverflow.com/comment/31511468
has text: I've followed other examples from framework. This jlong variable is used to provide a reference to determinate class. I understood that is by providing an AndroidNativeState& object (constructor), when I create my class on C++
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20973939

http://stackoverflow.com/comment/31384199
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20907502
has text: This question appears to belong on [codereview.se].
score: 5

http://stackoverflow.com/comment/31391775
score: 1
comment on: http://stackoverflow.com/a/20909901
type: AnswerComment
has text: When I added htmlunit-2.13-bin.zip it worked, very strange why with maven it doesn't.. thank you!
type: Comment

http://stackoverflow.com/comment/31423216
type: QuestionComment
comment on: http://stackoverflow.com/q/20927650
has text: Shouldn't do - writing this for a workout-logging type program,(where I'm storing the weight as a double - correct me if this is wrong) so unless people start smashing out some *very* big records, I should be okay!
score: 0
type: Comment

http://stackoverflow.com/comment/31576186
type: Comment
type: QuestionComment
has text: There is a similar hook (and sample) for the old plugin. With the old plugin there is even a simpler solution, because it allows to manipulate the POM on an object level (demonstrated in the same sample).
comment on: http://stackoverflow.com/q/20959558
score: 0

http://stackoverflow.com/comment/31588257
comment on: http://stackoverflow.com/a/21016034
has text: @NicolasZozol Your equals method is not consistent with your natural comparator. Check my edit.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31387166
has text: Can you add your `Record` class and how you create your `JAXBContext`?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20908213
score: 0

http://stackoverflow.com/a/20850785
answers question: http://stackoverflow.com/q/20850591
has comment: http://stackoverflow.com/comment/31278265
downvote count: 0
has comment: http://stackoverflow.com/comment/31277876
has body: try to uncheck "Compile on save" setting in the project properties (Build -> Compiling).
has comment: http://stackoverflow.com/comment/31277774
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/31551690
has text: @Yves030 If you don't know the count of groups, the problem is more like in this nesting part (;(\\d+-\\d+|\\d+))*. I think you expect this to give you maybe 10 or 20 groups if you have that many ranges. But the thing is there any only as many groups here as many opening brackets you have.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20995655

http://stackoverflow.com/comment/31610470
score: 0
type: AnswerComment
has text: Ok. I also synchronized some more methods than you did. But this will not solve your problem. Just did it for completeness.
type: Comment
comment on: http://stackoverflow.com/a/21020544

http://stackoverflow.com/comment/31472543
has text: Post the contents of your persistence.xml file.
type: Comment
comment on: http://stackoverflow.com/q/20907499
score: 0
type: QuestionComment

http://stackoverflow.com/a/20959522
accepted answer of: http://stackoverflow.com/q/20959303
answers question: http://stackoverflow.com/q/20959303
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/31483811
has body: A List in Java is simply an ordered sequence of objects. This concept doesn't allow for things like cycles, trees, etc. There are several implementing classes like LinkedList, ArrayList, etc., that implement Lists in different ways; the most important distinction between them is that some operations are faster with certain kinds of implementations (e.g. inserting is faster in a LinkedList than an ArrayList). However, they all implement the same basic concept, and you can't use them for something different. If you want a different kind of data structure, you'll either need to implement it yourself (which should not be too difficult) or look for some other, more general package to handle "graph" structures. Unfortunately I don't know of one offhand.

http://stackoverflow.com/comment/31523566
type: Comment
type: QuestionComment
has text: Name your `Ball` variable something other than `i`, which is already used as the `for` loop index.
score: 2
comment on: http://stackoverflow.com/q/20980785

http://stackoverflow.com/a/21003043
answers question: http://stackoverflow.com/q/21002996
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21002996
has comment: http://stackoverflow.com/comment/31566808
has comment: http://stackoverflow.com/comment/31566746
type: Answer
has comment: http://stackoverflow.com/comment/31564118
score: 12
has comment: http://stackoverflow.com/comment/31564538
has body: Essentially deprecated is a warning to you as a developer that while the method/class/whatever is there and works it is not the best way to do it. Either a newer and better alternative is available or (sometimes) there is something subtly broken about it that makes it not advisable to use. You can still use deprecated things - but you should look to see why they are deprecated first and see if the new way of doing things is better for you. In theory deprecated things can or will in future be removed. That rarely happens (some Java libraries have deprecated stuff in them that is more than ten years old) but is a risk you should be aware of.
has comment: http://stackoverflow.com/comment/31564902
has comment: http://stackoverflow.com/comment/31565619
has comment: http://stackoverflow.com/comment/31566710
upvote count: 12
has comment: http://stackoverflow.com/comment/31564162

http://stackoverflow.com/q/20966388
type: Question
has comment: http://stackoverflow.com/comment/31496609
has title: Collections.synchronizedList vs Vector
tagged with: thread-safety
duplicate of: http://stackoverflow.com/q/2883140
score: 12
answer count: 1
downvote count: 1
upvote count: 13
favorite count: 0
has body: I would like to use collection classes for adding,removing and retrieving objects in multiple thread. Collections.synchronizedList and Vector both classes are thread safe. Does any tell me the difference between Collections.synchronizedList and Vector and explain that when should I use Vector and Collections.synchronizedList?
has answer: http://stackoverflow.com/a/20966451
type: UnansweredQuestion
tagged with: java
tagged with: multithreading
tagged with: collections

http://stackoverflow.com/comment/31348166
score: 1
comment on: http://stackoverflow.com/a/20887602
type: AnswerComment
type: Comment
has text: @MartijnCourteaux Woah, that's great :P Still Python 2 wins on this one: `'string'.encode('rot13')` :P

http://stackoverflow.com/comment/31651339
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20916084
type: AnswerComment
has text: What I ended up doing is adding the following to `/etc/environment`: `JAVA_OPTS="$JAVA_OPTS -Xms256m -Xmx256m"`

http://stackoverflow.com/q/20926630
answer count: 4
has comment: http://stackoverflow.com/comment/31421094
tagged with: java
has comment: http://stackoverflow.com/comment/31421246
type: Question
has comment: http://stackoverflow.com/comment/31421018
has answer: http://stackoverflow.com/a/20926754
has comment: http://stackoverflow.com/comment/31421086
has comment: http://stackoverflow.com/comment/31421406
has answer: http://stackoverflow.com/a/20926740
has answer: http://stackoverflow.com/a/20926727
has comment: http://stackoverflow.com/comment/31421075
has comment: http://stackoverflow.com/comment/31421076
score: 0
tagged with: numberformatexception
has body: I have a folder with files and name of file are integers like 110045, 56789449 etc.files contains text values. I want to store the filename as key and its content as value in a treemap. but it gives number format exception: public void ReadDir()throws Exception{ Map&lt;Integer,List&lt;String&gt;&gt; tweet = new TreeMap&lt;Integer,List&lt;String&gt;&gt;(); File dr = new File("/home/abc/NetBeansProjects/cleantweet"); if(dr.isDirectory()){ String dirlist[] = dr.list(); int nfiles= dirlist.length; System.out.print("no 0f user tweet files "+ nfiles +"\n"); for(int i =0;i&lt;nfiles;i++){ tw.assignVal(dirlist[i]); } } public void assignVal(String filename) throws Exception { FileReader fr1 = new FileReader("/home/abc/NetBeansProjects/cleantweet/"+filename); BufferedReader br1 = new BufferedReader(fr1); String str=""; while ((str = br1.readLine()) != null) { assignment.put(str,rand.nextInt(topics-1)+1); recsys.tweet.put(Integer.parseInt(filename),list);// this line gives error } }
has answer: http://stackoverflow.com/a/20926820
has comment: http://stackoverflow.com/comment/31421187
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31421026
has title: storing the filename in a integer variable in java

http://stackoverflow.com/comment/31324765
type: Comment
type: QuestionComment
has text: The only approach I can think of would be to make the load lazy and to force it yourself in a `@PostLoad` method on `R`.
comment on: http://stackoverflow.com/q/20875260
score: 0

http://stackoverflow.com/q/20913718
tagged with: algorithm
has comment: http://stackoverflow.com/comment/31443002
tagged with: java
has comment: http://stackoverflow.com/comment/31418358
has answer: http://stackoverflow.com/a/20913769
has title: Recamans sequence for 20132014th term
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/20913774
tagged with: logic
has comment: http://stackoverflow.com/comment/31397109
tagged with: sequence
has comment: http://stackoverflow.com/comment/31413173
type: UnansweredQuestion
has body: I want a algorithm to generate recamans term within 30 second as given in the problem! Java code: int a0=0; int a1; System.out.println("Enter the term for which Recman sequence need to be calculated"); int n=Integer.parseInt(bfr.readLine()); list.add(a0); for(int i = 1; i &lt;= n; i++) { a1 = a0 - i; if(a1 &gt; 0 &amp;&amp; !list.contains(a1)) { a0 = a1; list.add(a0); } else { a1 = a0 + i; a0 = a1; list.add(a0); } System.out.println(a0); } System.out.println("The" + n + "th term is " + a0); } } The program runs indefinitely, is there any alternate algorithm to generate the result in 30 second?
type: Question

http://stackoverflow.com/comment/70499223
has text: OP specifically asked for the duration of the file.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20957878

http://stackoverflow.com/comment/31364431
score: 0
comment on: http://stackoverflow.com/q/20896705
type: Comment
type: QuestionComment
has text: so EditText weight = (EditText) layout.findViewById(99);?

http://stackoverflow.com/a/20937398
type: Answer
has body: I'm not sure what you mean by "is it possible using endElement", but it's certainly possible. You'd need to write your SAX application so it: (1) ignores all startElement/endElement events between the ones for the &lt;p&gt;aragraph -- simple state tracking, or perhaps you can simply say that you aren't interested in elements other than paragraphs and make your element event handlers be no-ops for anything you don't care about. (2) accumulates separately-delivered characters() events until the endElement for the &lt;p&gt;aragraph. But you need to do this anyway, because SAX always reserves the right to deliver contiguous text as several characters() calls, for reasons having to do with parser buffer management.
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/20937270

http://stackoverflow.com/a/20941716
has body: If you encapsulate some of the similar tasks to separate methods, it should make your code a little cleaner. try this.Hope this helps public static void main(String[] args) { System.out .println("Welcome to the GPA calculator! Please enter your GPA into the popup window to find your GPA."); String firstClassInput = JOptionPane .showInputDialog(null, "Please enter your grade for your first class: (A+, A, A-, B+, etc.)"); String firstClass = firstClassInput.toUpperCase(); String secondClassInput = JOptionPane .showInputDialog(null, "Please enter your grade for your second class: (A+, A, A-, B+, etc.)"); String secondClass = secondClassInput.toUpperCase(); String thirdClassInput = JOptionPane .showInputDialog(null, "Please enter your grade for your third class: (A+, A, A-, B+, etc.)"); String thirdClass = thirdClassInput.toUpperCase(); String fourthClassInput = JOptionPane .showInputDialog(null, "Please enter your grade for your fourth class: (A+, A, A-, B+, etc.)"); String fourthClass = fourthClassInput.toUpperCase(); String fifthClassInput = JOptionPane .showInputDialog(null, "Please enter your grade for your fifth class: (A+, A, A-, B+, etc.)"); String fifthClass = fifthClassInput.toUpperCase(); List&lt;String&gt; listOfGrades = new ArrayList&lt;String&gt;(); listOfGrades.add(firstClass); listOfGrades.add(secondClass); listOfGrades.add(thirdClass); listOfGrades.add(fourthClass); listOfGrades.add(fifthClass); double GPA = getGPA( listOfGrades ); System.out.println("Your GPA is: " + GPA); } /** * Used to calculate GPA from list of supplied grades * * @param listOfGrades as list of grades to compute GPA * @return GPA as double */ public static double getGPA(List&lt;String&gt; listOfGrades){ double total = 0.0; double GPA = 0.0; for(String aGrade: listOfGrades){ total += getGrade( aGrade ); } GPA = total / listOfGrades.size(); System.out.println("Total "+total+" amount of grades: "+listOfGrades.size()); return GPA; } /** * Get value of grade as a double type * * @param …
type: Answer
answers question: http://stackoverflow.com/q/20941509
score: 0

http://stackoverflow.com/comment/31484442
comment on: http://stackoverflow.com/a/20959416
type: AnswerComment
score: 0
type: Comment
has text: Eh, disregard. It'd be nice to have duplicate usernames across organizations, but that'd require some way of figuring out what the organization is so it can be combined with the username. I'll just name the username unique. Thanks for the answer!

http://stackoverflow.com/comment/31536359
comment on: http://stackoverflow.com/q/20987636
score: 1
has text: One simple option: append the current year (in whatever time zone you're interested in) before parsing. I know it's not ideal, but it's pragmatic...
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31554707
type: QuestionComment
comment on: http://stackoverflow.com/q/20997054
has text: @AndrewThompson the user can only read the error messages, click ok and fill corectly the forms.
score: 0
type: Comment

http://stackoverflow.com/a/20854520
score: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20854371
answers question: http://stackoverflow.com/q/20854371
upvote count: 3
type: Answer
has body: To codify True Soft's answer, String roundString; if (round < halfRoundMark) { roundString = ("team " + (home + 1) + " plays against team " + (away + 1)); } else { roundString = ("team " + (away + 1) + " plays against team " + (home + 1)); } rounds[round][match] = roundString; where int halfRoundMark = (totalRounds / 2);
downvote count: 0

http://stackoverflow.com/comment/31531844
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20984786
has text: This doesn't answer your question, but are you familiar with [Parallel Deployment](http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Parallel_deployment) in Tomcat? Here is an article on it: http://www.objectpartners.com/2012/04/17/tomcat-v7-parallel-deployment/
score: 1

http://stackoverflow.com/comment/31528004
type: QuestionComment
has text: Well, you either want an integer, or you want something more. Perhaps you should get your requirements straight in your own mind, before you ask the Stack Overflow community to write code that meets those requirements. I am tempted to downvote EVERY answer on this page, for writing code before the requirements were known; but that seems unkind.
comment on: http://stackoverflow.com/q/20982283
score: 0
type: Comment

http://stackoverflow.com/comment/31428844
score: 0
comment on: http://stackoverflow.com/q/20930400
has text: ok but i tried your code it does not crash
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31543282
type: Comment
has text: @Bathsheba A good point, answer updated... Or even explain "reuluctantly"
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20991698

http://stackoverflow.com/comment/31478822
has text: when I write it, should I also use outputbuffer array ?
type: Comment
comment on: http://stackoverflow.com/a/20956822
score: 0
type: AnswerComment

http://stackoverflow.com/a/20867242
has comment: http://stackoverflow.com/comment/31309052
type: AcceptedAnswer
has body: You can try this. Make sure the jars are in proper paths. In Java 6 or later java -cp ".;JAR_NAME.jar;lib/MORE.jar;lib/*" classname
upvote count: 1
accepted answer of: http://stackoverflow.com/q/20867208
type: Answer
answers question: http://stackoverflow.com/q/20867208
downvote count: 0
score: 1

guava
tags question: http://stackoverflow.com/q/20972914
tags question: http://stackoverflow.com/q/20945602
tags question: http://stackoverflow.com/q/20938016
tags question: http://stackoverflow.com/q/20957221
tags question: http://stackoverflow.com/q/20994689
tags question: http://stackoverflow.com/q/20969003
tags question: http://stackoverflow.com/q/20973906
tags question: http://stackoverflow.com/q/20874859
tags question: http://stackoverflow.com/q/20973779
tags question: http://stackoverflow.com/q/20980225
tag name: guava
type: Tag

http://stackoverflow.com/comment/31520410
type: QuestionComment
comment on: http://stackoverflow.com/q/20978550
has text: i added my context.xml to that directory, but stills the same.. also if i connect using: Class.forName("com.mysql.jdbc.Driver"); Connection connection = DriverManager.getConnection("jdbc:mysql://localhost/dbaplicacion", "test", "test"); My code works..
score: 0
type: Comment

http://stackoverflow.com/a/20985952
type: Answer
has comment: http://stackoverflow.com/comment/31534561
has comment: http://stackoverflow.com/comment/31534583
answers question: http://stackoverflow.com/q/20985872
upvote count: 3
has comment: http://stackoverflow.com/comment/31554775
score: 3
has body: You first stop for questions like these should be the API. JComboBox.setOpaque(false);
downvote count: 0
has comment: http://stackoverflow.com/comment/31534192

http://stackoverflow.com/a/20944183
score: 0
has body: Declare Handler at class level: Handler handler; Initialize Handler in onCreate() method of Activity: // Doing this inside the onCreate() method of Activity // will help the handler to hold the reference to this Activity. handler = new Handler(); Call it within the background thread: @Override protected String doInBackground(String... params) { handler.post(new Runnable(){ public void run(){ // SET UI COMPONENTS FROM HERE. } }); }
type: Answer
answers question: http://stackoverflow.com/q/20943837
has comment: http://stackoverflow.com/comment/31455265
has comment: http://stackoverflow.com/comment/31455327

http://stackoverflow.com/q/20937409
tagged with: big-o
has comment: http://stackoverflow.com/comment/31444338
has comment: http://stackoverflow.com/comment/31442152
tagged with: java
has comment: http://stackoverflow.com/comment/31441929
has answer: http://stackoverflow.com/a/20945765
type: Question
has body: I am trying to Implement a solutions to find k-th largest element in a given integer list with duplicates with O(N*log(N)) average time complexity in Big-O notation, where N is the number of elements in the list. As per my understanding Merge-sort has an average time complexity of O(N*log(N)) however in my below code I am actually using an extra for loop along with mergesort algorithm to delete duplicates which is definitely violating my rule of find k-th largest element with O(N*log(N)). How do I go about it by achieving my task O(N*log(N)) average time complexity in Big-O notation? public class FindLargest { public static void nthLargeNumber(int[] arr, String nthElement) { mergeSort_srt(arr, 0, arr.length - 1); // remove duplicate elements logic int b = 0; for (int i = 1; i &lt; arr.length; i++) { if (arr[b] != arr[i]) { b++; arr[b] = arr[i]; } } int bbb = Integer.parseInt(nthElement) - 1; // printing second highest number among given list System.out.println("Second highest number is::" + arr[b - bbb]); } public static void mergeSort_srt(int array[], int lo, int n) { int low = lo; int high = n; if (low &gt;= high) { return; } int middle = (low + high) / 2; mergeSort_srt(array, low, middle); mergeSort_srt(array, middle + 1, high); int end_low = middle; int start_high = middle + 1; while ((lo &lt;= end_low) &amp;&amp; (start_high &lt;= high)) { if (array[low] &lt; array[start_high]) { low++; } else { int Temp = array[start_high]; for (int k = start_high - 1; k &gt;= low; k--) { array[k + 1] = array[k]; } array[low] = Temp; low++; end_low++; start_high++; } } } public static void main(String... str) { String nthElement = "2"; int[] intArray = { 1, 9, 5, 7, 2, 5 }; FindLargest.nthLargeNumber(intArray, nthElement); } }
has comment: http://stackoverflow.com/comment/31442565
tagged with: algorithm
linked to: http://stackoverflow.com/q/20918887
has comment: http://stackoverflow.com/comment/31441977
has answer: http://stackoverflow.com/a/20942964
has comment: http://stackoverflow.com/comment/31442061
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31441816
has comment: http://stackoverflow.com/comment/31441834
has title: violating the given average time complexity in Big-O notation
has comment: http://stackoverflow.com/comment/31444058
has comment: http://stackoverflow.com/comment/31442035
has comment: http://stackoverflow.com/comment/31441814
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31442384
has comment: http://stackoverflow.com/comment/31444392
has comment: http://stackoverflow.com/comment/31441891

http://stackoverflow.com/comment/31515472
type: Comment
type: QuestionComment
has text: Post code that we can understand. Swing uses JTable and JCheckBox. We have no idea what Table and Checkbox are. We also have no idea what the createCell() method does. So I would guess the problem is with your create cell code.
comment on: http://stackoverflow.com/q/20967823
score: 0

http://stackoverflow.com/comment/31366193
score: 0
comment on: http://stackoverflow.com/q/20897368
type: QuestionComment
has text: Downgrade your firefox and upgrade your webdriver this will fix your issue.
type: Comment

http://stackoverflow.com/q/20912405
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20912449
answer count: 2
tagged with: lazy-initialization
downvote count: 0
has body: I have singleton A.class. Runnable loadTask may be evoked or not, that's why I'm thinking about lazy initialization. I'm concerned about memory usage. So the question is Does lazy initialization worthy to be implemented? Or memory for function body consumes little more then memory for instant initialization and easier to ignore memory consumption difference. I understand that the definition of the function MUST consumes memory somewhere. P.S. I understand that memory for function body is not allocated in Heap. P.S. Instrumentation.class, sizeOf, Runtime.freeMemory() works with class fields/attributes only. class A_LazyInit { Runnable loadTask; void load() { if(loadTask == null) loadTask = new Runnable() { public void run() { loadFileFromInternet(); } }; new Thread(loadTask).start(); } void useMethod() { if(isGoodCondition()) load(); } } vs class A { Runnable loadTask = new Runnable() { public void run() { loadFileFromInternet(); } }; void useMethod() { if(isGoodCondition()) new Thread(loadTask).start(); } }
upvote count: 1
has comment: http://stackoverflow.com/comment/31394828
favorite count: 0
has answer: http://stackoverflow.com/a/20912561
tagged with: memory-management
has title: Is lazy initialization worthy to be for small piece of code?
type: UnansweredQuestion

http://stackoverflow.com/comment/31463012
type: Comment
has text: You shouldn't read a socket input stream a byte at a time: it's most inefficient. transferTo() needs to be called in a loop. It isn't guaranteed to transfer the entire length in a single call.
comment on: http://stackoverflow.com/a/20947561
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31476871
type: QuestionComment
type: Comment
has text: I suggest you use a `java.util.Scanner`, it has several helpful methods (like `nextDouble()`).
score: 1
comment on: http://stackoverflow.com/q/20956185

http://stackoverflow.com/q/20992340
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
type: Question
has body: I want to use LDAP in my application in order to authenticate I used in my previous config the database to authenticate this is my previous config : &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.1.xsd"&gt; &lt;http auto-config="true" use-expressions="true"&gt; &lt;intercept-url pattern="/test/**" access="hasRole('ADMIN')" /&gt; &lt;intercept-url pattern="/test1/**" access="hasRole('USER')" /&gt; &lt;form-login login-page="/index.htm" authentication-success-handler-ref="authenticationSuccessRedirecthandler" default-target-url = "/test/MainHealthCertificat.htm" authentication-failure-url="/index.htm?error=1"/&gt; &lt;logout logout-success-url="/index.htm" /&gt; &lt;/http&gt; &lt;beans:bean class="com..CustomAuthenticationHandler" id="authenticationSuccessRedirecthandler"&gt;&lt;/beans:bean&gt; &lt;authentication-manager&gt; &lt;authentication-provider&gt; &lt;jdbc-user-service data-source-ref="dataSource" users-by-username-query="select username, password, enabled from users where username=?" authorities-by-username-query="select u.username, ur.authority from users u, user_roles ur where u.user_id = ur.user_id and u.username =? " /&gt; &lt;/authentication-provider&gt; &lt;/authentication-manager&gt; &lt;/beans:beans&gt; this is my java class : public class CustomAuthenticationHandler extends SimpleUrlAuthenticationSuccessHandler { @Override public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws ServletException, IOException { String adminTargetUrl = "/test/mypage.htm"; Set&lt;String&gt; roles = AuthorityUtils.authorityLis…
tagged with: java
tagged with: active-directory
has title: LDAP with Spring
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/21905633

http://stackoverflow.com/a/21156693
has body: HikariCP, as of version 1.2.6, now supports Hibernate 4.x explicitly with a ConnectionProvider. See the new wiki documentation for details.
type: Answer
upvote count: 13
downvote count: 1
accepted answer of: http://stackoverflow.com/q/20899455
has comment: http://stackoverflow.com/comment/77915326
answers question: http://stackoverflow.com/q/20899455
score: 12
has comment: http://stackoverflow.com/comment/135460595
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31853632

http://stackoverflow.com/comment/31491500
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20963190
has text: *"I'm using AbsoluteLayout. Is there a problem with that?"* - Plenty. The Swing API was designed to be used with layout managers, so it's entire internal mechanism revolves around the ability to provide useful information to that part of the API to allow it to respond to various changes in the system. Layout managers resolve you of the wonderful issues surrounding fonts, font metrics and the variety of paint pipelines present in modern GUI based operating systems. Absolute positing is, generally, a fallacy, which when put up against simple user metrics and guidelines, becomes insignificant

http://stackoverflow.com/a/20977237
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20975789
downvote count: 0
has comment: http://stackoverflow.com/comment/31541265
has comment: http://stackoverflow.com/comment/31541770
type: Answer
has comment: http://stackoverflow.com/comment/31541672
has comment: http://stackoverflow.com/comment/31521973
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/31540004
has comment: http://stackoverflow.com/comment/31546708
has comment: http://stackoverflow.com/comment/31546327
has body: You have made a mistake either choosing a result type or location. Because "Fabric.jsp" or "Fabric.action" aren't valid action names. @Result(name=ActionSupport.SUCCESS, type="redirectAction", location="Fabric.jsp", should be a dispatcher result @Result(name=ActionSupport.SUCCESS, location="Fabric.jsp", or redirectAction result @Result(name=ActionSupport.SUCCESS, type="redirectAction", location="Fabric" If you use redirectAction result type the new action class instance is created by default in which a prepare method is executed before the action. You can check this if you print hashCode() should be different even if different action names. So, no prepare method called twice as it only prepare interceptor in the stack of each action. On the other hand if you use paramsPrepareParamsStack the params interceptor is called twice: before and after prepare interceptor.
answers question: http://stackoverflow.com/q/20975789

http://stackoverflow.com/q/20897078
has answer: http://stackoverflow.com/a/20912782
answer count: 1
has body: I'm getting a Bearer access token passed to my restful service on the Authorization header. I'm trying to retrieve some basic information like email address from the account having only the access token. According to the google oauth java client documentation it can be done like this: GoogleCredential credential = new GoogleCredential().setAccessToken(accessToken); Plus plus = Plus.builder(new NetHttpTransport(), new JacksonFactory()) .setApplicationName("Google-PlusSample/1.0") .setHttpRequestInitializer(credential) .build(); Found it here: https://code.google.com/p/google-api-java-client/wiki/OAuth2#Overview First, I can't seem to be able to resolve the Plus class. Where is it located? I can't find anywhere in the documentation where it's coming from. Jars resolved through Maven don't seem to have that class. What am I missing? Edit: Found where the Plus class was hiding. I am however still not sure how to actually get any useful information back, having just the access token. com.google.apis google-api-services-plus v1-rev115-1.17.0-rc
tagged with: google-api
type: UnansweredQuestion
tagged with: java
tagged with: oauth-2.0
type: Question
score: 0
has title: Retrieving user info in an OAuth2 auth flow having only an access token

http://stackoverflow.com/comment/31495445
comment on: http://stackoverflow.com/q/20965807
type: Comment
type: QuestionComment
has text: `j<= c.length` This might cause `ArrayIndexOutOfBoundsException`.
score: 0

http://stackoverflow.com/comment/31449054
score: 0
type: Comment
type: QuestionComment
has text: I wonder why Eclipse didn't catch that when it compiled the XML?
comment on: http://stackoverflow.com/q/20940931

http://stackoverflow.com/a/53921722
type: Answer
has body: tomcat config: go to vmoptions set -Dsun.rmi.transport.tcp.responseTimeout=30000 (milliseconds) websphere config: go to Application servers > server1 > Process definition > Java Virtual Machine set -Dsun.rmi.transport.tcp.responseTimeout=30000 in Generic JVM arguments section
score: 0
answers question: http://stackoverflow.com/q/20934625

http://stackoverflow.com/q/20963889
has body: We are developing a web application in java with spring security. I tasked to add support for authenticating our users against Active Directory. For this, I promoted one of our 2008 server to domain control and added a snippet with ActiveDirectoryLdapAuthenticationProvider spring class to authenticate login user. It worked fine with ldap and ldaps protcols. But couple of questions: 1)ActiveDirectoryLdapAuthenticationProvider constructor is only taking AD url and domain name unlike LdapAuthenticationProvider for OpenLDAP, which needs mote input details like managerDN, manager password, user search base and group search base etc. Shouldn't Active Directory need all this data? I thought at least it would need manager user/password to allow connections! Of course, in my test routine, I supplied only url and domain and it successfully authenticated users. 2) I need to write quick connectivity test routine to verify whether user entered AD url and domain are valid or not. How to do it? Btw, our application will be deployed on Ubuntu. Thanks.
tagged with: spring-security
tagged with: ldap
type: UnansweredQuestion
tagged with: spring
tagged with: java
type: Question
has title: Active-Directory Connectivity test and some configuration details
has answer: http://stackoverflow.com/a/21029801
tagged with: active-directory
score: 0
answer count: 1

http://stackoverflow.com/q/20955438
tagged with: swing
has title: Java Timer repeats when shouldn't
has body: I wanted to make a program, that shows some pictures on the screen along with a string and an animation. I made it like so: package Package; import java.awt.*; import java.awt.event.*; import javax.swing.*; @SuppressWarnings("serial") public class runScreen extends JFrame { public static void main(String[] arg) { DisplayMode dm = new DisplayMode(1920, 1080, 16, DisplayMode.REFRESH_RATE_UNKNOWN); runScreen b = new runScreen(); b.getContentPane().setBackground(Color.CYAN); b.startScreen(dm); } private Screen s; private Image logo; private Image animation1; private Image animation2; private Image animation3; private boolean isLoaded; private static int testTime=5000; public void startScreen(DisplayMode dm) { setForeground(Color.blue); setFont(new Font("Agency FB", Font.PLAIN, 50)); isLoaded=false; s=new Screen(); s.setFullScreen(dm, this); loadGraphics(); Timer timer = new Timer(testTime, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { s.restoreScreen(); } }); timer.setRepeats(false); timer.start(); } private void loadGraphics() { logo= new ImageIcon("C:\\test\\Atom.png").getImage(); animation1=new ImageIcon("C:\\test\\Red.png").getImage(); animation2=new ImageIcon("C:\\test\\Green.png").getImage(); animation3=new ImageIcon("C:\\test\\Blue.png").getImage(); isLoaded=true; repaint(); } public void paint(Graphics g) { super.paint(g); if(g instanceof Graphics2D) { Graphics2D g2=(Graphics2D)g; g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); } if(isLoaded) { g.drawImage(logo,850,100,null); g.drawString("Atom", 900, 500); boolean canAnimationRun=true; int animationTime=0; while(canAnimationRun) { if(animationTime&lt;testTime &amp;&amp; canAnimationRun) { g.drawImage(animation1,850,800,null); try{Thread.sleep(1000);} catch(Exception e){e.printStackTrace();} animationTime+=1000; }else{canAnimationRun=false;} if(animationTime&lt;testTime &amp;&amp; canAnimationRun) { g.drawImage(animation2,850,800,…
tagged with: paint
tagged with: java
tagged with: timing
type: Question
tagged with: fullscreen
has comment: http://stackoverflow.com/comment/31476087
score: 0
has comment: http://stackoverflow.com/comment/31475902
answer count: 1
has answer: http://stackoverflow.com/a/20955736
type: UnansweredQuestion

http://stackoverflow.com/comment/31294419
score: 6
has text: "Now I know its bad and everything and code should not be programmed like this" - why do you want to keep doing it then, rather than exploring better designs? Why would you want to use `goto` rather than a loop, when a loop is the natural approach?
comment on: http://stackoverflow.com/q/20859688
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20961277
has comment: http://stackoverflow.com/comment/31493004
upvote count: 1
has body: Answering the title of your question - Bounding box doesn't rotate when the sprite rotates In computer graphics the most common implementation of a bounding box is the Axis-aligned minimum bounding box which obviously will not rotate when you rotate your sprite because it is axis aligned. I am not aware of what implementation the Java 2D package you are using implements but it certainly sound like this and not an Arbitrarily oriented minimum bounding box as you hoped. Perhaps the rendering of your bounding box somehow assumes that it is axis-aligned and therefore fails to render when you present it with a box that is not axis-aligned.
answers question: http://stackoverflow.com/q/20960331
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/21175145
upvote count: 2
has body: Are you loading the correct Activity? you need to edit the manifest to make it load your custom activity. You should also avoid calling the constructor of the QtActivity class yourself (advClass_("adv/appBucksAdv")), as it will attempt to prepare the application again. What you probably want is a handle to the activity and since you are already extending the QtActivity class, just add a static function that returns a handle to it. E.g.: Java: public class appBucksAdv extends QtActivity { ... static appBucksAdv getActivity() { return thisActivity; } ... } C++ QAndroidJniObject activity = QAndroidJniObject::callStaticObjectMethod("adv/appBucksAdv", "getActivity", "()Ladv/appBucksAdv;");
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/20864758
score: 2
answers question: http://stackoverflow.com/q/20864758

http://stackoverflow.com/a/20930277
type: Answer
score: 0
answers question: http://stackoverflow.com/q/20930139
has body: There's really not much you can do, but try to reorganize it in a way that reads best. Many programmers will pick and choose their style; my advice is to pick a style and stick to it. For instance, a hit of the return key and a few keystrokes in IntelliJ 13 gets me this: public Where&lt;Item, Integer&gt; getWhereSearchOnNameLight(String searchName) { try { return itemsDao.queryBuilder() .selectColumns(Item.COLUMN_ID, Item.COLUMN_NAME, Item.COLUMN_CATEGORY_ID) .where() .like(Item.COLUMN_NAME, "%" + searchName + "%"); } catch (SQLException e) { e.printStackTrace(); } return null; } And that is my preferred style, where applicable.

http://stackoverflow.com/comment/107165217
type: Comment
comment on: http://stackoverflow.com/a/21843984
score: 1
has text: Maybe Java has its reason to ban `new T()`, but why also ban `new T[n]`?
type: AnswerComment

jpype
tag name: jpype
type: Tag
tags question: http://stackoverflow.com/q/21006124

http://stackoverflow.com/comment/31534170
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20986248
has text: This question appears to be off-topic because it is about a matter that is better answered by referring to the [API documentation](http://docs.oracle.com/javase/7/docs/api/).
score: 4

http://stackoverflow.com/comment/31547918
type: QuestionComment
comment on: http://stackoverflow.com/q/20992496
has text: Yes I want to consider April in case of 1986-04-02 however the current date that is January 2014 (Month January) it should calculate only till December 2013. TRICKY!
score: 0
type: Comment

http://stackoverflow.com/comment/58152493
comment on: http://stackoverflow.com/a/22700075
type: Comment
has text: Question how to resolve using loopj. Don't suggest new plugin.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31367135
has text: Can you suggest me how to do ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20897817
type: Comment

algorithm
tags question: http://stackoverflow.com/q/20929077
tags question: http://stackoverflow.com/q/20979844
tags question: http://stackoverflow.com/q/21014916
tag name: algorithm
tags question: http://stackoverflow.com/q/20879124
tags question: http://stackoverflow.com/q/20890802
tags question: http://stackoverflow.com/q/20924418
tags question: http://stackoverflow.com/q/21006601
tags question: http://stackoverflow.com/q/20892506
tags question: http://stackoverflow.com/q/20875507
tags question: http://stackoverflow.com/q/20870150
tags question: http://stackoverflow.com/q/20922436
tags question: http://stackoverflow.com/q/20886486
tags question: http://stackoverflow.com/q/20929913
tags question: http://stackoverflow.com/q/20879858
tags question: http://stackoverflow.com/q/20874304
tags question: http://stackoverflow.com/q/20904110
tags question: http://stackoverflow.com/q/20869398
type: Tag
tags question: http://stackoverflow.com/q/20932930
tags question: http://stackoverflow.com/q/20910696
tags question: http://stackoverflow.com/q/21003822
tags question: http://stackoverflow.com/q/20937103
tags question: http://stackoverflow.com/q/20891390
tags question: http://stackoverflow.com/q/20913718
tags question: http://stackoverflow.com/q/20934412
tags question: http://stackoverflow.com/q/20937409
tags question: http://stackoverflow.com/q/20935315
tags question: http://stackoverflow.com/q/20872543
tags question: http://stackoverflow.com/q/20965229
tags question: http://stackoverflow.com/q/21010881
tags question: http://stackoverflow.com/q/20918887
tags question: http://stackoverflow.com/q/20920803
tags question: http://stackoverflow.com/q/20875383
tags question: http://stackoverflow.com/q/20886882
tags question: http://stackoverflow.com/q/20916776
tags question: http://stackoverflow.com/q/20902223
tags question: http://stackoverflow.com/q/20957023

http://stackoverflow.com/a/20880800
has comment: http://stackoverflow.com/comment/31369962
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/20880674
has body: Actually the problem you are facing can be solve in linear time using the partitioning that is part of the quick sort algorithm(Have a look here). If you really need and O(N*log(N)) algorithm than most efficient sorting algorithms will do - for instance quick sort, merge sort, heap sort.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20880674
downvote count: 0
has comment: http://stackoverflow.com/comment/31370000

http://stackoverflow.com/a/20879157
answers question: http://stackoverflow.com/q/20850133
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: what you explain here is a feature of the JavaFX SceneGraph: A Child node can be drawn outside of the bounds of it's parent. I you want to cut the edges you need to use the setClip(...) method of the Node class. A example can be found here: http://blog.ngopal.com.np/2011/06/22/masking-in-javafx-2-0/
upvote count: 1
accepted answer of: http://stackoverflow.com/q/20850133
score: 1

http://stackoverflow.com/comment/31364285
comment on: http://stackoverflow.com/q/20896432
score: 0
has text: Right guys if you actually read my question.. My results are the exact OPPOSITE of said question. I have already read it.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31559016
type: Comment
has text: Yes dziękuję ;) :D , you are 100% right ! It's working as i want. Thank you ! But I'm wondering how the loop is waiting until the upload is done whithout `wait()` or `notify()` ?
comment on: http://stackoverflow.com/a/20998959
score: 0
type: AnswerComment

http://stackoverflow.com/a/20905172
has comment: http://stackoverflow.com/comment/31459464
answers question: http://stackoverflow.com/q/20897515
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/31462490
score: 2
has body: Using create-session="stateless" means that you are telling Spring Security not to create a session or store the authentication information for the user. It won't stop other libraries from creating a session if they feel the need to (oauth is a separate project). I don't really understand why you are labelling the application as stateless, since you are using things like form login. If you don't allow a session to be created, how will somthing like the authorization code flow work? How is the authorization request cached and how will the server know the user is authenticated when they are redirected back to that request? The authentication will be lost since there is no session to tie it to.
has comment: http://stackoverflow.com/comment/31403637
has comment: http://stackoverflow.com/comment/31412601
has comment: http://stackoverflow.com/comment/31453311
accepted answer of: http://stackoverflow.com/q/20897515
has comment: http://stackoverflow.com/comment/31464291

http://stackoverflow.com/a/20922474
score: 1
has comment: http://stackoverflow.com/comment/75440889
has body: In order to better understand the use case, what type of tests are you running ? As an alternative to using an embedded tomcat for integration tests, have a look at the maven cargo plugin to running a full standard tomcat at the integration testing phase, and a tool such has the chronos jmeter maven plugin to sending requests to the server and producing test report results. This solution would start the tomcat container only once. A full container test is usually only necessary for performance measurement tests or fully automated GUI tests like using selenium macros running from a browser, in the case of other integration tests Spring Test MVC is the best way to do it. In case this suits the use case, this is an example of a maven configuration for a profile that starts a tomcat, runs integration tests (in this case some performance tests) and produces test reports. This would work with any technology stack and not only Spring or Seam: performance-tests org.codehaus.mojo properties-maven-plugin 1.0-alpha-2 initialize read-project-properties ${basedir}/performance-tests/performance-tests.properties org.codehaus.cargo cargo-maven2-plugin tomcat6x ${basedir}/performance-tests/tomcat6-install <cargo.servlet.port>443</cargo.servlet.port> <cargo.protocol>https</cargo.protocol> <cargo.tomcat.connector.clientAuth>false</cargo.tomcat.connector.clientAuth> <cargo.tomcat.connector.sslProtocol>TLS</cargo.tomcat.connector.sslProtocol> <cargo.tomcat.connector.keystoreFile>${basedir}/tomcat/keystore.jks</cargo.tomcat.connector.keystoreFile> <cargo.tomcat.connector.keystorePass>secret</cargo.tomcat.connector.keystorePass> <cargo.tomcat.httpSecure>true</cargo.tomcat.httpSecure> <cargo.datasource.datasource.ds1> cargo.datasource.url=${perf.test.datasource.url}| cargo.datasource.driver=${perf.test.datasource.driver}| cargo.datasource.username=${perf.test.datasource.username}| cargo.datasource.password=${perf.test.datasource.password}| cargo.datasource.type=${perf.test.datasource.type}…
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20916581
upvote count: 1

http://stackoverflow.com/a/20952114
type: Answer
accepted answer of: http://stackoverflow.com/q/20952047
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/20952047
has body: for (charVal = 0; charVal&lt;=length;charVal++) should be for (charVal = 0; charVal&lt;length;charVal++) otherwise input.charAt(charVal); will throw a StringIndexOutOfBoundsException for the last iteration. But you could make your code more efficient using a StringBuilder : public String encryptString(String input){ StringBuilder sb = new StringBuilder(); for (char c : input.toCharArray()) sb.append(encrypt(c)); return sb.toString(); } Few notes : The return type of your encrypt(char x) method could be char Be aware that JOptionPane.showInputDialog returns null if the user canceled the input
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/31576608
score: 0
type: Comment
type: QuestionComment
has text: You might want to put that down as answer, we details about how you removed the references etc...
comment on: http://stackoverflow.com/q/21008617

http://stackoverflow.com/q/21014305
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31585067
tagged with: multithreading
has comment: http://stackoverflow.com/comment/31585242
has comment: http://stackoverflow.com/comment/31585437
has answer: http://stackoverflow.com/a/21014673
linked to: http://stackoverflow.com/q/4676244
score: 3
has body: I am trying to write Thread Interference Example. Below is my code: class Counter { private int c = 0; public void increment() { c++; } public void decrement() { c--; } public int value() { return c; } } Suppose Thread A invokes increment at about the same time Thread B invokes decrement. How to implement this one.
has comment: http://stackoverflow.com/comment/31585102
downvote count: 0
has comment: http://stackoverflow.com/comment/31585410
has title: How to invoke two threads at same time?
has answer: http://stackoverflow.com/a/21014367
tagged with: java
has comment: http://stackoverflow.com/comment/31585062
type: Question
has comment: http://stackoverflow.com/comment/31585130
has comment: http://stackoverflow.com/comment/31585218
upvote count: 3
has answer: http://stackoverflow.com/a/21014906
answer count: 3
has comment: http://stackoverflow.com/comment/31585146
has comment: http://stackoverflow.com/comment/31585059
has comment: http://stackoverflow.com/comment/31585291
favorite count: 0
has comment: http://stackoverflow.com/comment/31585042

http://stackoverflow.com/comment/31489731
score: 0
has text: @kosta Can the JDBC driver alone be used to execute queries? If so, I'll try it that way. But how do I then connect and configure the server - port and such?
comment on: http://stackoverflow.com/q/20962310
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20954184
has comment: http://stackoverflow.com/comment/31508202
downvote count: 1
score: 1
type: AcceptedAnswer
has body: &lt;%=userName%> or ${userName}
type: Answer
accepted answer of: http://stackoverflow.com/q/20954161
answers question: http://stackoverflow.com/q/20954161
upvote count: 2

http://stackoverflow.com/a/20866282
has body: Parse the json as below JSONObject jb = new JSONObject("my string"); JSONObject jb1= jb.getJSONObject("prediction_path"); String confidence = jb1.getDouble("confidence"); Your JSON { // JSONObject node "model": "model/xxx", prediction_path": { // json object prediction path "confidence": 0.32562, http://developer.android.com/reference/org/json/JSONObject.html
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31307292
has comment: http://stackoverflow.com/comment/31307450
has comment: http://stackoverflow.com/comment/31307471
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20866258
accepted answer of: http://stackoverflow.com/q/20866258
has comment: http://stackoverflow.com/comment/31307302

http://stackoverflow.com/a/20953156
downvote count: 0
score: 7
has body: You define an interface which is called when an action is required public interface SortX { public void startClick(A a, B b, C c); } public enum SortAEnum implements SortX&lt;A, B, C&gt; { SortA { public void startClick(A a, B b, C c) { newOne(a, b, c); } }, SortB { public void startClick(A a, B b, C c) { otherfunction(a); } }, SortB { public void startClick(A a, B b, C c) { someotherfunction(c, a); } } } public static void startClick(A a, B b, List&lt;C extends OnClick&gt; lstC, SortX sort){ for (int i=0; i&lt;lstC.size(); i++){ sort.startClick(a, b, lstC.get(i)); } }
has comment: http://stackoverflow.com/comment/44696105
upvote count: 7
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20953054
answers question: http://stackoverflow.com/q/20953054
has comment: http://stackoverflow.com/comment/31471656
type: Answer

http://stackoverflow.com/q/20945357
has body: I'm writing a simple Bank class which contains Accounts. I'd like Persons to be able to open a new password-protected bank account and withdraw and deposit money from their account. Accounts are housed within the Bank. Which services should the Bank and Account classes provide? Let's say Person p already has an account in Bank b and he wants to make a deposit of $100. His password is "monkey". Choices: b.accessAccount(p, "monkey").deposit(100); where accessAccount() validates the password and then returns p's Account or b.deposit(p, "monkey", 100); Which is the more logical choice?
type: Question
accepted answer: http://stackoverflow.com/a/20945389
has answer: http://stackoverflow.com/a/20945389
score: 0
answer count: 1
tagged with: interface
type: AnsweredQuestion
tagged with: oop
has title: Bank class OOP interface decisions
tagged with: java

http://stackoverflow.com/a/21012849
has comment: http://stackoverflow.com/comment/31582903
score: 0
answers question: http://stackoverflow.com/q/21012648
has body: List&lt;? super Animal&gt; is a list of Animals or Entities or any Objects so you are allow to add a Dog to it. Dog is both Animal and Entity. That is List&lt;Object&gt; objList = new ArrayList&lt;&gt;(); objList.add(new Dog()); objList.add(new Animal()); objList.add(new Entity()); objList.add(new Object()); print1(objList); would compile without error or warning
type: Answer
has comment: http://stackoverflow.com/comment/31583530

http://stackoverflow.com/a/21010859
has comment: http://stackoverflow.com/comment/31739217
has comment: http://stackoverflow.com/comment/31737328
has comment: http://stackoverflow.com/comment/31746674
has comment: http://stackoverflow.com/comment/31717530
has comment: http://stackoverflow.com/comment/31716352
has comment: http://stackoverflow.com/comment/31716294
has comment: http://stackoverflow.com/comment/31745520
score: 4
upvote count: 4
accepted answer of: http://stackoverflow.com/q/21010495
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21010495
has body: You could use some custom Event that can occur when a word is found: public interface MyEventListener { public abstract void wordFound(/* any data you could use */); } Then make your GamePan capable of emitting such events: public class GamePan extends JPanel { private final List&lt;MyEventListener&gt; myEventListeners = new LinkedList&lt;&gt;(); // Here, keep everything you already have public void addMyEventListener(final MyEventListener listener) { this.myEventListeners.add(listener); } private void notifyWordFound(/* any data you could use */) { for(final MyEventListener listener : this.myEventListeners) { listener.wordFound(/* any data you could use */) } } } When the word is found, just call GamePan#notifyWordFound. Then, register some updating method to be called in your JFrame when such an event occurs: public class MyJFrame extends JFrame { // Here, keep everything you already have public JFrame() { // Here, keep everything you already have // Let's assume your ScorePanel instance is here: final ScorePanel scorePanel = new ScorePanel(); this.gamePan.addMyEventListener(new MyEventListener() { @Override public void wordFound(/* any data you could use */) { // Update your application using any data you can use :) scorePanel.wordFound(/* any data you could use */); } }); } } Here, we simply call the ScorePanel#wordFound method so the ScorePanel can be updated. Don't forget that you can transmit any data you're interested in through all these methods. For example, if you want to transmit the word the user just found, the MyEventListener#wordFound method could be declared as follows: public interface MyEventListener { public abstract void wordFound(final String word); } EDIT: Added some interaction with a ScorePanel instance to answer your additional question in comments :)
has comment: http://stackoverflow.com/comment/31713198
type: Answer

http://stackoverflow.com/a/20895174
downvote count: 0
score: 1
has body: Path doesn't have a method newOutputStream(). I usually use new FileOutputStream(File) for writing to files, though there might be newer API in Java 7. You should really use an IDE, e.g. Ecplise or Netbeans, as it will instantly tell you that the method doesn't exist, and will make writing code a thousand times easier in general. For example you can press ctrl+space in Eclipse and it will bring up a list of classes/methods/variables that match the last word you typed (the list will also automatically pop up when typing a period).
has comment: http://stackoverflow.com/comment/31362149
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/20895090
answers question: http://stackoverflow.com/q/20895090

http://stackoverflow.com/comment/31325170
type: Comment
has text: I have done what u said.But it records only one call...after that it gives error n crashes
type: AnswerComment
comment on: http://stackoverflow.com/a/20871528
score: 0

http://stackoverflow.com/q/20895723
accepted answer: http://stackoverflow.com/a/20895858
type: Question
has title: Send a String using Java Servlet over HTTP request
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31362823
has comment: http://stackoverflow.com/comment/31362901
has answer: http://stackoverflow.com/a/20895858
tagged with: servlets
type: AnsweredQuestion
answer count: 1
has body: Hi I am trying to implement a server that takes in a string, then generates and returns another string to the client side, but it's not working well. Here is what I tried: Server: protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { .... String str = "something"; // Return the queueId. OutputStreamWriter writer = new OutputStreamWriter(response.getOutputStream()); writer.write(str); writer.flush(); writer.close(); } Client: String URL = "http://localhost:8080/" String serverURL = URL + "servlet?param=" + someParam; final URL url = new URL(serverURL) final URLConnection connection = url.openConnection(); connection.setDoOutput(true); final BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream())); System.out.println(br.readLine()); But somehow br.readLine() is returning null. Which side is wrong in this case? Thanks in advance.

http://stackoverflow.com/comment/31484668
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20959805
has text: You can use http://docs.oracle.com/javase/7/docs/api/java/util/Timer.html to schedule the change to false to future time, but on every next tick the if would be executed. Maybe getting ticks to often is the problem?
score: 0

http://stackoverflow.com/q/20906091
has answer: http://stackoverflow.com/a/20906236
has comment: http://stackoverflow.com/comment/31381324
has answer: http://stackoverflow.com/a/30642686
has answer: http://stackoverflow.com/a/20906263
has answer: http://stackoverflow.com/a/20908091
has answer: http://stackoverflow.com/a/20906108
has comment: http://stackoverflow.com/comment/31381903
has answer: http://stackoverflow.com/a/20906130
tagged with: android
has comment: http://stackoverflow.com/comment/31382380
has comment: http://stackoverflow.com/comment/31381963
has answer: http://stackoverflow.com/a/20906277
answer count: 10
has title: Which class is super class of all classes
favorite count: 0
accepted answer: http://stackoverflow.com/a/20906130
has body: I am a Java beginner. I am little bit confused as to which is the Super class of all classes in Java?
score: 6
upvote count: 7
downvote count: 1
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20906496
has answer: http://stackoverflow.com/a/20908631
possible better answer: http://stackoverflow.com/a/20906105
type: Question
has answer: http://stackoverflow.com/a/20906105
has comment: http://stackoverflow.com/comment/31382146

http://stackoverflow.com/a/20937743
answers question: http://stackoverflow.com/q/20937720
upvote count: 10
type: Answer
has comment: http://stackoverflow.com/comment/31442722
downvote count: 0
has body: Caused by: java.lang.NullPointerException at pl.krasiniak.krachapp_beta.Studio.onCreate(Studio.java:25) I guess Studio.java line 25 is youTubePlayerView.initialize(API_KEY, this) YouTubePlayerView is null. You should check the id of the view in xml Edit: setContentView(R.layout.activity_main); But you have &lt;com.google.android.youtube.player.YouTubePlayerView android:id="@+id/youtube_view" in activity_studio.xml SO change to setContentView(R.layout.activity_studio);
has comment: http://stackoverflow.com/comment/31442743
score: 10
accepted answer of: http://stackoverflow.com/q/20937720
type: AcceptedAnswer

http://stackoverflow.com/q/20920015
accepted answer: http://stackoverflow.com/a/20920739
score: 3
answer count: 1
downvote count: 0
favorite count: 0
has body: I have such domain: Country has cities, city has offices, offices has services. I need to find all countries with offices which provide specified service id. My current version is: SELECT c FROM Country c WHERE EXISTS( SELECT ct FROM c.cities ct WHERE EXISTS( SELECT o FROM ct.offices o WHERE EXISTS( SELECT s.id FROM o.services s WHERE s.id = :id ) ) ) So, I'm new to HQL. What is best way to this? Is my version Ok? I was thinking about SELECT DISTINCT with LEFT JOIN too.
has answer: http://stackoverflow.com/a/20920739
type: AnsweredQuestion
upvote count: 3
tagged with: java
tagged with: hibernate
tagged with: hql
type: Question
has title: HQL nested subqueries

http://stackoverflow.com/a/20998966
type: Answer
upvote count: 1
score: 1
downvote count: 0
has body: As a rule of thumb, the simplest way to make a recursive function iterative is to load the first element onto a Stack, and instead of calling the recursion, add the result to the Stack. For instance: public Item recursive(Item myItem) { if(myItem.GetExitCondition().IsMet() { return myItem; } ... do stuff ... return recursive(myItem); } Would become: public Item iterative(Item myItem) { Stack&lt;Item&gt; workStack = new Stack&lt;&gt;(); while (!workStack.isEmpty()) { Item workItem = workStack.pop() if(myItem.GetExitCondition().IsMet() { return workItem; } ... do stuff ... workStack.put(workItem) } // No solution was found (!). return myItem; } This code is untested and may (read: does) contain errors. It may not even compile, but should give you a general idea.
answers question: http://stackoverflow.com/q/20998550

http://stackoverflow.com/q/20911707
type: Question
score: 0
answer count: 1
has title: Java OpenGL 3.x - Apply Square Texture to Circle Model
favorite count: 0
tagged with: geometry
has answer: http://stackoverflow.com/a/20912564
type: UnansweredQuestion
has body: I have a way to generate the verities for a circle like object in OpenGL. It does so off of a variable number, if the number is 360, 360 individual triangles will makeup the circle. My Question is how do you apply a square texture to the entire circle so that it squishes the texture to fit the circle? EDIT codes: LoD => Level of Detail. public static float[] getVerts( int LoD ){ float[] _spokeArray = new float[ (LoD*2) ]; double rad = (360.0d / LoD) * (Math.PI / 180.0d); for ( int i = 0 ; i &lt; LoD ; i++ ) { _spokeArray[ i*2 + 0 ] = (float) Math.cos( rad*i ); _spokeArray[ i*2 + 1 ] = (float) Math.sin( rad*i ); } float[] _vertArray = new float[ (LoD*9) ]; for ( int i = 0 ; i &lt; LoD ; i++ ) { _vertArray[ i*9 + 0 ] = 0.0f; _vertArray[ i*9 + 1 ] = 0.0f; _vertArray[ i*9 + 2 ] = 0.0f; _vertArray[ i*9 + 3 ] = _spokeArray[ i*2 + 0 ]; _vertArray[ i*9 + 4 ] = _spokeArray[ i*2 + 1 ]; _vertArray[ i*9 + 5 ] = 0.0f; if ( (i+1) == LoD ){ _vertArray[ i*9 + 6 ] = 1.0f; _vertArray[ i*9 + 7 ] = 0.0f; _vertArray[ i*9 + 8 ] = 0.0f; break; } _vertArray[ i*9 + 6 ] = _spokeArray[ (i+1)*2 + 0 ]; _vertArray[ i*9 + 7 ] = _spokeArray[ (i+1)*2 + 1 ]; _vertArray[ i*9 + 8 ] = 0.0f; } return _vertArray; } public void setUpTexture() throws GLException, IOException { texture = TextureIO.newTexture( imagePath, true ); } public void draw(GL gl) { gl.glBindBuffer( GL3.GL_ARRAY_BUFFER, Main._scene.indexOf( this ) ); texture.enable( gl ); texture.bind( gl ); // The indices are just: 0, 1, 2, 3, 4, 5 ... LoD*3 gl.glDrawElements( GL.GL_TRIANGLES, indBuffer.capacity(), GL.GL_UNSIGNED_SHORT, 0 ); }
tagged with: textures
has comment: http://stackoverflow.com/comment/31393198
tagged with: opengl
tagged with: java
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/31473946
has text: Please clarify `The code above does not lead to a proper result.` Is the onClick method do not fire?
comment on: http://stackoverflow.com/q/20953307
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/31498941
has text: Yeah my question is maybe not well asked. It's more about how you do create an simple Applet(Class,methods,etc) and how do you call it via "plain HTML" or JSF generated HTML whatever. So i understand that the integration will not be the hard stuff. I just don't know how an applet works :). I will try to read more about that so and post another question if i'm stuck with the applet creation. But i was hoping to have some example to get a frame to begin with and then add JSFFileCHooser.
score: 0
comment on: http://stackoverflow.com/q/20966272
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20856152
has answer: http://stackoverflow.com/a/20856595
linked to: http://stackoverflow.com/q/14886232
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31287711
has comment: http://stackoverflow.com/comment/31287523
tagged with: swing
has comment: http://stackoverflow.com/comment/31287948
has comment: http://stackoverflow.com/comment/31290532
tagged with: graphics
has comment: http://stackoverflow.com/comment/31287752
tagged with: java
tagged with: jpanel
has comment: http://stackoverflow.com/comment/31287411
type: Question
has comment: http://stackoverflow.com/comment/31287754
answer count: 1
has comment: http://stackoverflow.com/comment/31287543
has body: I am working on a project that simulates a traffic intersection. So far I did the map, traffic lights. Now I want to add some movement, some cars in my project. The problem that I am facing is that i can't add graphics on the same Panel from different classes. And can someone give me a good tutorial where I can learn how to move multiple graphics (cars in my case) . Main class: import java.awt.Color; import javax.swing.JFrame; public class Main { public static void main(String[] args) { MyMap map = new MyMap(); MyCar car = new MyCar(); Thread x = new Thread(map); x.start(); JFrame f = new JFrame("Broadway Intersection"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); map.setBackground(Color.white); f.add(map); f.add(car); f.setSize(1366, 738); f.setVisible(true); } } Map class: import java.awt.Color; import java.awt.Graphics; import javax.swing.JPanel; public class MyMap extends JPanel implements Runnable { Color color = Color.RED; Color color2 = Color.RED; Color color3 = Color.RED; Color color4 = Color.RED; int[] faza = new int[4]; int k; int faza_curenta = 0; public MyMap() { faza[0] = 20; faza[1] = 20; faza[2] = 20; faza[3] = 20; } public void run() { color = Color.GREEN; while (true) { System.out.println("Faza = " + faza_curenta + " k= " + k); k++; if (k == faza[0]) { faza_curenta = 1; color = Color.RED; color2 = Color.GREEN; } else if (k == (faza[0] + faza[1])) { faza_curenta = 2; color = Color.RED; color2 = Color.RED; color3 = Color.GREEN; } else if (k == (faza[0] + faza[1] + faza[2])) { faza_curenta = 3; color = Color.RED; color3 = Color.RED; color4 = Color.GREEN; } else if (k == (faza[0] + faza[1] + faza[2] + faza[3])) { faza_curenta = 0; color = Color.GREEN; color4 = Color.RED; k = 0; } try { Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } public void paintComponent(final Graphics g) { super.paintComponent(g); g.setColor(Color.GREEN); g.fillRect(0, 0, 500, 250); // stanga sus g.fillRect…
score: 0
has comment: http://stackoverflow.com/comment/31287646
has comment: http://stackoverflow.com/comment/31287833
has title: Adding graphics on same Panel from different classes
tagged with: paintcomponent

http://stackoverflow.com/a/20901910
downvote count: 0
score: 6
answers question: http://stackoverflow.com/q/20901442
upvote count: 6
has body: Try the following to see if you have the proper repository installed: # yum search java | grep 'java-' This is going to return a list of available packages that have java in the title. Specifically we are interested in the java- anything, as the jdk will typically be in 'java-version#' type format... Anyhow, if you have to install a repo look at Dag Wieers repo: http://dag.wieers.com/rpm/FAQ.php#B After you've got it installed try yum search again... This time you'll have a bunch of java stuff. # yum search java | grep 'java-' This will return the list of the available java packages. You can install one like this: # yum install java-1.7.0-openjdk.x86_64
type: Answer

http://stackoverflow.com/comment/31462594
comment on: http://stackoverflow.com/q/20948756
has text: What did you expect? The `Concurrent` (in `ConcurrentHashMap`) means, that the map takes care of synchronisation as far as it needs to in order to protect its internal structures. It doesn't mean, that using it would automagically fix race conditions in the code using the map.
score: 4
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20991454
has comment: http://stackoverflow.com/comment/31543174
answers question: http://stackoverflow.com/q/20989792
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 6
has comment: http://stackoverflow.com/comment/31561381
has comment: http://stackoverflow.com/comment/31634816
upvote count: 6
has comment: http://stackoverflow.com/comment/31542754
accepted answer of: http://stackoverflow.com/q/20989792
has comment: http://stackoverflow.com/comment/31545136
has body: I think you have to do simply like this: @Path("/FriendsList") public class RestWebServicesAPI{ @POST @Path("/friends") @Consumes(MediaType.APPLICATION_JSON) public Friends saveFriendList(final String json){ Gson gs = new Gson(); Friends [] n = gs.fromJson(json, Friends [].class); } //ALTERNATIVE @POST @Path("/friends") @Consumes(MediaType.APPLICATION_JSON) public Friends saveFriendList(final Friends[] friends){ }
has comment: http://stackoverflow.com/comment/31634596
has comment: http://stackoverflow.com/comment/31600686

http://stackoverflow.com/comment/31575262
comment on: http://stackoverflow.com/q/21008492
has text: You could use a Properties object instead. The Properties class is not considered obsolete. Properties extends HashTable so it can be passed to the InitialDirContext constructor. (Of course, this doesn't mean you're really avoiding the use of HashTable, but at least your code won't appear to directly use an obsolete class.)
score: 2
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31380964
has text: When a window resizes, `paintComponent()` is called to give the window a change to adapt to it's new size. If you compute something every frame, you should do that in a separate method you call before you call `repaint()`, so if `paintComponent()` because of a resize you won't have an extra frame.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/20905810
type: QuestionComment

http://stackoverflow.com/comment/31488644
type: Comment
comment on: http://stackoverflow.com/q/20961923
type: QuestionComment
has text: What is not working, precisely? Are you getting an error, or is the behaviour unexpected?
score: 0

http://stackoverflow.com/comment/31553458
type: QuestionComment
type: Comment
has text: No. Now I have a "code 400 bad request" when I send the request from postman plugin. The request sent is a simple post message containing the image, and I don't know if it is possible to have the details of the issue in the server log (the things I have on server side is very... light). Is it because of postman request format?
comment on: http://stackoverflow.com/q/20968540
score: 0

http://stackoverflow.com/comment/31568869
has text: Thank you. The reason for doing this measurement is to empirically measure the impact of using some specific code fragments on the execution time of a program. But all I have are the .class files. Do you have any suggestion on a better way to approach the problem?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21005289
score: 0

http://stackoverflow.com/comment/31464910
type: AnswerComment
comment on: http://stackoverflow.com/a/20949665
score: 0
has text: StringBuilder s1 = new StringBuilder(); (instead of String s1 = new String) and s1.append((char)inst.read());
type: Comment

http://stackoverflow.com/a/20924188
score: 0
answers question: http://stackoverflow.com/q/20916938
type: Answer
has body: I solve the problem in a very simple (but not so formal way): i go to the file.f90 and re-define it so i change the shell commands to file.txt that the file must read when it compile. Now the bash is very simple: #!/bin/bash touch IC_masslessPlanetesimal.java touch param.in m=1 n=0 for n in "2" "3" do sed -i "11s/$m/$n/" IC_masslessPlanetesimal.java javac IC_masslessPlanetesimal.java java IC_masslessPlanetesimal sed -i "13s/$m/$n/" param.in ./swifter_symba_omp # now i just launch the modify version of ./exec that read the files in which i declare the input to the ./exec m=$n done Thanks a lot for your answers comments and tips.

http://stackoverflow.com/comment/31460703
type: Comment
has text: omg I did a mistake, it's not "text.setText = " its "text.setText( )", I edited my answer to the correct one (sorry!)
comment on: http://stackoverflow.com/a/20931784
score: 0
type: AnswerComment

http://stackoverflow.com/a/20989116
has comment: http://stackoverflow.com/comment/31539821
answers question: http://stackoverflow.com/q/20988946
score: 0
type: Answer
has body: I think you're misunderstanding inheritance. Multiple inheritance allows a class to inherit the properties of two distinct classes. From Wikipedia, here is an illustration of one such hierarchy (known as the "diamond problem"): Take note: D is inheriting from both B and C. To bring it to a better illustration, multiple inheritance would allow you to have a class structure like this: public class Bike { // properties of a bike } public class Car { // properties of a car, namely that it has a motor } public class Moped extends Bike, Car { // properties inherited combine that it is both a Bike and a Car } The current way that Java classes are wired now is that their inheritance is hierarchal; that is, one class may only ever have one parent class. A good way to think of inheritance in this manner is the "is-a" relationship test. For your example: A Derived is a Base. A Base is an Object. A Derived is an Object.

http://stackoverflow.com/comment/31483436
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20959348
has text: My biggest problem was entry. I had no idea that it represents the object from the given row. Wow thank you so much :) This is amazing help
type: AnswerComment

http://stackoverflow.com/comment/31516233
type: Comment
type: QuestionComment
has text: @SotiriosDelimanolis Now for some reason I can't compile the class, though I've moved it to Test Packages.
comment on: http://stackoverflow.com/q/20976847
score: 0

http://stackoverflow.com/q/20923615
has title: sorting integers by a priority queue
tagged with: java
has comment: http://stackoverflow.com/comment/31415033
duplicate of: http://stackoverflow.com/q/13668695
upvote count: 1
has comment: http://stackoverflow.com/comment/31416229
has body: I want to write a program which can sort Items by Priority Queue But the code below doesn't work and I dont know the problem any help?? thanks in advance for your attention public class SortingASequenceByPriorityQueue { public static void main(String[] args) { PriorityQueue&lt;Integer&gt; pQueue = new PriorityQueue&lt;Integer&gt;(1000, new Comparator&lt;Integer&gt;() { public int compare(Integer w1, Integer w2) { if(w1.intValue()&gt; w2.intValue()) return 1; else if( w1.intValue()&lt; w2.intValue()) return -1; return 0; } }); pQueue.add(12); pQueue.add(1); pQueue.add(5); pQueue.add(22); pQueue.add(3); pQueue.add(2); pQueue.add(124); pQueue.add(14); pQueue.add(111); pQueue.add(9); pQueue.add(30); Object[] ar = pQueue.toArray(); for (int i = 0; i&lt; ar.length; i++){ System.out.println(ar[i].toString()); } } } The output is this : 1 3 2 14 9 5 124 22 111 12 30
answer count: 1
linked to: http://stackoverflow.com/q/13668695
tagged with: sorting
favorite count: 0
tagged with: priority-queue
has answer: http://stackoverflow.com/a/20923657
downvote count: 0
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/31415116
type: Question

http://stackoverflow.com/comment/31553930
type: Comment
has text: Does 'filling gaps' mean that in your third example, the hole in the middle of the shape can be removed?
comment on: http://stackoverflow.com/q/20997254
score: 0
type: QuestionComment

http://stackoverflow.com/comment/31434559
type: AnswerComment
has text: @MarkoTopolnik [Indeed](http://stackoverflow.com/questions/7658568/most-efficient-way-to-use-replace-multiple-words-in-a-string).
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20933761

http://stackoverflow.com/comment/62929033
score: 5
type: AnswerComment
type: Comment
has text: after you've parsed Date and set GregorianCalendar's time, you can just pass calendar as argument to newXMLGregorianCalendar(GregorianCalendar cal)
comment on: http://stackoverflow.com/a/21328728

http://stackoverflow.com/comment/31587573
comment on: http://stackoverflow.com/a/21015562
score: 0
has text: What language := is belong to?
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31487459
type: Comment
score: 0
has text: I am sorry but it seems I gave you the wrong impression about my knowledge there. Of course I know that the public class is my code and as a matter of fact I have implemented the MessageListener in my code to replace the while loop. Still, thanks for your help sincerely!
type: AnswerComment
comment on: http://stackoverflow.com/a/20937712

http://stackoverflow.com/comment/31478978
comment on: http://stackoverflow.com/a/20956822
score: 0
type: AnswerComment
has text: @TheGost Your buffer array is not needed; the `BufferedOutputStream` contains its' own. `flush()` will empty the buffer.
type: Comment

http://stackoverflow.com/q/20992963
has answer: http://stackoverflow.com/a/21012070
tagged with: content-model
answer count: 2
downvote count: 0
favorite count: 0
has title: Alfresco issue, residual=true and "property type" is empty while "value type" is filled in
tagged with: alfresco
has body: I have an issue while creating a content model , in the Node Browser it says "true" under residual and under Property Type it is empty field and under Value Type it says "{http://www.alfresco.org/model/cms/1.0/cs01}id" which is weird cause it's different from all other values. After verifying the model i found that i did a mistake in my QName in java code,so i correct it and the problem goes, but whenever i restart Alfresco this issue appears again How to avoid this problem? Thank's in advance.
tagged with: qnames
score: 2
upvote count: 2
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27844382
tagged with: jakarta-ee

http://stackoverflow.com/comment/31523802
score: 1
comment on: http://stackoverflow.com/q/20980785
type: Comment
type: QuestionComment
has text: Read [this](http://stackoverflow.com/questions/6729605/dynamic-variable-names-in-java). An object does not have a name. A variable does. That name cannot be created dynamically.

http://stackoverflow.com/comment/31372848
score: 0
has text: where what?whats the clause?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20901516

http://stackoverflow.com/a/20897084
has body: I solved it. Instead of using a GUI to set the path, I used: Path = %PATH%;C:\Program Files\Java\jdk1.7.0_45\bin
answers question: http://stackoverflow.com/q/20896848
type: Answer
score: 1
upvote count: 1
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20896848
type: AcceptedAnswer

tcp
type: Tag
tags question: http://stackoverflow.com/q/20858814
tags question: http://stackoverflow.com/q/20854301
tags question: http://stackoverflow.com/q/20940353
tags question: http://stackoverflow.com/q/20927053
tags question: http://stackoverflow.com/q/20990103
tags question: http://stackoverflow.com/q/20998977
tags question: http://stackoverflow.com/q/20963658
tags question: http://stackoverflow.com/q/20896980
tags question: http://stackoverflow.com/q/20977468
tags question: http://stackoverflow.com/q/20944206
tags question: http://stackoverflow.com/q/20879673
tags question: http://stackoverflow.com/q/20923600
tags question: http://stackoverflow.com/q/20986656
tag name: tcp
tags question: http://stackoverflow.com/q/20863023

http://stackoverflow.com/q/20973373
has body: Hi for my java revision I'm going through past paper questions and I'm stuck. I'm given this code: class FriendFinderThread extends Thread { // number of FriendBook friends int numFriends = 0; public void run() { // join, then leave FriendBook FriendBook.join(this); try { Thread.sleep(10000); } catch (InterruptedException(ie) {} FriendBook.leave(this); } } class FriendBook { // list of FriendBook members static Vector&lt;FriendFinderThread&gt; members = new Vector&lt;FriendFinderThread&gt;(); static void join(FriendFinderThread f) { // add a new friend to all existing members int size = members.size(); for (int i = 0; i &lt; size; i++) { members.elementAt(i).numFriends++; } f.numFriends = size; // new member’s friends members.add(f); // add to list of members } static void leave(FriendFinderThread f) { members.remove(f); // remove from list int size = members.size(); for (int i = 0; i &lt; size; i++) { members.elementAt(i).numFriends--; } } public static void main() { for (int n = 0; n &lt; 100; n++) { new FriendFinderThread().start(); } } } I'm having real trouble understanding what is going on, could someone please explain what is happening in the code and how the code could have problems with interference. Thank you
type: UnansweredQuestion
tagged with: multithreading
tagged with: java
type: Question
score: 0
has answer: http://stackoverflow.com/a/20973847
answer count: 1
has title: Interference problems in program

http://stackoverflow.com/comment/31503841
type: Comment
type: QuestionComment
has text: Make your `UserConnection` class implement `java.jdbc.Connection` and hide whatever the user specifics are inside it, then you've got your adapter pattern, which is really what you have anyway.
comment on: http://stackoverflow.com/q/20970332
score: 0

translate-animation
tags question: http://stackoverflow.com/q/21008598
type: Tag
tag name: translate-animation

http://stackoverflow.com/a/20906048
accepted answer of: http://stackoverflow.com/q/20902932
has comment: http://stackoverflow.com/comment/31409462
answers question: http://stackoverflow.com/q/20902932
has comment: http://stackoverflow.com/comment/31473097
type: Answer
has comment: http://stackoverflow.com/comment/31477897
has body: Custom DocumentListeners and formattedTextField don't play nicely with each other, better don't mix. Instead, use a PropertyChangeListener on the text field that listens for changes of its editValid property: whenever that changes to false, you could notify the users field.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { LOG.info("" + evt); if ("editValid".equals(evt.getPropertyName()) &amp;&amp; Boolean.FALSE.equals(evt.getNewValue())) { SpinnerNumberModel model = (SpinnerNumberModel) spin2.getModel(); JOptionPane.showMessageDialog(null, "Error: Number must be in range [" + model.getMinimum() + " ..." + model.getMaximum() + "]", "Error Massage", JOptionPane.ERROR_MESSAGE); } } }); BTW, personally, I agree with Mad - such an intrusive notification tends to annoy me and maybe your users as well ..
has comment: http://stackoverflow.com/comment/31473184
has comment: http://stackoverflow.com/comment/31496354
has comment: http://stackoverflow.com/comment/31471969
has comment: http://stackoverflow.com/comment/31398501
has comment: http://stackoverflow.com/comment/31478145
has comment: http://stackoverflow.com/comment/31472806
has comment: http://stackoverflow.com/comment/31472768
score: 4
has comment: http://stackoverflow.com/comment/31408749
upvote count: 4
has comment: http://stackoverflow.com/comment/31472325
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/20929925
tagged with: libgdx
tagged with: java
accepted answer: http://stackoverflow.com/a/20929952
type: AnsweredQuestion
score: 3
downvote count: 0
favorite count: 0
type: Question
tagged with: android
tagged with: facebook
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/20929952
upvote count: 3
answer count: 1
has body: I'm trying to add Facebook to an already completed LibGDX game. However, when I'm trying to check the current Session, it returns null. I have tried to make a new Session to use instead, and I get a Null Pointer Error: 01-04 19:49:15.433: E/AndroidRuntime(16540): FATAL EXCEPTION: main 01-04 19:49:15.433: E/AndroidRuntime(16540): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.pressx.thedevice/com.pressx.thedevice.MainActivity}: java.lang.NullPointerException: Argument 'applicationId' cannot be null 01-04 19:49:15.433: E/AndroidRuntime(16540): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2070) 01-04 19:49:15.433: E/AndroidRuntime(16540): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2095) 01-04 19:49:15.433: E/AndroidRuntime(16540): at android.app.ActivityThread.access$600(ActivityThread.java:135) 01-04 19:49:15.433: E/AndroidRuntime(16540): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1201) 01-04 19:49:15.433: E/AndroidRuntime(16540): at android.os.Handler.dispatchMessage(Handler.java:99) 01-04 19:49:15.433: E/AndroidRuntime(16540): at android.os.Looper.loop(Looper.java:137) 01-04 19:49:15.433: E/AndroidRuntime(16540): at android.app.ActivityThread.main(ActivityThread.java:4849) 01-04 19:49:15.433: E/AndroidRuntime(16540): at java.lang.reflect.Method.invokeNative(Native Method) 01-04 19:49:15.433: E/AndroidRuntime(16540): at java.lang.reflect.Method.invoke(Method.java:511) 01-04 19:49:15.433: E/AndroidRuntime(16540): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795) 01-04 19:49:15.433: E/AndroidRuntime(16540): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562) 01-04 19:49:15.433: E/AndroidRuntime(16540): at dalvik.system.NativeStart.main(Native Method) 01-04 19:49:15.433: E/AndroidRuntime(16540): Caused by: java.lang.NullPointerException: Argument 'applicationId' cannot be null 01-04 19:49:15.433: E/AndroidRuntime(16540): at c…
has title: applicationId cannot be null, but xml syntax is correct

http://stackoverflow.com/q/20863952
score: 0
answer count: 1
tagged with: macos
type: UnansweredQuestion
has body: I tried two PyDev installation methods and I can't get any results so far... it is not shown in my Preference menu. I've already tried: a) Putting the PyDev UNZIPPED and ZIPPED files in the dropins folder. b) Updating via "Help" menu. *I'm using Mac OS X 10.7.5 (I think it's Mt. Lion). *Eclipse Juno. *Copied both PyDev 3.0 and 2.7.6 *I've installed JDK 7 and 8...using 7.
tagged with: java
has answer: http://stackoverflow.com/a/20909449
tagged with: eclipse
type: Question
tagged with: pydev
has title: PyDev not showing AT ALL in Eclipse Juno

http://stackoverflow.com/q/20988254
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/20988594
has title: How could I test ClassNotFoundException is being thrown?
linked to: http://stackoverflow.com/q/20986195
type: Question
answer count: 2
tagged with: mockito
downvote count: 0
has answer: http://stackoverflow.com/a/20988300
tagged with: classnotfoundexception
favorite count: 0
tagged with: powermock
accepted answer: http://stackoverflow.com/a/20988300
upvote count: 1
has answer: http://stackoverflow.com/a/20988594
has body: I have question that similar to my previous question where I have the following class: public class FileClass { public void funcB() throws ClassNotFoundException { throw new ClassNotFoundException(); } } I would like to test whether ClassNotFoundException will be thrown when funcB() is called. Thus I have this test code: public class TestFileClass { @Test(expected=ClassNotFoundException.class) public void testFuncB() throws ClassNotFoundException { FileClass fc = Mockito.spy(new FileClass()); Mockito.doThrow(new ClassNotFoundException()) .when(fc).funcB(); } } But the test were failed due to following error: java.lang.AssertionError: Expected exception: java.lang.ClassNotFoundException at org.junit.internal.runners.statements.ExpectException.evaluate(ExpectException.java:35) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTe…
type: AnsweredQuestion

http://stackoverflow.com/a/21011130
answers question: http://stackoverflow.com/q/21010951
upvote count: 1
has body: In this scenario it takes both @,- as separator so thats why this output is produced. For exact output you have to try some other "separator" To Refer : http://commons.apache.org/proper/commons-lang/javadocs/api-2.6/org/apache/commons/lang/StringUtils.html#split%28java.lang.String,%20java.lang.String%29
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/20992436
type: AcceptedAnswer
downvote count: 0
upvote count: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/20992009
answers question: http://stackoverflow.com/q/20992009
has comment: http://stackoverflow.com/comment/31544265
has body: You are right: each instance method is a function which declares one more argument than what is explicitly declared. The first argument is always the implicit this reference (pointer). This is only thinly disguised by Java's syntax: firstArg.method(secondArg, thirdArg) is just another way of writing method(firstArg, secondArg, thirdArg) And note the special characteristic of the first argument: it is the only one upon whose type the dynamic dispatch of methods takes place.
score: 5

http://stackoverflow.com/comment/31324307
has text: codeMagic: this is the code with that is not giving any error, I would like to know how to implement an onclicklistener for my first imagebutton on result.xml (with id "play") I had error when using the code from my other question but someone told me i was on the wrong way: http://stackoverflow.com/questions/20832685/android-could-not-find-a-method-playaudioview-in-the-activity-class-android
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20874923

http://stackoverflow.com/a/20853150
answers question: http://stackoverflow.com/q/20852946
upvote count: 9
has comment: http://stackoverflow.com/comment/31282168
type: Answer
has body: Try running maven offline mvn clean install -o. This will pick jars from your local repository i.e in .m2. As you mentioned jar is already in local repo, and if all other dependencies are also in local, this will work.
downvote count: 0
score: 9
accepted answer of: http://stackoverflow.com/q/20852946
type: AcceptedAnswer

http://stackoverflow.com/q/20983238
has body: I have a class called Circle that extends from a class called Shape. I am trying to figure out how to get a circle to draw on a plotter using the given description of the draw() method. Here's what I have so far for the class: public class Circle extends Shape{ private double radius; public Circle(double x_origin, double y_origin, double r, Color c){ super(x_origin, y_origin, c); this.radius = r; } public void draw(WinPlotter plotter){ setPenColor(plotter); } } The setPenColor just provides a color for the circle to be drawn, feel free to ignore it. The javadoc description for the circle's draw method is as follows: Draws the Circle. Uses sine and cosine functions from the java.lang.Math class to compute a finite set of points that lie on the circumference of a circle, and then uses the drawTo method of WinPlotter to draw a sequence of small connected straight-line segments. When enough segments are drawn (about 25 segments are sufficient), a smooth circle is approximated. If you need to see the entire Circle javadoc for it, here it is Here is the WinPlotter javadoc to use as a reference. I have only been using the moveTo() and drawTo() methods for every other shape I have had to draw. I just want to know the best way to draw a circle on the plotter.
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/20983849
type: UnansweredQuestion
has title: Draw a circle using a plotter
tagged with: java
type: Question

http://stackoverflow.com/q/20985427
has answer: http://stackoverflow.com/a/20985460
tagged with: java
has title: ClassNotFoundException: con.mysql.jdbc.Driver
tagged with: mysql
type: Question
linked to: http://stackoverflow.com/q/12933113
score: 0
answer count: 2
has body: Super new to JSP and just trying to access mysql public static Connection connect(){ try{ Class.forName("con.mysql.jdbc.Driver").newInstance(); return DriverManager.getConnection("jdbc:mysql://localhost/db_name", "root", "******"); }catch(Exception e){ throw new Error(e); } I continue to get this error: ClassNotFoundException: con.mysql.jdbc.Driver I understand that I need to change the "classpath" and/or that I need to move the mysql-connector jar file to tomcat7/lib but I have 2 problems: I have absolutely no idea what the classpath is and how to change it using ubuntu and dreamweaver. my tomcat7 folder doesn't have a lib directory. I don't know where to put the jar file.
has answer: http://stackoverflow.com/a/20985457
type: UnansweredQuestion
tagged with: jdbc
tagged with: tomcat7

http://stackoverflow.com/comment/44506133
type: Comment
score: 5
type: AnswerComment
has text: Note that `value` worked for me when `innerText` failed
comment on: http://stackoverflow.com/a/20963084

http://stackoverflow.com/q/20889576
score: 1
tagged with: java
tagged with: listview
type: Question
answer count: 2
has body: I am Trying to Display the IP Address in a ListView.I created a ListAdapter &amp; ArrayAdapter but it is not displaying properly.So I think i need a CustomAdapter to Display the Addresses.I have already Used TextView to display it.I need the Adapter to display the values which are displayed in the TextView. So Help me in the Right Direction :) Thanks for your Help ... connect.java public class connect extends ListActivity implements OnClickListener{ WifiApManager wifiApManager; TextView tv; Button ipscan; ListView lv; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.connect); tv =(TextView) findViewById(R.id.iptv); ipscan=(Button) findViewById(R.id.scan); ipscan.setOnClickListener(this); lv = getListView(); } class scan extends AsyncTask&lt;Void, Void, ArrayList&lt;ClientScanResult&gt;&gt;{ public Context context; ArrayList&lt;ClientScanResult&gt; clients= new ArrayList&lt;ClientScanResult&gt;(); public scan(Context c) // constructor to take Context { context = c; // Initialize your Context variable } protected ArrayList&lt;ClientScanResult&gt; doInBackground(Void... params) { wifiApManager = new WifiApManager(context); // use the variable here return wifiApManager.getClientList(false); } protected void onPostExecute(ArrayList&lt;ClientScanResult&gt; clients){ ArrayAdapter&lt;ClientScanResult&gt; adapter= new ArrayAdapter&lt;ClientScanResult&gt;(connect.this, android.R.layout.simple_list_item_1, clients); lv.setAdapter(adapter); tv.setText("WifiApState: " + wifiApManager.getWifiApState() + "\n\n"); tv.append("Clients: \n"); for (ClientScanResult clientScanResult : clients) { //tv.append("IpAddr: " + clientScanResult.getIpAddr() + "\n"); // tv.append("Device: " + clientScanResult.getDevice() + "\n"); // tv.append("HWAddr: " + clientScanResult.getHWAddr() + "\n"); // tv.append("isReachable: " + clientScanResult.isReachable()+ "\n"); } } } @Override public void …
possible better answer: http://stackoverflow.com/a/20889693
upvote count: 1
tagged with: custom-adapter
tagged with: android
favorite count: 0
tagged with: android-asynctask
downvote count: 0
has answer: http://stackoverflow.com/a/20889645
accepted answer: http://stackoverflow.com/a/20889645
has title: How to use CustomAdapter with ListView
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20889693

http://stackoverflow.com/q/20853630
has comment: http://stackoverflow.com/comment/31283312
score: 0
tagged with: sql
has title: Java - Inner Join with 3 Table
tagged with: ms-access-2007
has comment: http://stackoverflow.com/comment/31282707
answer count: 4
has answer: http://stackoverflow.com/a/20991375
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/20853669
downvote count: 1
has answer: http://stackoverflow.com/a/20853668
has comment: http://stackoverflow.com/comment/31282733
has body: i doing some project using Java(netbeans sw) and link to Microsoft Access. The problem occur when i need to inner join 3 tables together from Microsoft Access, i have no problem to inner join 2 tables together rsUpdate = stmtUpdate.executeQuery("SELECT * FROM A_User Inner Join A_PC ON A_USER.SN = A_PC.SN"); which i able to get the result. But not inner join with 3 tables rsUpdate = stmtUpdate.executeQuery ("SELECT * FROM A_User Inner Join A_CPU ON A_USER.SN = A_CPU.SN , Inner Join A_Software ON A_CPU.SN = A_Software.SN") For the SQL above I have 3 "A" table separately for USER | CPU | Software| USER PK is SN | CPU FK is SN | Software PK is SN | The Error I got java.sql.SQLException:Characters found after end SQL statement Thanks
has answer: http://stackoverflow.com/a/20853694
tagged with: java
linked to: http://stackoverflow.com/q/10195451
has comment: http://stackoverflow.com/comment/31283253
tagged with: inner-join
type: Question

http://stackoverflow.com/q/21015306
has comment: http://stackoverflow.com/comment/31587358
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31586956
tagged with: android
has answer: http://stackoverflow.com/a/21015580
has body: I've been working on this program for an Android app assignment, and though Eclipse has no problems with the code, my phone can't seem to run it. I am a novice in Android programming, so please bear with me. This Android app is a simple "Guess My Number" game in a blank activity. The user is to guess from 1-100, enter their answer inside a EditText view, and submit it with a push of a button. The design is fine, but getting it to work with OnClickListener is a hassle. The app crashes on my GS3 as soon as I press the button. The most troubling part is getting the button to act and give outputs in the form of Toast. Attached is the code from MainActivity.java. I managed to pick up different snippets of code through StackOverflow as well as a bit of Java that I knew. The result is imperfect; it was worth trying though. You may see my complete project here. Thank you for your time, and I appreciate whatever help I can get. package com.lookjohn.guessnumber; import java.util.Random; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends Activity { Random random; Button button; EditText text; int input; int MIN = 1, MAX = 100; int comp; int guesses; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); random = new Random(); button = (Button)findViewById(R.id.button1); text = (EditText)findViewById(R.id.editText1); comp = random.nextInt(MAX - MIN + 1) + MIN; guesses = 0; button.setOnClickListener(myhandler1); } View.OnClickListener myhandler1 = new View.OnClickListener() { public void onClick(View v) { String value = text.getText().toString(); // Get value from input from editTextView input = Integer.parseInt(value); // Turn string into integer do{ guesses++; if(input &gt; comp) Toast.makeText(MainActivity.this, "Number is too b…
possible better answer: http://stackoverflow.com/a/21015617
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21015617
has comment: http://stackoverflow.com/comment/31604607
tagged with: java
accepted answer: http://stackoverflow.com/a/21015580
has comment: http://stackoverflow.com/comment/31587167
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/31604856
has comment: http://stackoverflow.com/comment/31586744
has title: OnClickListener and Toast not cooperating

http://stackoverflow.com/q/20851236
tagged with: spring-mvc
tagged with: java
has answer: http://stackoverflow.com/a/20855047
has comment: http://stackoverflow.com/comment/31278594
has comment: http://stackoverflow.com/comment/31285463
type: Question
has answer: http://stackoverflow.com/a/36710422
has comment: http://stackoverflow.com/comment/31293066
has body: I have made a simple program but getting following error. I am using Eclipse Kelper and Tomcat 7.0. Tried a lot of things, but nothing is working for me :( HTTP Status 500 - Servlet.init() for servlet loginDispacher threw exception type Exception report message Servlet.init() for servlet loginDispacher threw exception description The server encountered an internal error that prevented it from fulfilling this request. exception javax.servlet.ServletException: Servlet.init() for servlet loginDispacher threw exception org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041) org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603) org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312) java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) java.lang.Thread.run(Unknown Source) root cause java.lang.NoSuchMethodError: org.springframework.core.GenericTypeResolver.resolveTypeArguments(Ljava/lang/Class;Ljava/lang/Class;)[Ljava/lang/Class; org.springframework.core.convert.support.GenericConversionService.getRequiredTypeInfo(GenericConversionService.java:260) org.springframework.core.convert.support.GenericConversionService.addConverter(GenericConversionService.java:83) org.springframework.core.convert.support.DefaultConversionService.addScalarConverters(DefaultConversionService.java:63) org.springframework.core.convert.support.DefaultConversionService.addDefaultConverters(DefaultConversionService.java:54) org.springframework.core.convert.support.DefaultConversionService.(DefaultConversionServic…
has comment: http://stackoverflow.com/comment/31283651
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/69185772
has comment: http://stackoverflow.com/comment/31281989
has answer: http://stackoverflow.com/a/29251750
downvote count: 0
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/31309534
has title: Spring MVC - HTTP Status 500 - Servlet.init() for servlet loginDispacher threw exception
has comment: http://stackoverflow.com/comment/31283610
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/61019555
has answer: http://stackoverflow.com/a/69061147
tagged with: spring
answer count: 4

http://stackoverflow.com/a/28698247
has body: In my case it turned out that org.kie kie-ci was missing in my POM
type: Answer
downvote count: 0
score: 7
answers question: http://stackoverflow.com/q/20995133
accepted answer of: http://stackoverflow.com/q/20995133
upvote count: 7
type: AcceptedAnswer

http://stackoverflow.com/comment/31548714
type: AnswerComment
comment on: http://stackoverflow.com/a/20990385
score: 0
has text: I just thought of another Solution. instead of using an Internal frame for this. Use a modal JDialog. You can create it the same way you did the `JInternal` frame, and show it the same way. This will guarantee you dont get this result. :)
type: Comment

http://stackoverflow.com/comment/31489517
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20962310
type: QuestionComment
has text: if your project is in java and you are using JDBC driver, why would you need the FreeTDS ?

http://stackoverflow.com/comment/31358114
score: 0
comment on: http://stackoverflow.com/q/20889573
type: Comment
type: QuestionComment
has text: Use the fix, so the `switch` is converted into an `if-else`-statement.

http://stackoverflow.com/q/20881540
tagged with: sql
linked to: http://stackoverflow.com/q/782823
has comment: http://stackoverflow.com/comment/31335575
duplicate of: http://stackoverflow.com/q/782823
type: UnansweredQuestion
has title: Getting exception '0000-00-00' can not be represented as java.sql.Date Even if i am using resultset.getString() method
has answer: http://stackoverflow.com/a/20881808
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/20881792
has comment: http://stackoverflow.com/comment/31335765
type: Question
has comment: http://stackoverflow.com/comment/31335672
has body: I have a database table whose structure is as follows: To retrieve the data i have used query Select * from mytable In java I am using resultset rs My code is if(rs.next()) { str[0] = rs.getString("id").trim(); str[1] = rs.getString("userid").trim(); str[2] = rs.getString("keyword").trim(); str[3] = rs.getString("field").trim(); str[4] = rs.getString("type").trim(); str[5] = rs.getString("assignee").trim(); str[6] = rs.getString("category").trim(); str[7] = rs.getString("subcategory").trim(); str[8] = rs.getString("publicationDateFrom").trim(); str[9] = rs.getString("publicationDateTo").trim(); str[10] = rs.getString("date").trim(); str[11] = rs.getString("time").trim(); str[12] = rs.getString("assigneeNames").trim(); str[13] = rs.getString("categoryNames").trim(); str[14] = rs.getString("subcategoryNames").trim(); } The problem is i am always getting exception of Value '0000-00-00' can not be represented as java.sql.Date[Ljava.lang.StackTraceElement;@42c7d3 Please point me in right direction.
duplicate of: http://stackoverflow.com/q/17195343
has answer: http://stackoverflow.com/a/20881616
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/31335640

http://stackoverflow.com/comment/31578072
has text: 1. If I remove `final` I get an error under `json` in `json = result`. "Cannot refer to a non-final variable json inside an inner class defined in a different method" The quick fix says to add final. 2. The ion library by Koush is also Async.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21010235
type: Comment

http://stackoverflow.com/comment/31468060
type: QuestionComment
comment on: http://stackoverflow.com/q/20947495
has text: Are you wanting to use WebSphere but not have existing sessions go to the same cluster member? (If so, why?) Or are you concerned about session failover when the primary cluster member isn't available?
score: 0
type: Comment

http://stackoverflow.com/comment/31467668
comment on: http://stackoverflow.com/q/20946618
score: 0
type: Comment
type: QuestionComment
has text: exactly i have this problem,the google search result HTML is difrrent

http://stackoverflow.com/comment/31449973
has text: That, if you notice, is a minor issue. As I mentioned -- and Jeroen commented -- you can't change an instance of `Game` from `StartupState`.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20941469

http://stackoverflow.com/q/20941219
possible better answer: http://stackoverflow.com/a/20941856
upvote count: 1
tagged with: layout-manager
has comment: http://stackoverflow.com/comment/31449964
favorite count: 0
has title: Auto adjust button width
has answer: http://stackoverflow.com/a/20941561
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20941561
downvote count: 0
tagged with: swing
tagged with: boxlayout
has body: I have a JPanel with 3 buttons ( its a JPanel which is going to contain a menu with buttons and JLabels). The buttons need to be stacked on top of each other, with a small space between them. I have the buttons stacked with : BoxLayout myLayout = new BoxLayout(this, BoxLayout.Y_AXIS); this.setLayout(myLayout); this.setPreferredSize(new Dimension(300,150)); Now the buttons are auto stacked when added, but they are all different size depending on the amount of text in it. What I want is the buttons to be in the Center of the JPanel and have the width of the panel - 10 px on each side. What i have: give all the buttons: .setPreferredSize(new Dimension(280,20)); but it didnt make any diffrent. To be more clear i will post the complete code so you can see what i mean: private JButton buttonStartStop; private JButton buttonReset; public ViewControlsPanel() { BoxLayout myLayout = new BoxLayout(this, BoxLayout.Y_AXIS); this.setLayout(myLayout); this.setPreferredSize(new Dimension(300,150)); buttonStartStop = new JButton("Start"); buttonStartStop.setPreferredSize(new Dimension(280,30)); buttonReset = new JButton("Reset"); buttonReset.setPreferredSize(new Dimension(280,20)); this.add(buttonStartStop); this.add(buttonReset); } I have tried to give diffrent dimension but it didnt help. My guess is that it is possible to give the BoxLayout a propperty to give the containing components a preffered size but i cant find it.
tagged with: jbutton
type: Question
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/7143287
has answer: http://stackoverflow.com/a/20941856
linked to: http://stackoverflow.com/q/7229226
answer count: 2

http://stackoverflow.com/q/20902455
type: Question
has comment: http://stackoverflow.com/comment/31374486
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/20902554
type: UnansweredQuestion
has body: I am new to stored procedure, I am using hibernate concept to retrieve data from the database. client server traffic is more so I decide to move to SP by doing simple logics in server side and return needed values to front end. Now I want to know that is there any way to store records to list, so that I can rotate the list of records in a loop and ask them to come one by one and get a single field from a record and make a process then return a value to front end like we are doing in Java? List,getter,setter and generic class to store needed entities. I am confused with this.Please advise and guide me to know well about stored procedures.
tagged with: stored-procedures
tagged with: java
tagged with: mysql
has title: Can we store records got from a query to a list in stored procedure?

http://stackoverflow.com/a/20903194
type: Answer
has body: By your exception's stack trace, any of your inserting value is above the precision defined on DB column. And most probable it will be with value generated by sequence. Just check what next value your sequence generating and increase the size a/c to that.
answers question: http://stackoverflow.com/q/20899603
score: 0

http://stackoverflow.com/comment/31335580
comment on: http://stackoverflow.com/a/20880058
score: 3
has text: Works also without setting the `PropertyPlaceholderConfigurer` to ignore a not found resource.
type: AnswerComment
type: Comment

http://stackoverflow.com/q/20884891
has comment: http://stackoverflow.com/comment/31344010
has body: Hi i am to 'you' with java so need some help with this code block i am calling java code from pl/sql XXX.execute(java.lang.String, java.lang.String, java.lang.String) return java.lang.String public class XXX { public static String execute(String executable, String workingdir, String input) { String line = ""; try { Command command = new Command(input, executable, "-a", workingdir + "ndrg.gg"); command.execute(); line = command.getErrorOutput(); if (line.contains("1 records processed")) { line = command.getOutput(); if (line.length() &gt; input.length() + 1) { line = command.getOutput().substring(input.length() + 1); } else { line = "ERROR:1- " + line; } } else { line = "ERROR: " + line; } } catch (Exception ex) { ex.printStackTrace(); line = "ERROR: " + ex.getMessage(); }; return line; } } I need to check if command.execute do not response 10 sec then XXX.execute return a ERROR i read about ExecutorService and Future but ... :(
favorite count: 0
has title: How to use executor and future
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31343378
has comment: http://stackoverflow.com/comment/31348076
tagged with: plsql
has answer: http://stackoverflow.com/a/20890503
accepted answer: http://stackoverflow.com/a/20890503
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/31342850

http://stackoverflow.com/a/59537785
has body: troubleshooting-friendly style You should not call .get() directly. Optional<>, that Stream::max returns, was designed to benefit from .orElse... inline handling. If you are sure your arguments have their size of 2+: list.stream() .map(u -> u.date) .max(Date::compareTo) .orElseThrow(() -> new IllegalArgumentException("Expected 'list' to be of size: >= 2. Was: 0")); If you support empty lists, then return some default value, for example: list.stream() .map(u -> u.date) .max(Date::compareTo) .orElse(new Date(Long.MIN_VALUE)); CREDITS to: @JimmyGeers, @assylias from the accepted answer.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/20995664

http://stackoverflow.com/a/76282924
answers question: http://stackoverflow.com/q/20871763
type: Answer
has body: There is no use or impact thats why we should not declare unchecked exceptions in the throws keyword as throws keyword required only to convince compiler and unchecked exceptions are not checked by compiler as these are runtime exceptions.
score: 0

http://stackoverflow.com/q/20936727
score: -1
type: Question
has comment: http://stackoverflow.com/comment/31451683
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/31440908
has answer: http://stackoverflow.com/a/20942944
has title: Strange JFrame Tabbed Panel Text in Netbeans
favorite count: 0
has body: When I run my program, I have a button called "Create new account" that opens a new jframe (bad design I know), and when this new window opens, it suddenly distorts and changes the color of some of the text on tabbed panels from the previous jframe. Here are some images of the problem I'm experiencing. Look at the tabs labeled administration, create new account, and modify existing account Before: After: Any help or insight as to why the text gets distorted would really be appreciated.
has comment: http://stackoverflow.com/comment/31440734
upvote count: 0
tagged with: netbeans
has comment: http://stackoverflow.com/comment/31441251
has comment: http://stackoverflow.com/comment/31441183
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31441056
tagged with: swing
tagged with: java

http://stackoverflow.com/q/20940898
type: Question
answer count: 2
tagged with: restrict
accepted answer: http://stackoverflow.com/a/20940915
tagged with: localhost
upvote count: 2
tagged with: java
tagged with: java-websocket
has title: Restrict java-websocket access to localhost
has answer: http://stackoverflow.com/a/20940915
has body: I'm writing a java-websocket server as a cryptocurrency client. For security reasons, I'd like to restrict access to the local machine. Is there a way to restrict access to a java-websocket server by IP or hostname? If so, how?
possible better answer: http://stackoverflow.com/a/22720690
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/22720690
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/20909932
score: 0
answer count: 2
has title: Trouble with converting a String into a Joda DateTime object
tagged with: file-io
has answer: http://stackoverflow.com/a/20910181
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/74756651
has answer: http://stackoverflow.com/a/20910086
tagged with: java
accepted answer: http://stackoverflow.com/a/20910181
type: Question
tagged with: jodatime
has body: Trouble with converting a String into a Joda DateTime object. I can't figure out what I am doing wrong. I am following instructions on other threads here on StackOverflow, but the following code does not work. It throws this exception: Exception in thread "main" java.lang.NullPointerException at org.joda.time.format.DateTimeFormatterBuilder$NumberFormatter.parseInto(DateTimeFormatterBuilder.java:1330) at org.joda.time.format.DateTimeFormatterBuilder$Composite.parseInto(DateTimeFormatterBuilder.java:2741) at org.joda.time.format.DateTimeFormatter.parseDateTime(DateTimeFormatter.java:853) at co.restclient.ExpiringCookie.<init>(ExpiringCookie.java:41) at co.restclient.ExpiringCookie.main(ExpiringCookie.java:29) And here is the code. import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.Properties; import org.joda.time.DateTime; import org.joda.time.Duration; import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; /* * This class stores a cookie value and can tell when its expired by its timestamp */ public class ExpiringCookie { public static DateTimeFormatter fmt = DateTimeFormat.forPattern( "dd/MM/YYYY HH:mm:ss" ); public static File cookieJar = new File("cookie.xml"); public String singleCookie; DateTime startTime; DateTime currentTime; boolean isExpired = false; public static void main( String[] args ) { ExpiringCookie ec = new ExpiringCookie( "xxxxxxx" ); System.out.println( "Age of cookie: " + ec.timePassed().getMillis() ); } public ExpiringCookie( String cookie ) { currentTime = new DateTime(); Properties properties = new Properties(); if ( cookieJar.exists() ) { try { properties.load( new FileInputStream( cookieJar ) ); new DateTime(); //startTime = DateTime.parse( properties.getProperty( "startTime" ), DateTimeFormat.forPattern( "dd/MM/YYYY HH:mm:ss" ) ); startTime = fmt.parseDateTime( properties.getProperty( "st…
possible better answer: http://stackoverflow.com/a/20910086
has comment: http://stackoverflow.com/comment/31389296
tagged with: date

http://stackoverflow.com/comment/31518153
type: AnswerComment
comment on: http://stackoverflow.com/a/20962169
score: 0
type: Comment
has text: @StephenMcCants In that case it definitely seems like it. One alternative approach could be to use something like the JavaFX sound library instead if you can - perhaps that would work just by bypassing Javasound? (The latter being really rather broken and buggy anyway.)

http://stackoverflow.com/comment/31472438
comment on: http://stackoverflow.com/a/20953834
score: 0
type: AnswerComment
type: Comment
has text: Thanks @lukelazarovic, I'm running jre6, how can I know which version of JVM my SQL SERVER driver is compatible with ?... with the logic of your answer, if I use jre 1.7 I should not have any problem, which is not true for me, I'm still getting the same exception with jre 1.7.

http://stackoverflow.com/q/20976101
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31527974
tagged with: test-suite
downvote count: 0
has title: How to get a collection of tests in a JUnit 4 test suite
has comment: http://stackoverflow.com/comment/31514619
has answer: http://stackoverflow.com/a/20985784
has comment: http://stackoverflow.com/comment/31530650
tagged with: junit
has answer: http://stackoverflow.com/a/20998984
favorite count: 0
possible better answer: http://stackoverflow.com/a/20985784
upvote count: 1
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/4107498
accepted answer: http://stackoverflow.com/a/20998984
score: 1
tagged with: java
has body: In JUnit 3, I could get all of the tests within a test suite with the following code: TestSuite allTestsSuite = (TestSuite) AllTests.suite() Enumeration enumeration = allTestsSuite.tests(); ArrayList listOfTests = Collection.list(enumeration); However, I can't find an equivalent way of doing this in JUnit 4. Classes no longer have a .suite() method; they simply use the @Suite annotation. This wouldn't be a problem except that the Suite class no longer has a tests() method. There is a children() method, but that returns a list of Runners, which seem to be something different than why I'm looking for. So how can I get the tests within a test suite in JUnit 4, like I could with JUnit 3?

http://stackoverflow.com/comment/31296014
score: 1
comment on: http://stackoverflow.com/q/20860543
has text: 1) Use the other FileWriter constructor, the one that takes a boolean second parameter. The API should be able to help you. 2) You need to work on your Google search skills a bit.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31524053
has text: Do you have any actual evidence indicating that `toUpperCase` would actually be a performance bottleneck in your application, or that the allocation would be unacceptable? Allocation, especially of short-lived objects, is cheaper than you might think.
score: 0
comment on: http://stackoverflow.com/q/20980225
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31364846
type: Comment
has text: Thats because I got update 45.
comment on: http://stackoverflow.com/q/20896848
score: 0
type: QuestionComment

http://stackoverflow.com/a/60161737
has body: With java.nio.path, you even better get an independent OS path without any concern about path delimiter. public class PathsGetMethod { public static void main(String[] args) { Path path = Paths.get("C:\\Users\\conta\\OneDrive\\", "desktop", "data"); System.out.println(path); //C:\Users\conta\OneDrive\desktop\data } }
type: Answer
score: 0
answers question: http://stackoverflow.com/q/20979625

http://stackoverflow.com/a/21002945
score: 1
has body: The compiler will recognize the first two quote marks, but the third one will produce a syntax error. Using an escape sequence will place a double quote as such: nextLink1.replace("\"",""); You can find more escape sequences here http://docs.oracle.com/javase/tutorial/java/data/characters.html
type: Answer
answers question: http://stackoverflow.com/q/21002844
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/31590521
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21017292
type: QuestionComment
has text: So what's the stack trace?

http://stackoverflow.com/q/20981987
linked to: http://stackoverflow.com/q/16127070
accepted answer: http://stackoverflow.com/a/20982166
has body: I want to read in a properties file with my data source connection information and be able to get those values from my Spring-Datasource.xml file. Here is what I have: Code Properties prop = properties.load(new FileReader(fileName)); PropertySource myPropertySource = new MyPropertySource(prop); AbstractApplicationContext applicationContext = new ClassPathXmlApplicationContext(new String[]{"/applicationContext.xml"},false); applicationContext.getEnvironment().getPropertySources().addFirst(myPropertySource); System.out.println(applicationContext.getEnvironment().getProperty("database.username")); applicationContext.refresh(); This will display the correct value for database.username. Spring-Datasource.xml &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt; &lt;property name="driverClassName" value="${database.driver}"/&gt; &lt;property name="url" value="${database.url}"/&gt; &lt;property name="username" value="${database.username}"/&gt; &lt;property name="password" value="${database.password}"/&gt; &lt;/bean&gt; I end up with the following error, it does not seem to find any of the properties. Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'dataSource' defined in class path resource [Spring-Datasource-dev.xml]: Could not resolve placeholder 'database.driver' Am I accessing them wrong, or missing something? Thanks.
has comment: http://stackoverflow.com/comment/31526651
favorite count: 0
score: 2
upvote count: 2
tagged with: spring
type: AnsweredQuestion
has title: Access Spring properties from PropertySource
tagged with: java
has answer: http://stackoverflow.com/a/20982166
type: Question
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/31487725
has text: I see where the problem is. I accidentally put the same indexed variable twice in the NetBeans Variables window. Sorry about that.
comment on: http://stackoverflow.com/q/20960909
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31513991
comment on: http://stackoverflow.com/q/20975237
type: Comment
type: QuestionComment
score: 0
has text: oh... thanks. haha fail. while(!this.pool.awaitTermination(10, TimeUnit.Seconds)){ System.out.println("pool still running"); this.pool.shutdown();} this fixed it :) thanks again

http://stackoverflow.com/comment/127337739
type: AnswerComment
has text: @deepakl.2000 run it online: https://www.online-ide.com/03crhm6aOu . You'll get a compilation error. The variable names are inconsistent.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20945268

http://stackoverflow.com/comment/31512004
type: QuestionComment
has text: i want to know is it possible to display only the nodes inside a JScrollPane?? --> DYm to remove leaf and root
score: 0
comment on: http://stackoverflow.com/q/20974671
type: Comment

http://stackoverflow.com/comment/31399222
type: AnswerComment
type: Comment
has text: Could you link me to IBM's error code convention? is that public? I am also thinking of using alphabetic prefix to create namespace for different components, in order to avoid conflict between plugins because numeric error code is flat. But a good question is, as I have started using alphabetic prefix, why not directly use string as error code?
comment on: http://stackoverflow.com/a/20914868
score: 1

http://stackoverflow.com/a/20899171
answers question: http://stackoverflow.com/q/20897094
type: AcceptedAnswer
has body: You can go through http://www.ibm.com/developerworks/webservices/library/wa-spring3webserv/ How big is your request/response? It shouldn't matter anyway. If it is file that you want to send as a request, you can use MultipartFile.
type: Answer
accepted answer of: http://stackoverflow.com/q/20897094
score: 0

http://stackoverflow.com/a/20887764
type: Answer
has body: Firstly, Use javax.swing.Timer for Swing programs, not java.util.Timer! Then Timer timer = new Timer(duration, this); timer.start(); Also, the call to .start() need to be from within the constructor or some method Timer timer; public Road(){ timer = new Timer(1000, this); timer.start(); } As a side note. Don't override paint override paintComponent and call super.paintComponent(g); protected void paintComponent(Graphics g){ super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; g2.drawImage(img, p.layer1, 0, null); g2.drawImage(p.img, p.x, p.y, null); }
upvote count: 2
answers question: http://stackoverflow.com/q/20887721
score: 2
downvote count: 0

http://stackoverflow.com/comment/31292422
type: AnswerComment
has text: Panneersel Hey, thanks! Now I know how to save in database by getting the absolute file path. However, I did not managed to upload into my folder. Please take a look at my EDITED question. Thanks! :)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20851514

http://stackoverflow.com/comment/31494282
type: QuestionComment
has text: Check your packaged war file whether jars are available..
type: Comment
comment on: http://stackoverflow.com/q/20965050
score: 0

http://stackoverflow.com/q/20878999
favorite count: 0
has answer: http://stackoverflow.com/a/20879011
possible better answer: http://stackoverflow.com/a/20879019
has comment: http://stackoverflow.com/comment/31331211
has answer: http://stackoverflow.com/a/20879019
has answer: http://stackoverflow.com/a/20879352
has answer: http://stackoverflow.com/a/20879018
has answer: http://stackoverflow.com/a/20879010
type: AnsweredQuestion
tagged with: java
upvote count: 1
downvote count: 1
linked to: http://stackoverflow.com/q/5564410
type: Question
answer count: 8
has answer: http://stackoverflow.com/a/20879065
accepted answer: http://stackoverflow.com/a/20879352
has title: Null pointer Exception in array List
has answer: http://stackoverflow.com/a/20879093
has body: ArrayList&lt;String&gt; list1=new ArrayList&lt;String&gt;(); list1=object.getsomeFiles(); getsomeFiles() contains some code which returns file names if exists or returns null I checked with if(list1!=null&amp;&amp;!list1.isEmpty()) but still NullPointerException is thrown. When I did debugging I found that list1 holds null value.
tagged with: arraylist
score: 0
has answer: http://stackoverflow.com/a/20879515

http://stackoverflow.com/a/21011526
answers question: http://stackoverflow.com/q/21004983
type: Answer
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21004983
has body: I think your problem can be solved simply by using the lemma(String word, String tag) method in the current CoreNLP's Morphology class: String word = ...; String tag = ...; String lemma = morphology.lemma(word, tag); WordTag wt = new WordTag(lemma, tag); When the class was revised a couple of years ago, the method you're looking for was deleted. The feeling was that with most of the Stanford NLP code moving to using CoreLabels, methods that return WordTag are less useful (though deleting all such methods is still a work in progress).

http://stackoverflow.com/q/20867486
has body: I am new to java . I have 2 ArrayLists of Strings List&lt;String&gt; a= [2,14] List&lt;String&gt; b= [2,3,4,5] I want two new ArrayLists 1) List has the value which is in b but not in a List&lt;String&gt; c= [3,4,5] 2) List has the value a but not in b List&lt;String&gt; d=[14] I tried: List&lt;String&gt; c = new ArrayList&lt;String&gt;(b); c.removeAll(a); System.out.println("c::::::::::::::::::::::::::::::"+c); // 2,3,4,5 which is not removing the values of List a Complete Code public static void updatePartyType(List&lt;String&gt; oldPartyKeys, List&lt;String&gt; newPartyKeys, String customerCode) { System.out.println("oldPartyKeys---&gt;"+oldPartyKeys);// 2,14 System.out.println("newPartyKeys---&gt;"+newPartyKeys); // 2,3,4,5 System.out.println("oldPartyKeys class ---&gt;"+oldPartyKeys.getClass());// class java.util.ArrayList List&lt;String&gt; newlySelectedPartyKeys = new ArrayList&lt;String&gt;(newPartyKeys); newlySelectedPartyKeys.removeAll(oldPartyKeys); System.out.println("newlySelectedPartyKeys::::::::::::::::::::::::::::"+newlySelectedPartyKeys);
tagged with: java
has answer: http://stackoverflow.com/a/20867511
has answer: http://stackoverflow.com/a/20867520
has answer: http://stackoverflow.com/a/20867512
has comment: http://stackoverflow.com/comment/31309780
score: 0
has comment: http://stackoverflow.com/comment/31309479
has comment: http://stackoverflow.com/comment/31309452
favorite count: 0
has answer: http://stackoverflow.com/a/20867530
answer count: 5
has answer: http://stackoverflow.com/a/20867509
accepted answer: http://stackoverflow.com/a/20867512
has comment: http://stackoverflow.com/comment/31309907
possible better answer: http://stackoverflow.com/a/20867530
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31310465
upvote count: 1
downvote count: 1
has title: Java : Create new ArrayLists based on some condition from existing ArrayList
type: Question

http://stackoverflow.com/comment/79994730
comment on: http://stackoverflow.com/a/20892454
has text: @Lokiare: yep, that depends on the orientation of your axes. -angle will also work.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/20920174
tagged with: android
has body: I have a simple widget containing an ImageView. I'd like to fetch an image from the web and display it in the ImageView while maintaining the aspect ratio. Here's the layout definition for the widget: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/widget_layout" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;ImageView android:id="@+id/quality_image" android:layout_width="fill_parent" android:layout_height="match_parent" android:layout_below="@+id/widget_icon" android:layout_marginBottom="@dimen/widget_spacing" android:scaleType="fitXY" /&gt; &lt;/LinearLayout&gt; ..and this is the image in question: I'd like the image to always fit the height of the ImageView. This bit has been easy. If the width of the ImageView is less than that of the image, I don't mind if the image gets cropped horizontally as long as the aspect ratio is maintained. I've set the maximum size of the widget to never be more than the size of the image so we don't have to worry about cases when the height of the ImageView is more than the image. I'm terribly lost with this and have begin wondering if this is even possible since there doesn't seem to be way to access the widget dimensions. Sometimes the most trivial things bog you down.
tagged with: android-image
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: android-imageview
has title: How can I fill an ImageView in an Appwidget while mainiting the aspect ratio?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21973733
answer count: 1
downvote count: 0
score: 1
tagged with: android-appwidget

http://stackoverflow.com/comment/31538658
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20968958
score: 0
has text: @greg-449 I was able to make the ProgressBar appear faster by updating it less frequently. But I still wonder how it works properly on win 7.

http://stackoverflow.com/comment/31574258
type: QuestionComment
score: 1
has text: @Zefnus don't forget [LINQ](http://msdn.microsoft.com/en-us/library/bb397926.aspx), [async/await](http://msdn.microsoft.com/en-us/library/hh191443.aspx), [type inference](http://msdn.microsoft.com/en-us/library/bb384061.aspx), [real properties](http://msdn.microsoft.com/en-us/library/x9fsa0sw.aspx), [extension methods](http://msdn.microsoft.com/en-us//library/bb383977.aspx) and real generics as opposed to the bizarre "type erasure" stuff. Not to mention [upcoming features](http://damieng.com/blog/2013/12/09/probable-c-6-0-features-illustrated) such as monadic null checking...
comment on: http://stackoverflow.com/q/21007276
type: Comment

http://stackoverflow.com/a/20961717
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20960614
has comment: http://stackoverflow.com/comment/120506792
answers question: http://stackoverflow.com/q/20960614
has comment: http://stackoverflow.com/comment/31531703
has comment: http://stackoverflow.com/comment/120513142
type: Answer
has comment: http://stackoverflow.com/comment/31532153
upvote count: 4
has comment: http://stackoverflow.com/comment/42258720
downvote count: 0
has comment: http://stackoverflow.com/comment/42226252
has body: If you want to strip out all non-printable characters, try this str = str.replaceAll("[^\\p{Graph}\n\r\t ]", ""); The regex matches all "invisible" characters, except ones we want to keep; in this case newline chars, tabs and spaces. \p{Graph} is a POSIX character class for all printable/visible characters. To negate a POSIX character class, we can use capital P, ie P{Graph} (all non-printable/invisible characters), however we need to not exclude newlines etc, so we need [^\\p{Graph}\n\r\t] .
score: 4
has comment: http://stackoverflow.com/comment/42268644

http://stackoverflow.com/comment/31423019
type: Comment
has text: I see an `InputStreamReader` lurking in that snippet.
comment on: http://stackoverflow.com/a/20927429
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31394040
score: 0
type: AnswerComment
has text: @NinaKoch The reason is the same - `Score` is parametrised and the declaration is not. Specifically the use of `Score` in `S extends Score`.
type: Comment
comment on: http://stackoverflow.com/a/20907097

http://stackoverflow.com/comment/31359334
comment on: http://stackoverflow.com/q/20893661
score: 0
type: Comment
type: QuestionComment
has text: i edited, sorry for the Polish names

http://stackoverflow.com/a/20869740
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/20869700
answers question: http://stackoverflow.com/q/20869700
has body: java class is compiled to form a .jar file and not an .exe file A Jar file is essentially a collection of files (mostly archives of java classes) in one file, similar to a ZIP file. A Jar file facilitates the packaging of applications into one file. In addition to the Java class files and resources, a Jar file can contain a META-INF directory. The most important file in this directory is manifest.mf. It is used to define extension and package related data. The Main-Class: classname in the manifest file specifies the class that gets executed first.
has comment: http://stackoverflow.com/comment/31313652
type: AcceptedAnswer

http://stackoverflow.com/a/20885634
answers question: http://stackoverflow.com/q/20885372
has body: I did sth. similar for my DAO layer public interface EntityDAO&lt;E, I&gt; { public boolean update(final E entity, Connection connection); public E getByID(I id, Connection connection); public boolean delete(final I identifier, Connection connection); } public abstract class AbstractEntityDAO&lt;E extends Entity, I extends Number&gt; implements EntityDAO&lt;E, I&gt; { @Override public boolean update(E entity, Connection connection) { // TODO Auto-generated method stub return false; } @Override public E getByID(I id, Connection connection) { // TODO Auto-generated method stub return null; } @Override public boolean delete(I identifier, Connection connection) { // TODO Auto-generated method stub return false; } } And finally the concrete subclass will define the types of the entity object. public class AddressEntityDAO extends AbstractEntity&lt;Address, Integer&gt; { @Override public boolean update(Address entity, Connection connection) { return super.update(entity, connection); } @Override public Address getByID(Integer id, Connection connection) { return super.getByID(id, connection); } @Override public boolean delete(Integer identifier, Connection connection) { return super.delete(identifier, connection); } }
score: 0
type: Answer

generic-collections
tags question: http://stackoverflow.com/q/21011599
type: Tag
tags question: http://stackoverflow.com/q/20934954
tag name: generic-collections

http://stackoverflow.com/q/20893905
has answer: http://stackoverflow.com/a/20893951
tagged with: android
linked to: http://stackoverflow.com/q/22136032
type: AnsweredQuestion
has body: I am using a searchview inside fragment and getting a nullpointerexception. I don't understand why, I'm just trying to get the query... I'm using a 3 tab fragment and the app crash when launching MainActivity.java public class MainActivity extends FragmentActivity implements ActionBar.TabListener { private ViewPager viewPager; private TabsPagerAdapter mAdapter; private ActionBar actionBar; // Tab titles private String[] tabs = { "Search", "Top", "Download", "Library" }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Initilization viewPager = (ViewPager) findViewById(R.id.pager); actionBar = getActionBar(); mAdapter = new TabsPagerAdapter(getSupportFragmentManager()); viewPager.setAdapter(mAdapter); actionBar.setHomeButtonEnabled(false); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Adding Tabs for (String tab_name : tabs) { actionBar.addTab(actionBar.newTab().setText(tab_name) .setTabListener(this)); } /** * on swiping the viewpager make respective tab selected * */ viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int position) { // on changing the page // make respected tab selected actionBar.setSelectedNavigationItem(position); } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageScrollStateChanged(int arg0) { } }); } @Override public void onTabReselected(Tab tab, FragmentTransaction ft) { } @Override public void onTabSelected(Tab tab, FragmentTransaction ft) { // on tab selected // show respected fragment view viewPager.setCurrentItem(tab.getPosition()); } @Override public void onTabUnselected(Tab tab, FragmentTransaction ft) { } } SearchFragment.java public class SearchFragment extends Fragment { private SearchView searchView1; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View r…
upvote count: 1
accepted answer: http://stackoverflow.com/a/20893951
type: Question
tagged with: android-fragments
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31359469
tagged with: eclipse
has title: Android - Null pointer exception in searchview
has comment: http://stackoverflow.com/comment/31359466
answer count: 1
downvote count: 0
favorite count: 0
tagged with: searchview

wso2
tags question: http://stackoverflow.com/q/20903652
tag name: wso2
type: Tag
tags question: http://stackoverflow.com/q/21000145
tags question: http://stackoverflow.com/q/20858775

http://stackoverflow.com/comment/31299157
type: AnswerComment
has text: @Cogman. I agree that it is the more elegant approach of the two.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20861873

http://stackoverflow.com/a/20891489
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20891334
answers question: http://stackoverflow.com/q/20891334
has comment: http://stackoverflow.com/comment/31357049
has body: This isn't pretty and I don't recommend it. You should either use a @Bean annotated method to construct the bean or keep your XML. If you want still want to go ahead with this, annotate your StatelessEjbSupportLocal class with @Component. Annotate its setUserInfo with @Autowired and override the setBusinessInterface and setJndiName methods, annotating them with @Value with the value you want to use, and calling their super implementation. For example, @Override @Value("SomeBusinessImpl/local") // or reference some property public void setJndiName(String jndiName) { super.setJndiName(jndiName); } Then declare the package containing StatelessEjbSupportLocal in your component scan. Edit By OP: As Sotirios Delimanolis recommended. I left the XML configuration.
has comment: http://stackoverflow.com/comment/31357228
type: Answer
has comment: http://stackoverflow.com/comment/31356975
score: 0

http://stackoverflow.com/comment/31425677
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20928560
has text: @Daniel: `ArrayAdapter` can be used in this type of case, even if the usage is more complicated than the default of just populating `TextView`s. The items can be accessed from the `getItem()` method.

http://stackoverflow.com/comment/31399969
has text: Have you verified that the program you have written and the jre on the pi are the same? If not one of them needs to be changed.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20915276

http://stackoverflow.com/q/20954408
tagged with: android
has answer: http://stackoverflow.com/a/20954458
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20954507
type: Question
has body: I have the following dates: "Friday, January 31", "Wednesday, February 12", "Monday, February 17", "Wednesday, March 5", I want to set up a string function where I am given the number always: 31 12 17 5 I started with this function: String strCheck = suspendedDates[i]; int pos = strCheck.length(); int pos2 = strCheck.indexOf(" "); I am stuck right now, because how does it know which " " is it? Can someone help me with the function.
has answer: http://stackoverflow.com/a/20954484
has answer: http://stackoverflow.com/a/20954434
answer count: 6
has answer: http://stackoverflow.com/a/20955044
has answer: http://stackoverflow.com/a/20954442
tagged with: substring
score: 0
accepted answer: http://stackoverflow.com/a/20954484
has title: Get certain substring from a string value
possible better answer: http://stackoverflow.com/a/20954434
has comment: http://stackoverflow.com/comment/31473423

http://stackoverflow.com/q/20901300
type: Question
tagged with: out-of-memory
has body: The JDK 7 documentation has this to say about a SoftReference: "All soft references to softly-reachable objects are guaranteed to have been cleared before the virtual machine throws an OutOfMemoryError." However, in my test program, I'm seeing OutOfMemoryError consistently (except for the 'Stranger Behavior' section below): // RefObjectTest.java import java.util.*; import java.lang.ref.*; public class RefObjectTest { public static void main(String[] args) { ArrayList&lt;byte[]&gt; leaks = new ArrayList&lt;&gt;(); byte[] obj = new byte[10 * 1024 * 1024]; SoftReference&lt;byte[]&gt; ref = new SoftReference&lt;&gt;(obj); // WeakReference is supposed to be eagerly GC'ed, but I see no // difference in terms of program behavior: still get OOME. // // WeakReference&lt;byte[]&gt; ref = new WeakReference&lt;&gt;(obj); obj = null; while(true) { byte[] x = ref.get(); if(x == null) { System.out.println("Referent stands garbage collected!!"); break; } else { System.out.println("Referent still alive."); } // Leak memory in small, 10k increments. If soft reference // worked the way it's advertized, then just before the OOME, the // 10MB referent should have been GC'ed to accomodate this small // 10K new memory request. But it doesn't appear to work that way! // try { leaks.add(new byte[10 * 1024]); // } catch(OutOfMemoryError e) { // System.out.println(ref.get() == null ? "Referent cleared" : // "Referent still alive"); // } // VERY STRANGE: If I re-instate the above try-catch block, then no OOME is // thrown, and the program keeps printing "Referent still alive" lines // forever until I finally kill it with a Ctrl+C. // Uncommenting gc() tends to delay the OOME in terms of time, // but OOME eventually does happen, and after the same number of // iterations of this loop. // // System.gc(); } } } Here's the output: $ java -Xmx15m RefObjectTest Referent still alive. ... Referent still alive. Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at RefObjectTest.main…
accepted answer: http://stackoverflow.com/a/20901929
upvote count: 6
has title: Java SoftReference guarantee failing
tagged with: garbage-collection
answer count: 1
tagged with: java
has answer: http://stackoverflow.com/a/20901929
type: AnsweredQuestion
downvote count: 0
tagged with: soft-references
score: 6
favorite count: 0
tagged with: weak-references

http://stackoverflow.com/comment/31425966
type: QuestionComment
has text: Have you tried to add a new technologie? What have you tried, what has worked, and what hasn't?
score: 0
comment on: http://stackoverflow.com/q/20928901
type: Comment

http://stackoverflow.com/a/20999941
upvote count: 3
answers question: http://stackoverflow.com/q/20999769
type: AcceptedAnswer
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/31559283
has body: One option would be to do something like engine.eval("min = Math.min"); ... double result = (Double) engine.eval("min(2, 4)");
score: 3
accepted answer of: http://stackoverflow.com/q/20999769

http://stackoverflow.com/comment/31465056
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20945255
has text: @A.MohamedBilal: A complete example is examined [here](http://stackoverflow.com/a/13205322/230513).
type: Comment

http://stackoverflow.com/comment/31510536
has text: @Ankur: It doesn't matter what you do to the `oldSomeObject` reference inside the method, any changes will be discarded once the method ends, since it is a local variable.
score: 2
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20973886

http://stackoverflow.com/comment/31629990
type: Comment
has text: Ok, I see. I usually use MigLayout only with component constraints. I guess I have to dive into the row/col constraints. :) Thank you very much.
type: AnswerComment
comment on: http://stackoverflow.com/a/21017556
score: 0

http://stackoverflow.com/comment/31307094
comment on: http://stackoverflow.com/a/20865642
score: 0
type: Comment
has text: *"Still eating my whole processor,.."* Have you changed it to use a `Timer`?!? Batteries not included. That code as seen goes into an infinite loop. Of course it would tie up the CPU. **If you have changed it to use `Timer`, show us the new source as an edit to the question.**
type: AnswerComment

http://stackoverflow.com/comment/139993347
type: QuestionComment
comment on: http://stackoverflow.com/q/20943153
has text: `java.time.Year( 2025 ).isLeap()` [See Javadoc](https://docs.oracle.com/en/java/javase/23/docs/api/java.base/java/time/Year.html#isLeap()).
score: 0
type: Comment

http://stackoverflow.com/q/20946897
tagged with: django
tagged with: java
upvote count: 1
tagged with: amazon-sqs
has body: I have a django web App running on apache2 port number:8001. I hosted this app on amazon cloud in ubuntu machine. I get data on this port from a client application(Android App). Some time I get so many client request to submit data same time. Due to that there is a change of packet drop. So I want to use Amazon Simple Queuing Services(SQS) to ensure delivery of data without any delay or drop of packet. My question: Can I map the port or services that running on port 8001 with Amazon SQS. So that I get all the coming request through Queue. Is there any API or something to do this in Java/Android.
answer count: 0
type: UnansweredQuestion
tagged with: amazon-web-services
has title: How to map web services of a port with Amazon SQS
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: android

http://stackoverflow.com/comment/86282334
type: AnswerComment
score: 2
comment on: http://stackoverflow.com/a/20940888
type: Comment
has text: @HennoVermeulen switch-case is not an exception to the rule in this answer. The language specifies that `case k` requires a _constant expression_ which could be a _constant variable_ ("A constant variable is a final variable of primitive type or type String that is initialized with a constant expression" [JLS 4.12.4](https://docs.oracle.com/javase/specs/jls/se8/html/jls-4.html#jls-4.12.4)) which is a special case of a final variable.

http://stackoverflow.com/comment/31565821
comment on: http://stackoverflow.com/q/21003524
score: 0
type: Comment
type: QuestionComment
has text: @JonathanDrapeau what do you mean by recreating seat selection?? And how to disable it

http://stackoverflow.com/q/20922036
upvote count: 5
tagged with: java
has body: I've been following some Android development tutorials on Udemy, which have been very helpful, but now I've run into an issue with the tutors code. Not sure if this is because of an updated SDK or what, but the code does not error out in his video. package com.example.app; import android.app.ListActivity; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.os.Build; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import android.widget.AdapterView.OnItemClickListener; public class MainActivity extends ListActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String[]countries=getResources().getStringArray(R.array.countries); this.setListAdapter(new ArrayAdapter&lt;String&gt;( this, R.layout.list_element, R.id.countryName, countries)); } ListView listview = getListView(); listview.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, View clickView, int position, long id) { String country = countries[position]; Toast.makeText(MainActivity.this, String.format("%s was chosen.", country), Toast.LENGTH_SHORT).show(); } }); @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(); i…
type: Question
has answer: http://stackoverflow.com/a/20922131
score: 5
downvote count: 0
favorite count: 0
tagged with: android-listview
tagged with: android
has title: Android - Can't call setOnItemClickListener from a ListView
answer count: 4
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20922075
has answer: http://stackoverflow.com/a/20922093
has answer: http://stackoverflow.com/a/20922140

http://stackoverflow.com/comment/31575012
type: Comment
score: 0
type: AnswerComment
has text: Or something made for concurrency like [`ConcurrentHashMap`](http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ConcurrentHashMap.html)
comment on: http://stackoverflow.com/a/21008518

http://stackoverflow.com/comment/31510960
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20973786
has text: I have added another small addition to the question "can the scale for Graphics2D be set to mm instead of pixels".

http://stackoverflow.com/comment/31417800
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20924614
has text: But you need to store your duplicates somewhere to print it out.

http://stackoverflow.com/a/20909877
has comment: http://stackoverflow.com/comment/31395117
score: 0
has comment: http://stackoverflow.com/comment/31395143
answers question: http://stackoverflow.com/q/20909703
type: Answer
has body: Yes. From here, In addition to a hierarchically structured storage... Hierarchical in the sense of folders containing files and other folders.

http://stackoverflow.com/comment/31590569
has text: And so what? You're catching ParseException or what? What is your question exactly? I don't get any error when running your snippet.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/21017502
type: Comment

http://stackoverflow.com/a/20984535
type: Answer
accepted answer of: http://stackoverflow.com/q/20984472
has comment: http://stackoverflow.com/comment/31531524
answers question: http://stackoverflow.com/q/20984472
has comment: http://stackoverflow.com/comment/31532036
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31599874
upvote count: 1
type: AcceptedAnswer
has body: As you stated, the method you are proposing is not generic enough for the interface, so to have add/remove methods in the top level interface wouldn't make sense. Consider 2 interfaces, one that has the basic data operations and one that has list operations. public interface ListDataType extends DataType&lt;List&lt;DataType&gt;&gt; { // list operations }

http://stackoverflow.com/q/20920845
has comment: http://stackoverflow.com/comment/31409920
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31410459
has answer: http://stackoverflow.com/a/20920947
type: Question
possible better answer: http://stackoverflow.com/a/20920935
has comment: http://stackoverflow.com/comment/31410011
has answer: http://stackoverflow.com/a/20920935
has comment: http://stackoverflow.com/comment/31409909
has body: Hi I'm writting java servlet which should get DVDs depends on which user is logged in. I have method public List&lt;Dvd&gt; getDvdsByUserId(String user_id) throws SQLException { List&lt;Dvd&gt; dvds = new ArrayList&lt;Dvd&gt;(); Connection connection = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; try { connection = getConnection(); preparedStatement = connection.prepareStatement("SELECT * FROM sedivyj_dvd where user_id = ?;"); preparedStatement.setString(1, user_id); resultSet = preparedStatement.executeQuery(); while (resultSet.next()) { Dvd dvd = new Dvd(); dvd.setId(resultSet.getInt("id")); dvd.setUser_id(resultSet.getString("user_id")); dvd.setName(resultSet.getString("name")); dvd.setBorrower(resultSet.getString("borrower")); dvd.setMail(resultSet.getString("mail")); dvd.setBorrow_date(resultSet.getString("borrow_date")); dvd.setBorrow_until(resultSet.getString("borrow_until")); dvds.add(dvd); } } catch (SQLException e) { throw e; } finally { cleanUp(connection, preparedStatement); } return dvds; } and I don't know how to set up logged user id in servlet's doGet method: dvds = this.dvdDao.getDvdsByUserId(); loginServlet public class LoginServlet extends HttpServlet { private static final long serialVersionUID = 1L; private UserDao userDao; @Override public void init(ServletConfig config) throws ServletException { super.init(config); DbSettings dbSettings = new DbSettings(); dbSettings.setServer(config.getServletContext().getInitParameter("dbServer")); dbSettings.setPort(Integer.valueOf(config.getServletContext().getInitParameter("dbPort"))); dbSettings.setUser(config.getServletContext().getInitParameter("dbUser")); dbSettings.setPassword(config.getServletContext().getInitParameter("dbPassword")); dbSettings.setDatabase(config.getServletContext().getInitParameter("dbDatabase")); try { this.userDao = new UserDao(dbSettings); } catch (ClassNotFoundException e) { throw new ServletException("Unable to initialize DB driver", e); } } p…
has answer: http://stackoverflow.com/a/20921009
has comment: http://stackoverflow.com/comment/31410133
tagged with: servlets
has comment: http://stackoverflow.com/comment/31409956
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/20920947
has comment: http://stackoverflow.com/comment/31409885
has title: Get data from db, java servlet
has comment: http://stackoverflow.com/comment/31410745
has comment: http://stackoverflow.com/comment/31452320

http://stackoverflow.com/q/20918286
has body: I want to write a ant script to compile Java source code of our application. I know I need to add WEB-INF/classes and jars in WEB-INF/lib to classpath, I want to know what other jar files I need and where to find them
tagged with: java
has answer: http://stackoverflow.com/a/20918328
accepted answer: http://stackoverflow.com/a/21050079
type: Question
answer count: 2
tagged with: weblogic
has comment: http://stackoverflow.com/comment/31405239
possible better answer: http://stackoverflow.com/a/20918328
has answer: http://stackoverflow.com/a/21050079
score: 0
has title: minium jars needed to compile JavaEE application which will be deployed on weblogic
tagged with: jakarta-ee
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31405200

http://stackoverflow.com/comment/31452146
comment on: http://stackoverflow.com/a/20942500
type: Comment
score: 0
has text: @DavidWallace When I answered there was no code... at this point I'm not sure what he's tried or not.
type: AnswerComment

http://stackoverflow.com/comment/31379106
has text: @anjalis Your dump seems to show an UTF-8 encoded class file. It should most definitely not look like that. Could you just dump it using `od -tx1 <filename> | head` instead so your editor isn't doing anything weird.
type: Comment
comment on: http://stackoverflow.com/a/20904674
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31541862
type: Comment
comment on: http://stackoverflow.com/a/20984926
score: 1
has text: Thanks, I don't want to grant permissions to all jars in the directory, just a specific one that gets upgraded every so often.
type: AnswerComment

http://stackoverflow.com/comment/31536347
type: Comment
comment on: http://stackoverflow.com/q/20987534
has text: @user3171818 this is outright rude. I think Christian was wanting to help you and asking you for being more specific. And i agree, the question isnt completely clear. well, not that it bothers me. you might get lesser help if you arent clear and concise
score: 0
type: QuestionComment

http://stackoverflow.com/a/20937467
has comment: http://stackoverflow.com/comment/31442044
has body: Make sure that the JPanel is not using GroupLayout. Most any other layout would work well, but likely for the moment, JPanel's default FlowLayout will work best. Be sure to call revalidate() and repaint() on the JPanel after adding a component, if you are adding the component after the GUI has been rendered, such as on a button push. If still having problems, show your code. General advice: avoid using code generation utilities until after you understand the underpinnings of the GUI library, here Swing. You won't regret doing this.
has comment: http://stackoverflow.com/comment/31442153
has comment: http://stackoverflow.com/comment/31442069
type: AcceptedAnswer
type: Answer
score: 8
downvote count: 0
upvote count: 8
accepted answer of: http://stackoverflow.com/q/20937430
answers question: http://stackoverflow.com/q/20937430

http://stackoverflow.com/comment/31577820
type: QuestionComment
has text: If your zip file isn't binary it isn't going to work. Unless you're talking about some text encoding for transfer (which will increase the file size).
score: 0
comment on: http://stackoverflow.com/q/21009888
type: Comment

http://stackoverflow.com/q/20858100
has comment: http://stackoverflow.com/comment/31291243
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/6264057
upvote count: 1
has answer: http://stackoverflow.com/a/20866680
score: 1
has comment: http://stackoverflow.com/comment/31291938
tagged with: java
tagged with: hibernate
tagged with: special-characters
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/20858179
has title: How to pass special characters in HQL?
tagged with: postgresql
has body: I have a query which is working fine using JDBC but when switched to hibernate it throws QueryException for the syntax(name is the column in my table masterTable using PostGreSql Database): String editCodeQuery = "select \"name\" from masterTable"; EXCEPTION: org.hibernate.QueryException: unexpected char: '"' [select "name" from com.lnt.utility.pojo.masterTable Now if i am using the query like this: String editCodeQuery = "select name from masterTable"; OR String editCodeQuery = "Select M.name from masterTable M"; I get an exception as below(Same error i get if i use the query in JDBC also): org.hibernate.util.JDBCExceptionReporter logExceptions SEVERE: ERROR: column masterTable0_.name does not exist Position: 8 I have to pass special characters in HQL.How do i pass?...Please Help
has comment: http://stackoverflow.com/comment/31291270
has comment: http://stackoverflow.com/comment/31291139

http://stackoverflow.com/comment/95741814
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20935315
has text: I am voting to close this question because it is requesting off-site resource.

http://stackoverflow.com/comment/31323478
has text: Why have you used the tag "syntax-error"? If it's a runtime exception, then it must have compiled, which means it can't be a syntax error...
comment on: http://stackoverflow.com/q/20874629
score: 3
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31593066
comment on: http://stackoverflow.com/a/21004067
score: 0
type: AnswerComment
has text: @EricB. `RequestMappingHandlerMapping`
type: Comment

resteasy
tags question: http://stackoverflow.com/q/20861478
tag name: resteasy
tags question: http://stackoverflow.com/q/20960983
type: Tag
tags question: http://stackoverflow.com/q/20892946
tags question: http://stackoverflow.com/q/20969664

http://stackoverflow.com/a/20910861
downvote count: 0
answers question: http://stackoverflow.com/q/20910832
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31391332
has comment: http://stackoverflow.com/comment/31391251
type: Answer
score: 6
upvote count: 6
has body: In regex if you want to match 1 or more any character then use .+ and for 0 or more use .* It is better to go through a good regex tutorial like: http://regular-expressions.info You can use this regex: String regex = "^https?://.+?/#.*$";
accepted answer of: http://stackoverflow.com/q/20910832
has comment: http://stackoverflow.com/comment/31392190
has comment: http://stackoverflow.com/comment/31391323

http://stackoverflow.com/a/21010261
type: Answer
answers question: http://stackoverflow.com/q/21010192
has body: The following will get you their IP address - i know you want their computer name but I'm not sure that's possible. Code is in VB.NET but you can convert to Java using online tools. ''' &lt;summary&gt; ''' Returns the Clients IP address ''' &lt;/summary&gt; ''' &lt;returns&gt; ''' [String] The Clients IP address ''' &lt;/returns&gt; ''' &lt;remarks&gt; ''' http://bytes.com/topic/asp-classic/answers/439176-how-get-clients-ip-address-asp-net ''' &lt;/remarks&gt; Private ReadOnly Property ClientIPAddress() As String Get 'Set default return value ClientIPAddress = "&lt;unable to be determined&gt;" Try Dim strClient_HTTP_X_FORWARDED_FOR As String = Request.ServerVariables("HTTP_X_FORWARDED_FOR") Dim strClient_REMOTE_ADDR As String = Request.ServerVariables("REMOTE_ADDR") 'Check if the XFF header is present If Not String.IsNullOrEmpty(strClient_HTTP_X_FORWARDED_FOR) Then 'Use the first entry in the HTTP_X_FORWARDED_FOR list of IP addresses (comma separated) '- the first entry is the Client IP address, the last entry is the last proxy IP address Dim ipRange As String() = strClient_HTTP_X_FORWARDED_FOR.Split(","c) ClientIPAddress = ipRange(0).Trim Else 'Use the REMOTE_ADDR value ClientIPAddress = strClient_REMOTE_ADDR.Trim End If Catch ex As Exception 'Return default value on exception End Try End Get End Property
has comment: http://stackoverflow.com/comment/31612748
score: 0

http://stackoverflow.com/a/20938839
has comment: http://stackoverflow.com/comment/31495559
answers question: http://stackoverflow.com/q/20933288
upvote count: 1
has comment: http://stackoverflow.com/comment/31471710
type: Answer
has comment: http://stackoverflow.com/comment/31488452
downvote count: 0
has body: Are you loading the XML document into memory once and then searching it many times? In that case, it's not so much the speed of parsing that should be the concern, but rather the speed of searching. But if you are parsing the document once for every search, then it's fast parsing you need. The other factors are the nature of your searches, and the way in which you want to present the results. You ask what is the "best" xml reader in the body of your question, but in the title you ask for the "fastest". It's not always true that the best choice is the fastest. because parsing is a mature technology, different parsing approaches might only differ by a few microseconds in performance. Would you be prepared to have four times as much development effort in return for 5% faster performance?
score: 1

http://stackoverflow.com/comment/31467045
type: Comment
has text: How are u creating the object? cast the object using appropriate class and then convert it to byte array
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20950763

http://stackoverflow.com/q/20921753
downvote count: 0
score: 1
tagged with: refactoring
tagged with: java
has answer: http://stackoverflow.com/a/20921902
has comment: http://stackoverflow.com/comment/31411583
type: Question
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/20921928
has comment: http://stackoverflow.com/comment/31411485
has title: How to refactor the code which uses a map passing everywhere?
favorite count: 0
has body: Now I'm refactoring a legacy Java project, and have some problems now. It defines a class names DataHolder which extends from Map&lt;String,Object&gt;, and as parameters to passing through classes and methods. public class DataHolder extends Map&lt;String,Object&gt; { } public class Cls1 { public void execute(DataHolder data) { data.put("key1", someData); } } public class Cls2 { public void execute(DataHolder data) { Object someData = data.get("key1"); } } ... There are more than 30 classes and 100 methods are using this DataHolder instance, and for most of them, it's the only parameter. When a method generates some values which may need in other methods, it just put them into the data holder. And if it needs some, it just get them from the data holder. The code is hard to read, to test, and even to refactor. I'm trying to refactor it, but don't know how to do it. Is there any good idea?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31411633
tagged with: dictionary
has comment: http://stackoverflow.com/comment/31411577

http://stackoverflow.com/q/20986840
has comment: http://stackoverflow.com/comment/31535085
type: UnansweredQuestion
tagged with: java
has body: I am trying to fill an array of int array's that are parsed from a string array. I have tried this, and know that it's not right, but cant seem to figure out how to get it working. String s[]{34 46 67 34, 95 02 00 34, 70 12 30 23, 01 13 54 91}; private static void gridMaker(String s){ String[] temporaryString; int[] temporaryInt = new int[s.length()]; int[][] grid; String[] splitString = s.substring(0, s.length()- 1).split("\\|"); for(int i = 0; i &lt; splitString.length; i++){ temporaryString = splitString[i].split(" "); for(int n = 0; n &lt; splitString.length; n++){ temporaryInt[n] = Integer.parseInt(temporaryString[n]); } grid[i] = temporaryInt; } } I figured it out. I didn't initialize grid with a length, and since the grid I am trying to create has an equal number of rows and columns, this works. int[][] grid = new int[s.length()][];
has answer: http://stackoverflow.com/a/20986940
type: Question
has comment: http://stackoverflow.com/comment/31535072
has comment: http://stackoverflow.com/comment/31535088
tagged with: arrays
score: 0
answer count: 1
has title: Filling an array of int array's parsed from a string array
has comment: http://stackoverflow.com/comment/31535042

http://stackoverflow.com/q/20954659
type: Question
accepted answer: http://stackoverflow.com/a/20954812
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31474252
linked to: http://stackoverflow.com/q/7718807
answer count: 1
tagged with: jar
downvote count: 0
favorite count: 0
has body: I just started a new game project and I want to create the world by reading a file. In Eclipse everything is just fine and the file is successfully loaded. The images that are used are being loaded as well. But if I compile the project and execute the .jar the images still work but the file could not be found. I loaded the image by using the classpath: ImageIO.read(SpriteSheet.class.getResourceAsStream("...")); and the file by using the path: new File("...") They are both in the same folder and I do not now why this does not work because in Eclipse everything just worked fine but after compiling it does not work anymore.
has answer: http://stackoverflow.com/a/20954812
has title: Classpath File can not be found after compiling
has comment: http://stackoverflow.com/comment/31474197
type: AnsweredQuestion
tagged with: file
upvote count: 1
tagged with: classpath

http://stackoverflow.com/a/20937062
has body: A main problem is that your program structure is off: Team should not contain an ArrayList&lt;Team&gt;. That ArrayList should reside in another class, say the League or TeamList class. You're at risk of running into a StackOverflowException with your current code. Edit You ask: In your suggestion should TeamList / ArrayList class be a subclass of Team? Can you be a litlle more specific about the risks if I keep it as it is now? No, it should definitely not be a sub-class. Think of it logically: a baseball league is not a specialized type of baseball team, is it? Nope, and so your idea to sub-class does not satisfy the "is-a" rule for subclassing. It should be its own class with its own non-static methods and fields.
answers question: http://stackoverflow.com/q/20937048
has comment: http://stackoverflow.com/comment/31442393
score: 2
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/q/20870301
has answer: http://stackoverflow.com/a/20870447
answer count: 3
has title: How to convert json in java?
has comment: http://stackoverflow.com/comment/31314932
has comment: http://stackoverflow.com/comment/31314818
accepted answer: http://stackoverflow.com/a/20870447
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/20870455
type: Question
has body: I have this values in cellHashMap key = name value = {name ={uri=/book/bookItem3(852)/header}} I want to get only the book/bookItem3(852)/header ( without the {uri= and the } in the end _ I did this code : Map&lt;String, Object&gt; cellHashMap = (HashMap&lt;String, Object&gt;) cell.getValue(); String cellValue = cellHashMap.get("name").toString(); //$NON-NLS-1$ String[] splitCell = cellValue.split("uri=/"); //$NON-NLS-1$ return splitCell[1].substring(0, splitCell[1].length() - 1); The result of the split are : splitCell[0] = { splitCell[1] = sbook/bookItem3(852)/header} it is working but I think it is not the best way to do it Do you know on better way?
has answer: http://stackoverflow.com/a/20870889
possible better answer: http://stackoverflow.com/a/20870455
score: 0

http://stackoverflow.com/comment/31320323
type: QuestionComment
has text: Have you tried super.performRegularHomeAction(); ?
comment on: http://stackoverflow.com/q/20873021
score: 0
type: Comment

http://stackoverflow.com/comment/31595562
score: 1
has text: Oh..Nice that.. Its very good.!!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20996587

http://stackoverflow.com/comment/31439930
has text: Don't forget to parse your Strings within a try/catch block! You'll need to catch NumberFormatExceptions & deal with the items in the list that aren't actually numerical values.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/20936543
type: Comment

http://stackoverflow.com/a/20952370
has comment: http://stackoverflow.com/comment/31515669
has comment: http://stackoverflow.com/comment/31470752
upvote count: 23
has comment: http://stackoverflow.com/comment/31469680
has comment: http://stackoverflow.com/comment/31677543
has comment: http://stackoverflow.com/comment/31514078
score: 22
has comment: http://stackoverflow.com/comment/31515163
has comment: http://stackoverflow.com/comment/31677339
has comment: http://stackoverflow.com/comment/31469738
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/31469641
has comment: http://stackoverflow.com/comment/31469651
has comment: http://stackoverflow.com/comment/31513760
has comment: http://stackoverflow.com/comment/31469717
has comment: http://stackoverflow.com/comment/31512856
has comment: http://stackoverflow.com/comment/31470026
has comment: http://stackoverflow.com/comment/31470047
answers question: http://stackoverflow.com/q/20952325
has comment: http://stackoverflow.com/comment/31678037
has comment: http://stackoverflow.com/comment/31470502
has comment: http://stackoverflow.com/comment/31470724
has comment: http://stackoverflow.com/comment/31469711
has comment: http://stackoverflow.com/comment/31470099
has comment: http://stackoverflow.com/comment/31469661
has comment: http://stackoverflow.com/comment/31513846
has comment: http://stackoverflow.com/comment/31474270
has comment: http://stackoverflow.com/comment/31470209
has body: Reaching for semantics On a semantic level, what you are checking for is set membership. However, you implement it on a very low level, basically inlining all the code needed to achieve the check. Apart from forcing the reader to infer the intent behind that massive condition, a prominent issue with such an approach is the large number of degrees of freedom in a general Boolean expression: to be sure the whole thing amounts to just checking set membership, one must carefully inspect each clause, minding any parentheses, misspellings of the repeated variable name, and more. Each loose degree of freedom means exposure to not just one more bug, but to one more class of bugs. An approach which uses an explicit set would have these advantages: clear and explicit semantics; tight constraint on the degrees of freedom to look after; O(1) time complexity vs. O(n) complexity of your code. This is the code needed to implement a set-based idiom: static final Set<String> matches = unmodifiableSet(new HashSet<>(asList("a","b","c"))); ... if (matches.contains(a)) // do something; *I'm implying import static java.util.Arrays.asList and import static java.util.Collections.unmodifiableSet
has comment: http://stackoverflow.com/comment/31515036
has comment: http://stackoverflow.com/comment/31678146
has comment: http://stackoverflow.com/comment/31475265
has comment: http://stackoverflow.com/comment/31470590

http://stackoverflow.com/comment/31404864
type: Comment
has text: First of all did you try using regex?..Any error that you came across while using it?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/20918063

jasmine
tags question: http://stackoverflow.com/q/20878744
tag name: jasmine
type: Tag

http://stackoverflow.com/comment/31480020
has text: ignoring the log means not understanding the problem. Putting things in a txn can change when lifecycle ops take place but all depends on persistence properties and we don't see which are set. There is nothing "wrong" with any solution if you get the answer you want
score: 1
comment on: http://stackoverflow.com/q/20937219
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21013820
has comment: http://stackoverflow.com/comment/31584304
tagged with: arrays
has answer: http://stackoverflow.com/a/21014026
has comment: http://stackoverflow.com/comment/31584773
answer count: 2
has comment: http://stackoverflow.com/comment/31584176
downvote count: 0
favorite count: 0
tagged with: equals
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21015188
score: 2
has title: Shouldn't an object and its clone (correctly done) byte representations be same?
tagged with: java
tagged with: stream
has comment: http://stackoverflow.com/comment/31584307
has body: Shouldn't an Object and its clone (correctly done) byte representations be same? ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject(p); byte[] byteArr1 = bos.toByteArray(); bos = new ByteArrayOutputStream(); oos = new ObjectOutputStream(bos); oos.writeObject(p.clone()); byte[] byteArr2 = bos.toByteArray(); Arrays.equals(byteArr1, byteArr2) == true ? Trying to see if there are any alternatives to not implementing equals method when comparing an object and its clone. Yes sure, these are not the best practices but I am just trying to understand the byte stream representation of a Serializable Object.
type: Question

http://stackoverflow.com/a/20879515
answers question: http://stackoverflow.com/q/20878999
upvote count: 2
score: 2
downvote count: 0
has body: The "object" instance is null. ArrayList&lt;String&gt; list1=new ArrayList&lt;String&gt;(); if(Object!=null){ list1=object.getsomeFiles(); if(list1!=null&amp;&amp;!list1.isEmpty()){ // Your code here } }
type: Answer

http://stackoverflow.com/comment/105342611
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20895806
has text: Refer this link it will be use full for your doubt. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Details_of_the_Object_Model
score: 0

http://stackoverflow.com/q/20959922
tagged with: defaulttablemodel
accepted answer: http://stackoverflow.com/a/20980799
tagged with: indexoutofboundsexception
has title: Swing - invisible column throwing exception when accessing
tagged with: jtable
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/20960624
has body: Background I have a JTable called table, and I have a column that is not part of the DefaultTableModel so its invisible: final JTable table = new JTable(new DefaultTableModel(new Object[]{"Title", "Artist", "Album", "Time"}, 0) I add the respective rows like this: int upTo = songList.size(); int idx = 0; while (idx &lt; upTo) { SongObject curSong = songList.get(idx); model.addRow(new Object[]{ curSong.toString(), curSong.getArtist(), "-", curSong.getDuration(), curSong}); idx++; } Where curSong is the the current song object that it is adding, the SongObject contains all data about the song. The toString() returns the title of the song. Problem: The problem is that when I try to access the column like this: SongObject songToPlay = (SongObject) table.getModel().getValueAt(table.getSelectedRow(), 4); It throws a java.lang.ArrayIndexOutOfBoundsException: 4 &gt;= 4 exception. Can anyone explain why and propose a solution? Thanks in advance :)
possible better answer: http://stackoverflow.com/a/20960624
has answer: http://stackoverflow.com/a/20980799
type: AnsweredQuestion
tagged with: java
tagged with: swing
type: Question

http://stackoverflow.com/q/20892389
has answer: http://stackoverflow.com/a/20892456
score: 0
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31356491
tagged with: drop-down-menu
tagged with: http://stackoverflow.com/tag/html
has body: I am playing around with converting a horizontal drop down to a vertical drop down. The issue is that I have it looking like a drop down but the li's under the first one wont "activate" I cannot even put a hover effect on them. the CSS I have is as follows Should not forget it is a java drop down so I have now added the java code Iv spent a few hours on this and just cant seem to find a solution. Any insight would be greatly appreciated. #menu { position:absolute; display:block; padding: 0 5px 0 5px; width: 225px; height:400px; font-size: 15px; font-size: 15px; font-style: normal; font-weight: lighter; margin:0px; padding-right:10px; text-align: right; text-decoration: none; font-family: "Palatino Linotype","Book Antiqua",Palatino,serif; } #menu { text-transform: uppercase; letter-spacing: -1px; padding:0px; color: #333333; } #menu a { color: #333333; text-decoration: none; } #menu ul { list-style: none; } #menu ul li { position:relative; display:block; padding: 0 20px 0 20px; display: inline-block; width: 225px; list-style: none outside none; } #menu ul li.first { padding-left: 0; } #menu ul li.active { position:relative; display:block; background: #346176 url(images/btn_bg.jpg) top left no-repeat; } #menu .arrow { display: inline-block; margin: 0 0 0 0.5em; position: relative; width: 0; height: 0; top: -3px; border-bottom: 1px solid #E8D3A3; } Java code (function($) { jQuery.fn.dropotron = function(options) { var settings = jQuery.extend({ selectorParent: jQuery(this) }, options); return jQuery.dropotron(settings); } jQuery.dropotron = function(options) { // Settings var settings = jQuery.extend({ selectorParent: null, // The parent jQuery object menuClass: 'dropotron', // Menu class (assigned to every UL) expandMode: 'hover', // Expansion mode ("hover" or "click") hoverDelay: 150, // Hover delay (in ms) hideDelay: 250, // Hide delay (in ms; 0 disables) openerClass: 'opener', // Opener class openerActiveClass: 'active', // Active opener class mode: 'slide', // Men…
has title: Converting horizontal drop down to vertical drop down
has answer: http://stackoverflow.com/a/20892479
type: UnansweredQuestion
tagged with: css

http://stackoverflow.com/a/20993034
answers question: http://stackoverflow.com/q/20989128
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/31559505
has body: Refer the below links for proxy configuration in HTTPClient: Common HTTPclient and proxy Apache HttpClient 4.1 - Proxy Settings

http://stackoverflow.com/q/20915478
has title: Got a task with String operations. matcher.find() throws outOfBoundExc, matcher.find(0) works fine... why is that?
tagged with: matcher
score: 0
answer count: 1
tagged with: string
type: UnansweredQuestion
has body: task is to delete letters i from sentence. public static void main(String[] args) { int index = 8; String letter = "i"; String text = "method appends the string to the end. t is overloaded to have the following forms."; StringBuffer sb = new StringBuffer(text); Pattern pat = Pattern.compile(letter); Matcher mat = pat.matcher(sb); //while (mat.find()) -throws StringIndexOutOfBoundsException. while (mat.find(0)){ sb.deleteCharAt(mat.start()); } System.out.println(sb.toString()); } well, program works, but I dont understand why obvious method doesnt work?
has answer: http://stackoverflow.com/a/20915529
tagged with: java
type: Question

http://stackoverflow.com/comment/31516146
type: AnswerComment
type: Comment
has text: Your approach doesn't work since the class Test doesn't expose this method. A hack-approach would be to do this: final boolean[] methodCalled = new boolean[1]; Test testRef = new Test(taskJob) { public void updateAndReschedule(Long id, String message) { methodCalled[0] = true; } }; /*doStuff...*/ assertTrue(methodCalled[0]);
score: 2
comment on: http://stackoverflow.com/a/20975267

http://stackoverflow.com/comment/31445685
type: Comment
comment on: http://stackoverflow.com/a/20939224
type: AnswerComment
has text: thanks i think i found the answer an suggested above
score: 0

http://stackoverflow.com/comment/31303751
score: 0
comment on: http://stackoverflow.com/q/20864141
type: Comment
type: QuestionComment
has text: Yeah, the exception stack trace will tell you what line you failed on. But it's almost certainly the first `charAt` you do. (Hint: Use `System.out.println` to print values in your program, to see what it's doing.)

http://stackoverflow.com/comment/31409287
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20919857
score: 0
has text: I have not created that folder and it only contains my game icon. These resources aren't in any of the other fragmentation folders either.

http://stackoverflow.com/comment/31519494
has text: it is just debugging basic java code. I create Hello World example and I got same problem!
comment on: http://stackoverflow.com/q/20978614
score: 0
type: Comment
type: QuestionComment

getparameter
tag name: getparameter
type: Tag
tags question: http://stackoverflow.com/q/20989523

http://stackoverflow.com/comment/31491290
type: QuestionComment
has text: Do you have to do it this way? Maybe see this question: http://stackoverflow.com/questions/832620/stripping-html-tags-in-java
score: 0
comment on: http://stackoverflow.com/q/20963220
type: Comment

http://stackoverflow.com/comment/31301209
score: 1
type: Comment
has text: `g = (Graphics2D) image.getGraphics();` Aaaaaargh! Whatever resource you are using to learn Java, lose it. It is rubbish. Instead go to [Performing Custom Painting](http://docs.oracle.com/javase/tutorial/uiswing/painting/).. For Swing, typically use key bindings over the AWT based, lower level, `KeyListener`. See [How to Use Key Bindings](http://docs.oracle.com/javase/tutorial/uiswing/misc/keybinding.html) for details on how to use them. Also, try actually **reading** the group. These types of things come up 2-3 times a day!
type: QuestionComment
comment on: http://stackoverflow.com/q/20862919

http://stackoverflow.com/comment/31537193
comment on: http://stackoverflow.com/q/20987910
type: Comment
has text: @SotiriosDelimanolis but that you can't determine until you are not using some overridden methods. This questions was asking (My assumption) the type of reference variable that he can get using **instanceof** operator. :)
score: 0
type: QuestionComment

math
tags question: http://stackoverflow.com/q/20963975
tags question: http://stackoverflow.com/q/21009207
tags question: http://stackoverflow.com/q/21012776
type: Tag
tags question: http://stackoverflow.com/q/20888975
tags question: http://stackoverflow.com/q/20952076
tags question: http://stackoverflow.com/q/20864153
tags question: http://stackoverflow.com/q/20951640
tags question: http://stackoverflow.com/q/20920803
tags question: http://stackoverflow.com/q/20959989
tags question: http://stackoverflow.com/q/20957749
tags question: http://stackoverflow.com/q/20879124
tags question: http://stackoverflow.com/q/20999769
tags question: http://stackoverflow.com/q/21010586
tags question: http://stackoverflow.com/q/20960683
tags question: http://stackoverflow.com/q/20935999
tags question: http://stackoverflow.com/q/20925656
tag name: math
tags question: http://stackoverflow.com/q/20929913
tags question: http://stackoverflow.com/q/20873435

http://stackoverflow.com/a/20972620
score: 1
has body: Liskov substitution principle Substitutability is a principle in object-oriented programming. It states that, in a computer program, if S is a subtype of T, then objects of type T may be replaced with objects of type S (i.e., objects of type S may be substituted for objects of type T. So you can pass B as A to the method where A is expecting and the match found. static void sifter(A[]... a2)
upvote count: 1
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/20972530

http://stackoverflow.com/comment/31572968
comment on: http://stackoverflow.com/a/20982888
score: 0
type: AnswerComment
has text: @MadProgrammer agree, `TableModelListener` is cleaner, edited :)
type: Comment

http://stackoverflow.com/comment/31434430
comment on: http://stackoverflow.com/q/20928901
type: Comment
type: QuestionComment
has text: can you post the table definitions, did you generate the model using Hibernate tools?
score: 0

http://stackoverflow.com/comment/31502441
type: Comment
comment on: http://stackoverflow.com/a/20968124
type: AnswerComment
has text: By the way can you explain those lines of codes to me? thanks
score: 0

http://stackoverflow.com/comment/31512512
type: Comment
comment on: http://stackoverflow.com/q/20974960
has text: Have you read [this answer](http://stackoverflow.com/a/18146713/2970947)?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/31514116
has text: I see - the fetch joins are not enough since you access the collections in several places. Please see the edit.
type: Comment
comment on: http://stackoverflow.com/a/20975297
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31546936
comment on: http://stackoverflow.com/a/20993131
type: AnswerComment
has text: You might then consider marking this answer as correct, so no new answers are required.
score: 0
type: Comment

http://stackoverflow.com/a/20952832
answers question: http://stackoverflow.com/q/20949392
has comment: http://stackoverflow.com/comment/31491135
has comment: http://stackoverflow.com/comment/31490338
has body: You need to set up a debug configuration that will work for this. Originally this application won't start without user interaction. If you go to the debug drop-down and say configure you can have it auto start an activity of your choice. So at the top pick the project then when it asks what to do say auto launch activity with the drop-down box next to it. Use the drop-down to select the activity you want to auto-start. Then try debugging the application and it should push and start automatically on your glass.
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/31472673
has comment: http://stackoverflow.com/comment/31473164
downvote count: 0
type: AcceptedAnswer
score: 4
accepted answer of: http://stackoverflow.com/q/20949392
has comment: http://stackoverflow.com/comment/31471854

http://stackoverflow.com/q/20870266
answer count: 3
has title: Unreachable Code - Shouldn't be unreachable
tagged with: android
has answer: http://stackoverflow.com/a/20870282
accepted answer: http://stackoverflow.com/a/20870294
tagged with: loops
has body: I want to populate a custom listview, with data read from a file. The file is read using method ReadPeopleDetails. This returns an arraylist, which I then, using a loop, take the name string and put it into arraylist people_name. However apparently the final ArrayAdapter adapter line is unreachable, presumably because of the for loop. Could a second pair of eyes tell me why this is? I would think the for loop will end (length specified by length of arraylist) Code: public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.add_party__people_list, menu); ArrayList&lt;PeopleDetails&gt; people_list = Readpeopledetails(); ArrayList&lt;String&gt; people_name = null; ///this will catch the names from the above line, and put them into ///an arraylist for use in populating the ListView int i = people_list.size(); //int j; acts as counter in iterator system PeopleDetails[] people_array = (PeopleDetails[]) people_list.toArray(); for(int j = people_list.size(); /*not using termination*/ ; j++ ){ people_name.add(people_array[j].name); } final ArrayAdapter adapter = new ArrayAdapter(this, R.layout.person_list_item, people_name); return true; }
has comment: http://stackoverflow.com/comment/31314719
has answer: http://stackoverflow.com/a/20870294
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20870399
possible better answer: http://stackoverflow.com/a/20870282
tagged with: eclipse
type: Question
score: 0
has comment: http://stackoverflow.com/comment/31314722
tagged with: arraylist

http://stackoverflow.com/comment/31525926
score: 0
type: AnswerComment
has text: `List<? extends Parent> list = new ArrayList<ChildA>();` works, but `List<Parent> list = new ArrayList<ChildA>();` doesn't. The OP doesn't show the entire `ListClas` class so it wasn't clear what type `this.list` is. Judging from the type of the `ListClas` constructor parameter `list` in the OP I assumed that the type of `this.list` was also `List<Parent>`
type: Comment
comment on: http://stackoverflow.com/a/20981459

http://stackoverflow.com/comment/31601833
has text: Can I run my application with embedded Jetty as it is without exporting .war ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21010201
type: Comment

http://stackoverflow.com/comment/31460247
has text: And then else and put my calculations
comment on: http://stackoverflow.com/a/20947491
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31456418
score: 0
comment on: http://stackoverflow.com/a/20945026
type: AnswerComment
type: Comment
has text: look the answer that u gave me super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); myTexture = new TextureView(this); myTexture.setSurfaceTextureListener(this); setContentView(myTexture);

http://stackoverflow.com/q/21017763
has answer: http://stackoverflow.com/a/32036084
type: Question
possible better answer: http://stackoverflow.com/a/32036084
has answer: http://stackoverflow.com/a/21017863
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21017877
answer count: 5
tagged with: android
upvote count: 1
has answer: http://stackoverflow.com/a/21017854
has title: index of array decrementing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21017883
accepted answer: http://stackoverflow.com/a/21017854
tagged with: java
has body: So i'm stuck with this problem for a couple of hours. i have basically an array of textviews and want to swipe between them. the array i have is from 0 to 19. The fact is that incrementing works perfect, but when i decrement at value of [0] the index goes to [-1] so it crashes. I need to do something in order that when i get to index[0] and decrement the index to jump back to [19]. here is the code and my try with if else. Thanks a lot!!! mPreviousButton = (Button) findViewById(R.id.prev_btn); mPreviousButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mCurrentIndex = (mCurrentIndex - 1) % mShowTipsTextBank.length; if (mCurrentIndex &lt; 19) { mCurrentIndex = 19; updateQuestion(); } else updateQuestion(); } });

http://stackoverflow.com/q/20919903
has body: I'm making a program that determines the frequency of occurrence of each letter from a series of words using arrays. It will output the average occurrence of each letter per word and that is my problem. Input: The quick brown fox jumps over{enter} the lazy dog{enter} 1{enter} //1 terminates the program and shows the output Output: a: 0.11 b: 0.11 c: 0.11 d: 0.11 e: 0.33 f: 0.11 g: 0.11 h: 0.22 i: 0.11 j: 0.11 k: 0.11 l: 0.11 m: 0.11 n: 0.11 o: 0.44 p: 0.11 q: 0.11 r: 0.22 s: 0.11 t: 0.22 u: 0.22 v: 0.11 w: 0.11 x: 0.11 y: 0.11 z: 0.11 This is my code so far: public static void main( String[] args ) { Scanner scn=new Scanner(System.in); int y=0; int[] alArray = new int[26]; while(y==0) { String in = scn.next().toLowerCase(); for (int x=0; x&lt;in.length(); x++) { char chr=in.charAt(x); int val=(int) chr; if (val&gt;=97 &amp;&amp; val&lt;=122) { alArray[chr-'a']++; } } for (int x=0; x&lt;alArray.length; x++) { if(alArray[x]&gt;0) { char chr = (char) (x+97); System.out.println(chr+": "+alArray[x]); } } } } I/O Input: Hello World Output: e: 1 h: 1 l: 2 o: 1 d: 1 e: 1 h: 1 l: 3 o: 2 r: 1 w: 1
has comment: http://stackoverflow.com/comment/31408211
tagged with: arrays
answer count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31408097
upvote count: 0
has comment: http://stackoverflow.com/comment/31408092
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/31408156
type: Question
has comment: http://stackoverflow.com/comment/31408185
has title: Determining the average occurrence of each letter per word
has answer: http://stackoverflow.com/a/20920084
score: -1

http://stackoverflow.com/comment/31422158
score: 0
type: Comment
type: QuestionComment
has text: @jhadesdev I have Servlet to upload, not primefaces upload widget [link](http://stackoverflow.com/questions/10093740/android-upload-a-file-in-the-tomcat-server). I will also upload file like mp3 or 3gp, should I save it to database?
comment on: http://stackoverflow.com/q/20926983

http://stackoverflow.com/q/20995852
answer count: 1
downvote count: 0
tagged with: arff
favorite count: 0
tagged with: nullpointerexception
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/36032390
score: 2
has title: jAudio Feature Extractor : Null Exception
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/57566985
type: Question
tagged with: feature-extraction
tagged with: eclipse
has body: My project is to create an Android app that can perform feature extraction and classification of audio files. So first, I'm creating a Java application as a test run. I'm attempting to use jAudio's feature extractor package to extract audio features from an audio file. As a starter, I want to input a .wav file and run the feature extraction operation upon that file, and then store the results as an .ARFF file. However, I'm getting the below NullPointer Exception error from a package within the project: Exception in thread "main" java.lang.NullPointerException at java.io.DataOutputStream.writeBytes(Unknown Source) at jAudioFeatureExtractor.jAudioTools.FeatureProcessor.writeValuesARFFHeader(FeatureProcessor.java:853) at jAudioFeatureExtractor.jAudioTools.FeatureProcessor.<init>(FeatureProcessor.java:258) at jAudioFeatureExtractor.DataModel.extract(DataModel.java:308) at Mfccarffwriter.main(Mfccarffwriter.java:70) Initially I thought it was a file permission issue(i.e, the program was not being allowed to write a file because of lack of permissions), but even after granting every kind of permission to Eclipse 4.2.2(I'm running Windows 7, 64 bit version), I'm still getting the NullException bug. The package code where the offending exception originates from is given below: /** * Write headers for an ARFF file. If saving for overall features, this must * be postponed until the overall features have been calculated. If this a * perWindow arff file, then all the feature headers can be extracted now * and no hacks are needed. * * NOTE: This procedure breaks if a feature to be saved has a * variable number of dimensions * * @throws Exception */ private void writeValuesARFFHeader() throws Exception { String sep = System.getProperty("line.separator"); String feature_value_header = "@relation jAudio" + sep; values_writer.writeBytes(feature_value_header); // exception here if (save_features_for_each_window && !save_overall_recording_features) { for (int i = 0; i < feature_extrac…

http://stackoverflow.com/q/20850973
has title: Upload image and Save inside Web Content Folder in JSP and Save Image Path in Database
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31292380
favorite count: 0
tagged with: image-uploading
has comment: http://stackoverflow.com/comment/31278130
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31278274
linked to: http://stackoverflow.com/q/18664579
tagged with: java
duplicate of: http://stackoverflow.com/q/18664579
has answer: http://stackoverflow.com/a/20851514
type: Question
upvote count: 4
has body: My goal is to upload an image and save inside images folder to Web Content Folder. {Please see the image below} and save the image path into database {Please see the image below} I encountered some problem at this link I tried to do but I did not managed to save the image to images/users folder. And I realize that the save path is store at my C DRIVE. What if I change my computer? Will the image will be there? Below are my codes. Help will be appreciate.. Thanks! :) In jsp &lt;input type="file" name="file"&gt; In servlet public class AServlet extends HttpServlet { private static final long serialVersionUID = 1L; private static final String SAVE_DIR = "WebContent\\images\\users"; ......... protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // gets absolute path of the web application String appPath = request.getServletContext().getRealPath(""); // constructs path of the directory to save uploaded file String savePath = appPath + File.separator + SAVE_DIR; // creates the save directory if it does not exists File fileSaveDir = new File(savePath); if (!fileSaveDir.exists()) { fileSaveDir.mkdir(); } for (Part part : request.getParts()) { String fileName = extractFileName(part); part.write(savePath + File.separator + fileName); } System.out.println(savePath); } private String extractFileName(Part part) { String contentDisp = part.getHeader("content-disposition"); String[] items = contentDisp.split(";"); for (String s : items) { if (s.trim().startsWith("filename")) { return s.substring(s.indexOf("=") + 2, s.length()-1); } } return ""; }
tagged with: database
tagged with: jsp
has comment: http://stackoverflow.com/comment/31278342
tagged with: web-content
score: 4

http://stackoverflow.com/q/20993160
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/31546144
has comment: http://stackoverflow.com/comment/31546166
score: 0
has body: I have a plugin project where I want to implement some servlets with jetyy. I have a login.html with this structure: LOGIN.HTML LOGIN User: Password: After I submit the form, I want to call a servlet to do some actions... This is the servlet: import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet("/receptor") public class HelloServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { } protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { System.out.println("TEST"); } } But I can't call it, I always have the 404 not found error, what's the right thing to write on the action of the form ? PS: I've tried to create the WEB-INF structure and the web.xml, but I always got bad configuration error of this web.xml .. Is it possible to call the servlet without web.xml ?
tagged with: http://stackoverflow.com/tag/html
linked to: http://stackoverflow.com/q/19786142
has comment: http://stackoverflow.com/comment/31545822
has comment: http://stackoverflow.com/comment/31545930
answer count: 0
type: UnansweredQuestion
tagged with: jetty
has title: Jetty on a non web project
has comment: http://stackoverflow.com/comment/31546341
tagged with: java
has comment: http://stackoverflow.com/comment/31546478

http://stackoverflow.com/a/24799981
type: Answer
accepted answer of: http://stackoverflow.com/q/20920693
downvote count: 0
has body: C:\Program Files\Java\jdk1.7.0_60\bin This is where my jdk is, works for my system: Go to My computer >> right click and select properties. On the properties tab select Advanced system settings (Windows 7) Click enviroment variables select path and click edit option add ";C:\Program Files\Java\jdk1.7.0_60\bin" at the end. Done.
score: 26
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38492770
upvote count: 26
answers question: http://stackoverflow.com/q/20920693

http://stackoverflow.com/comment/31442590
type: AnswerComment
type: Comment
has text: @user3071135, please follow the disciplines of stackoverflow by upvote it
comment on: http://stackoverflow.com/a/20937686
score: 0

http://stackoverflow.com/a/20971760
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20971659
has body: Found answer to my query, thanks to comment by Chrylis. Window -> Preferences -> Java -> Debug Uncheck Suspend execution on uncaught exceptions.
answers question: http://stackoverflow.com/q/20971659
type: Answer
upvote count: 3
score: 3
type: AcceptedAnswer

http://stackoverflow.com/a/20896819
has comment: http://stackoverflow.com/comment/31364826
has comment: http://stackoverflow.com/comment/31364970
score: 1
upvote count: 1
has body: how to convert from String to BigDecimal The BigDecimal(java.lang.String) constructor takes String argument. Translates the string representation of a BigDecimal into a BigDecimal. The string representation consists of an optional sign, '+' ( '\u002B') or '-' ('\u002D'), followed by a sequence of zero or more decimal digits ("the integer"), optionally followed by a fraction, optionally followed by an exponent. For example, String distinctBnumberRatioStr = "124.20"; BigDecimal distinctBnumberRatio = new BigDecimal(str); Update Answer to you comment String in JSP to BigDecimal in ActionClass From docs TypeConversion-BuiltinTypeConversionSupport Type Conversion is implemented by XWork. XWork will automatically handle the most common type conversion for you. This includes support for converting to and from Strings for each of the following: String boolean / Boolean char / Character int / Integer, float / Float, long / Long, double / Double dates - uses the SHORT format for the Locale associated with the current request arrays - assuming the individual strings can be coverted to the individual items collections - if not object type can be determined, it is assumed to be a String and a new ArrayList is created Enumerations BigDecimal and BigInteger Note that with arrays the type conversion will defer to the type of the array elements and try to convert each item individually. As with any other type conversion, if the conversion can't be performed the standard type conversion error reporting is used to indicate a problem occured while processing the type conversion.
has comment: http://stackoverflow.com/comment/31364881
downvote count: 0
answers question: http://stackoverflow.com/q/20896322
type: Answer

http://stackoverflow.com/q/20984405
answer count: 2
has body: I'm running into a very frustrating error on what was supposed to be a very simple script (I know java may not be the best for scripting, but here I am). Anyway, I'm pulling names of printers from a csv file, and then I'm trying to create a folder named for each printer that I pulled from that csv file. The issue is that I can only write a directory for the printer if I type it in like this: (new File("c:\\print\\printername").mkdir() but if I do this: String whatever = "c:\\print\\printername" (new File(whatever)).mkdir() no directory will be created. I'm baffled at what the problem might be. I've restructured my code a few times to try and track down the issue, and tried things like switching between mkdir() and mkdirs(), but still nothing. Here's my code public static void main(String[] args) throws FileNotFoundException{ Scanner printers = new Scanner(new File("C:/Users/ransom/Desktop/printers.csv")); printers.useDelimiter("\n"); String printerPath = ""; //new File("C:\\printer\\ISS114-Xerox4150PS").mkdir(); while(printers.hasNext()){ printerPath = "C:\\printer\\"+printers.next(); if(!(new File(printerPath)).mkdir()){ System.out.println(printerPath); } } } The line that is commented out is an example of when the script works, but if it gets to that line in the loop it doesn't create a directory. Any ideas?
has answer: http://stackoverflow.com/a/20984602
upvote count: 1
has answer: http://stackoverflow.com/a/20984579
favorite count: 0
tagged with: mkdir
downvote count: 0
type: UnansweredQuestion
has title: Java mkdir() won't write directory for a string object, but does for a string enclosed in quotes
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31530769
tagged with: mkdirs
type: Question

http://stackoverflow.com/q/20888773
has comment: http://stackoverflow.com/comment/31355051
has comment: http://stackoverflow.com/comment/31354845
has comment: http://stackoverflow.com/comment/31355002
has comment: http://stackoverflow.com/comment/31355929
has comment: http://stackoverflow.com/comment/31349195
has body: Platform I am using: Fedora 20; mariadb-5.5.34-2.fc20.x86_64; Eclipse Kepler Service Release from www.eclipse.org I am implementing example See here and I am trying to manage to work the login interface. Actually I am configuring TomEE to use JAAS auth technology. Since I am having some troubles, I would like to solve them with the help of Eclipse debugging mode. To do that, I: setted breakpoint at line number 79 of LoginController.java; started TomEE in debug mode; executed login.xhtml in debug mode too; My problem is that I see nothing in debug mode: no variables, etc. How is it possible? I have been using debugging mode for a long time, but it is my first time in web development. Project archive Click here for a larger Screenshot
linked to: http://stackoverflow.com/q/21017979
has answer: http://stackoverflow.com/a/21017999
accepted answer: http://stackoverflow.com/a/21017999
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31356345
has title: Eclipse: no shown variables in debugging Java EE
tagged with: java
tagged with: eclipse
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/31356126
answer count: 1
tagged with: apache-tomee
tagged with: tomcat
has comment: http://stackoverflow.com/comment/31356072
score: 0

http://stackoverflow.com/q/20912417
tagged with: android
favorite count: 0
tagged with: timeoutexception
has answer: http://stackoverflow.com/a/33384928
has title: MediaPlayer TimeoutException
has answer: http://stackoverflow.com/a/28363055
upvote count: 14
tagged with: java
downvote count: 1
answer count: 4
has answer: http://stackoverflow.com/a/44267452
tagged with: android-mediaplayer
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20912749
score: 13
has body: I have made an Android app and now it's on Google Play. But now someone reported a Crash, and the stacktrace said the following: java.util.concurrent.TimeoutException: android.media.MediaPlayer.finalize() timed out after 10 seconds at android.media.MediaPlayer.native_finalize(Native Method) at android.media.MediaPlayer.finalize(MediaPlayer.java:1960) at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:187) at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:170) at java.lang.Thread.run(Thread.java:856) And there is no sign of some code from one of my packages. I do use the MediaPlayer class. Anyone who can help me out here? Jesse.
type: Question

http://stackoverflow.com/comment/31279778
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20851878
score: 0
has text: Because you're blocking the UI thread with your loop, so it's not going to be updated until after you exit whatever method this is in.

http://stackoverflow.com/comment/31374701
type: QuestionComment
has text: @AurA Doesn't look like a duplicate to me. OP isn't asking about native BFS. Consider "I am able to traverse with BFS".
comment on: http://stackoverflow.com/q/20902223
score: 0
type: Comment

http://stackoverflow.com/comment/31407237
comment on: http://stackoverflow.com/q/20919368
score: 0
type: Comment
type: QuestionComment
has text: this is the right way to do it. Not only this ensures that your way of comparing dice is enforced by who every uses a dice to compare it with another dice but also your way on comparing cannot be changed as long as they use use your Dice superclass based subclass. Ofcourse you need to make the compare method final so that it cannot be oevrridden. Alternately you can look at implementing a comparable but that wont actually enforce anything.

http://stackoverflow.com/q/20860628
tagged with: box2d
has comment: http://stackoverflow.com/comment/31301154
type: Question
tagged with: libgdx
linked to: http://stackoverflow.com/q/20848826
has body: I am developing a bike game, and i am working at my bike. The bike chassis is made using the Physics Body Editor tool. Creating the chassis void createChasis(World world, Sprite sprite) { BodyEditorLoader loader = new BodyEditorLoader( Gdx.files.internal("data/motor/bike")); BodyDef bd = new BodyDef(); bd.position.set(0, 4); bd.type = BodyType.DynamicBody; FixtureDef fd = new FixtureDef(); fd.density = 0.2f; fd.friction = 0.1f; fd.restitution = 0.4f; chassis = world.createBody(bd); loader.attachFixture(chassis, "motor", fd, 2); chassis.setUserData(sprite); } And the constructor of the Motor class public Motor2D(World world) { float width = 2; float height = 1; FixtureDef chassisFixtureDef = new FixtureDef(); chassisFixtureDef.density = 1; chassisFixtureDef.friction = 1; chassisFixtureDef.restitution = 0.1f; FixtureDef wheelFixtureDef = new FixtureDef(); wheelFixtureDef.density = 0.6f; wheelFixtureDef.restitution = 0.1f; wheelFixtureDef.friction = 2f; BodyDef bodyDef = new BodyDef(); bodyDef.type = BodyType.DynamicBody; bodyDef.position.set(0, 5); // chassis Sprite roata, cadru; Texture textura = new Texture(Gdx.files.internal("data/texture.PNG")); cadru = new Sprite(new TextureRegion(textura, 0, 0, 500, 264)); roata = new Sprite(new TextureRegion(textura, 0, 254, 178, 178)); cadru.setOrigin(cadru.getWidth() / 2, cadru.getHeight() / 2); roata.setOrigin(roata.getWidth() / 2, roata.getHeight() / 2); createChasis(world, cadru); // left wheel CircleShape wheelShape = new CircleShape(); wheelShape.setRadius(height / 3.5f); // wheelShape.setPosition(new Vector2(1, 1)); wheelFixtureDef.shape = wheelShape; leftWheel = world.createBody(bodyDef); leftWheel.createFixture(wheelFixtureDef); leftWheel.setUserData(roata); // right wheel // wheelShape.setPosition(new Vector2(2, 1)); rightWheel = world.createBody(bodyDef); rightWheel.createFixture(wheelFixtureDef); rightWheel.setUserData(roata); // left axis // create axes WheelJointDef axisDef = new WheelJointDef(); axisDef.bodyA = …
upvote count: 2
has answer: http://stackoverflow.com/a/20886178
answer count: 2
favorite count: 0
type: UnansweredQuestion
tagged with: physics
has answer: http://stackoverflow.com/a/20864208
has title: Box2D put the wheels in the right position with LIBGDX
score: 2
downvote count: 0
tagged with: java

http://stackoverflow.com/a/20958703
answers question: http://stackoverflow.com/q/20958537
upvote count: 1
type: Answer
has body: The answer is, it depends. It will depend on the complexity of the application and the number of simultaneous queries you want to make to the database. If all your doing is making a single call from time to time, then it's probably not worth effort to have a pool, but keep a single connection available. If, on the other hand, if you are making a number of queries, sometimes simultaneously, it would be of benefit to have event a simple pool. The more complex the problem becomes the more benefit you'll get from having a connection pool This, of course, is a balancing act. You don't want a lot of connections sitting around dosing nothing for a long time if you have help it.
downvote count: 0
has comment: http://stackoverflow.com/comment/31482428
score: 1
has comment: http://stackoverflow.com/comment/31482958

http://stackoverflow.com/comment/31418797
comment on: http://stackoverflow.com/q/20925561
type: Comment
type: QuestionComment
has text: What do you mean by *personal reason*?
score: 1

http://stackoverflow.com/comment/31424486
type: Comment
score: 0
type: AnswerComment
has text: Can you update your answer to say something like your comment? Then I'll award you the answer, since the current answer wasn't quite right for me.
comment on: http://stackoverflow.com/a/20927399

http://stackoverflow.com/a/21004322
downvote count: 0
has comment: http://stackoverflow.com/comment/31598938
has comment: http://stackoverflow.com/comment/31567321
upvote count: 3
answers question: http://stackoverflow.com/q/21003822
type: Answer
has body: You can take a look at guava in particular to the Sets#cartesianProduct i.e. you can do something of this sort: Sets.cartesianProduct(ImmutableList.of( ImmutableSet.of(Sets.newHashSet(pathList1)), ImmutableSet.of(Sets.newHashSet(pathList2)))
has comment: http://stackoverflow.com/comment/31568953
score: 3

http://stackoverflow.com/comment/31538884
type: Comment
type: QuestionComment
has text: try to stop your web server and then run it again
comment on: http://stackoverflow.com/q/20989132
score: 0

http://stackoverflow.com/comment/31581525
has text: of course you can, Y not? please provide error stack!
comment on: http://stackoverflow.com/q/21012161
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20868095
answer count: 1
downvote count: 0
tagged with: jsp
has comment: http://stackoverflow.com/comment/31310720
tagged with: struts2
tagged with: model-driven
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31327453
has body: Using this code: StudentAction.java: public class StudentAction extends ActionSupport implements ModelDriven { private List studentList; Student student; StudentDAO sdo = new StudentDAO(); public String delete() { System.out.println("delete action"); System.out.println(student.getId()); //not setting value of id sdo.delete(student.getId()); return SUCCESS; } @Override public Object getModel() { return student; } //getter and setter } Student.java: public class Student implements java.io.Serializable { private Long id; private String name; private String address; //getter and setter } In JSP: <s:iterator value="studentList" var="ss"> <s:property value="id"/> <s:property value="name"/> <s:property value="address"/> <a href="delete?id= <s:property value="id"/>">delete </s:iterator> When I pass the value of id from JSP to delete action I want to initialize Student's id property. How to do this?
upvote count: 1
has comment: http://stackoverflow.com/comment/31310733
has comment: http://stackoverflow.com/comment/31310615
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31311414
has title: How to set the property value for model object in action class using ModelDriven in Struts 2?
has answer: http://stackoverflow.com/a/20868203
type: Question
has comment: http://stackoverflow.com/comment/31310762
tagged with: ognl

http://stackoverflow.com/a/20913580
has body: This was my original answer: How about Math.floor(x)==x The floor leaves the x unchanged, bit-by-bit if it is a mathematical integer (say the docs), so the equality should hold exactly when there is nothing to round. After some thought, I think using exact comparison may lead to unwanted results. The question is, what the requirements of the OP really are. Is it If it is a mathematical integer, show the number with no digits after the decimal point, if it is not, show 3 digits after the decimal point. Or is it If formatting with three digits results in 000 after the decimal point, show only an integer. The solution shown above and in other answers only works, if (1) is the requirement, because the number 2.000001 would turn out as 2.000, because it is not a mathematical integer. If the Locale is fixed to a default, formatting 1.0 for the endsWith()-pattern can of course be optimized into a fixed string like ".000" or ",000". If (2) is actually requested, my hunch is that there is no way around first formatting the number to a string and only then stripping the zeros, like so: String format(Locale l, double d) { String zeros = String.format(l, "%.3f", 1.0d); String s = String.format(l, "%.3f", d); if (s.endsWith(zeros.substring(1))) { return s.substring(0, s.length()-4); } return s; }
type: Answer
score: 1
answers question: http://stackoverflow.com/q/20913442
upvote count: 2
downvote count: 1

http://stackoverflow.com/a/20982000
has comment: http://stackoverflow.com/comment/31526709
has comment: http://stackoverflow.com/comment/31526902
type: Answer
has comment: http://stackoverflow.com/comment/31526571
answers question: http://stackoverflow.com/q/20981889
upvote count: 2
has comment: http://stackoverflow.com/comment/31527027
score: 2
has comment: http://stackoverflow.com/comment/31526301
has comment: http://stackoverflow.com/comment/31526851
has body: Given your stacktrace the stage object is null when calling spriteCache.getSprite(spriteName); Which means that the Monster you're creating in your main class is receiving a null SpriteCache instance. In your Main class the SpriteCache is never instantiated so its value is null which leads to a NullPointerException. Somewhere you need: SpriteCache sc = new SpriteCache() and use this instance to create your monsters. For example in your Main class you might want to change the attribute SpriteCache to static SpriteCache sc = new SpriteCache(); and return it in the method getSpriteCache which would need to be static too.
has comment: http://stackoverflow.com/comment/31527101
downvote count: 0
has comment: http://stackoverflow.com/comment/31526458

http://stackoverflow.com/a/20881028
downvote count: 0
answers question: http://stackoverflow.com/q/20876695
has comment: http://stackoverflow.com/comment/31362230
type: Answer
upvote count: 10
has comment: http://stackoverflow.com/comment/31362519
has body: This is a good question - but if you know the right trick, the solution is fortunately not complicated: Simply configure Tycho to include the feature which contains all fragments into the test runtime. Create a feature in an eclipse-feature module which includes all the native fragments. Make sure that the platform filters for each plug-in is correct: On the Plug-Ins tab of the feature.xml editor, you need to select the correct os/ws/arch that each fragment applies to. This is some manual effort, but typically can re-use this feature to include your fragments into a p2 repository/update site. Include this feature into the test runtime with the following POM configuration: org.eclipse.tycho target-platform-configuration ${tycho-version} eclipse-feature fragment-containing-feature 0.0.0 A potential pitfall is the <environments> configuration of the eclipse-feature module: You don't need anything special for that module; just have the module inherit the <environments> configuration from the parent POM. Note that the parent POM shall configure all the environments your build supports - and only the fragment modules need to override the global configuration.
score: 10
has comment: http://stackoverflow.com/comment/31507955
accepted answer of: http://stackoverflow.com/q/20876695
type: AcceptedAnswer

http://stackoverflow.com/comment/31433676
comment on: http://stackoverflow.com/a/20933141
type: AnswerComment
has text: where to locate the red5 manifest file i searched whole of my red5 and i didnt find any file with the name manifest .
score: 0
type: Comment

http://stackoverflow.com/comment/31547590
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20993672
type: Comment
has text: At this line "return new TSPSolution(start, (TSPPoint[]) pts.toArray());" I receive the message "java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Lits.aslogic.vrptw.TSPPoint;"

http://stackoverflow.com/comment/31431504
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/20931939
has text: Ahmed, you sir, are my HERO. Thanks so much for this, its working right now perfectly, and I can't thank you enough!

http://stackoverflow.com/a/20976362
has comment: http://stackoverflow.com/comment/31547470
score: -1
downvote count: 1
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/20971439
has body: You can keep just one activity with list view and different adapters for different type of data. Create one AsyncTask to get the data from server and set appropriate adapter to the ListView. You can also create one base activity that all other activities extend and put your common code there.

http://stackoverflow.com/comment/31384720
has text: @peter.petrov This is a java question, not a C# question.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/20907735
type: AnswerComment

http://stackoverflow.com/q/20900854
favorite count: 0
has comment: http://stackoverflow.com/comment/31372041
tagged with: selenium-webdriver
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31371704
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/20901244
has comment: http://stackoverflow.com/comment/31371948
has title: How to select the anchor tag which is inside the li in Selenium WebDriver?
possible better answer: http://stackoverflow.com/a/20901244
upvote count: 1
has body: Below is my code. I want to click the anchor tag , which is inside the . I have tried to get the value using By.tagName("//li/a"). I didn't get any data. There are many lists with class="dropdown-menu" in my HTML. I should be able to select a single list from which to click the drop down values. 1 2 3 4 5 6 7 8 9 10
has comment: http://stackoverflow.com/comment/31371712
has answer: http://stackoverflow.com/a/20901554
accepted answer: http://stackoverflow.com/a/20901554

session
tags question: http://stackoverflow.com/q/20857020
tags question: http://stackoverflow.com/q/20947495
tags question: http://stackoverflow.com/q/20978066
tags question: http://stackoverflow.com/q/21011881
tags question: http://stackoverflow.com/q/20938075
type: Tag
tags question: http://stackoverflow.com/q/21002233
tags question: http://stackoverflow.com/q/20974294
tags question: http://stackoverflow.com/q/20935554
tags question: http://stackoverflow.com/q/20899070
tags question: http://stackoverflow.com/q/20887587
tag name: session

image-uploading
tags question: http://stackoverflow.com/q/21011143
tags question: http://stackoverflow.com/q/20850973
tag name: image-uploading
type: Tag

http://stackoverflow.com/comment/31444763
type: QuestionComment
comment on: http://stackoverflow.com/q/20938874
score: 4
has text: Can you please post what you have tried?
type: Comment

http://stackoverflow.com/comment/31367734
type: QuestionComment
comment on: http://stackoverflow.com/q/20898675
has text: There is no such constructor, code won't compile, also there is a bug in add() method call, BigDecimal are immutable
score: 1
type: Comment

http://stackoverflow.com/a/42049966
upvote count: 1
has body: Thanks to A2A.. When you pass a duplicate element in the add method of set object, It'll return false and doesn't add it to the set as the element is already present. Set&lt;Object&gt; set = new HashSet&lt;Object&gt;(); set.add("test"); set.add("test"); If you look at the implementation of HashSet then it looks like following. public HashSet() { map = new HashMap&lt;&gt;(); } Means HashSet internally creates an object of HashMap. public boolean add(E e) { return map.put(e, PRESENT)==null; } If you look at the add method parameter e, then your passed value (test) will be consider as a key in the map and the PRESENT is the dummy object passed as a value. HashMap put method returns the following 1. null, if the key is unique and added to the map 2. Old value of the key, if key is duplicate So, when you are adding test element for the first time, HashMap will add the element and return null after that your add method of set will return true. If you add the test element for 2nd time then your HashMap will return Old Value of the Key then in add method of your set will return false as OldValue != null Hope it'll be helpful..!!
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20870879

http://stackoverflow.com/comment/31405859
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20918622
type: Comment
has text: There are more rules then just year% 4 ==0 check them all out here http://en.wikipedia.org/wiki/Leap_year#Algorithm . basically if it's devisable by 4 but not 100 unless it's also decidable by 400 then it's a leap year.

http://stackoverflow.com/q/20851784
has answer: http://stackoverflow.com/a/20851845
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/7713274
accepted answer: http://stackoverflow.com/a/20851903
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31279640
has answer: http://stackoverflow.com/a/20851844
has title: Immutability of maps and lists
has answer: http://stackoverflow.com/a/20851965
has body: I have created an object which has a getter that returns a map. When ever I call getter and change the map from a calling object, why does it effect the original map. Even if it is declared as final. Why does this happen. 1>Is it because instead of returning a map object does the getter returns only object reference? 2>Does this happens to lists too? Below code just for example not perfect code. public class Worker{ private final Map&lt;String, String&gt; work; public MatcherManager(Map&lt;String, String&gt; input) { checkNotNull(input, "Input map not found"); his.workExperienceMatcher = input; } public Map&lt;String, String&gt; getWork() { return work; }
tagged with: generics
has answer: http://stackoverflow.com/a/20851925
favorite count: 0
has answer: http://stackoverflow.com/a/20851903
answer count: 5
linked to: http://stackoverflow.com/q/10339930
linked to: http://stackoverflow.com/q/7996499
tagged with: dictionary
has comment: http://stackoverflow.com/comment/31279553
type: AnsweredQuestion
tagged with: immutability
possible better answer: http://stackoverflow.com/a/20851845
tagged with: list
duplicate of: http://stackoverflow.com/q/7996499
upvote count: 2

http://stackoverflow.com/comment/31545523
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/20993033
has text: @San post adapter code

http://stackoverflow.com/comment/31549614
type: QuestionComment
comment on: http://stackoverflow.com/q/20995036
has text: Java Memory Model - I'll answer... oops, too late: @assylias has done it for me.
score: 0
type: Comment

http://stackoverflow.com/comment/31400543
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20915529
has text: I have provided the reasoning behind why find(0) works and why find() does not.
type: Comment

http://stackoverflow.com/a/21002185
answers question: http://stackoverflow.com/q/21001961
score: 1
upvote count: 1
has body: Try overriding the default ErrorHandler on DocumentBuilder http://docs.oracle.com/javase/6/docs/api/javax/xml/parsers/DocumentBuilder.html#setErrorHandler%28org.xml.sax.ErrorHandler%29 Another option since DOM as part of JAXP is a set of standard APIs, you can always try specifying an alternate implementation of the DOM parser that has the behaviour you are looking for.
downvote count: 0
type: Answer

http://stackoverflow.com/q/20911277
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31392095
tagged with: deque
type: UnansweredQuestion
has title: what is wrong with this deque implementation
score: 3
has answer: http://stackoverflow.com/a/20911351
has comment: http://stackoverflow.com/comment/31392112
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/31392057
type: Question
has body: I want to write implementation of Deque I have written code below but unfortunately I have a problem with it when I use addFirst and addLast or even removeFirst every thing is ok but when I use removelast the programs throws NullPointerException I dont know what is the problem exactly so I got really confused Can Anyone plaese Help me?? Thanks in advance for your attention Node Class:: public class Node&lt;E&gt;{ E element; Node&lt;E&gt; prev , next; public Node(E element, Node&lt;E&gt; prev, Node&lt;E&gt; next) { this.element = element; this.prev = prev; this.next = next; } public Node() { this(null, null, null); } public void setNext(Node next) { this.next = next; } public void setPrev(Node prev) { this.prev = prev; } public Node getNext() { return next; } public Node getPrev() { return prev; } } here is Deque Interface:: public interface DQ&lt;E&gt; { public int size(); public boolean isEmpty(); public E getFirst(); public E getLast(); public void addFirst (E element); public void addLast (E element); public E removeFirst(); public E removeLast(); } and finally here is MyDQ Class which implements DQ class:: public class MyDQ&lt;E&gt; implements DQ&lt;E&gt;{ Node&lt;E&gt; head , tail; int size = 0; @Override public int size() { return size; } @Override public boolean isEmpty() { return size == 0; } @Override public E getFirst() { if(head == null) return null; return head.element; } @Override public E getLast() { if(head == null) return null; return tail.element; } @Override public void addFirst(E element) { Node&lt;E&gt; n = new Node&lt;&gt;(element, null, null); if(head == null) head = tail = n; else { head.setPrev(n); n.setNext(head); head = n; } size++; } @Override public void addLast(E element) { Node&lt;E&gt; n = new Node&lt;&gt;(element, null, null); if(head == null) head = tail = n; else { tail.setNext(n); n.setPrev(head); tail = n; } size++; } @Override public E removeFirst() { if(head == null) return null; Node&lt;E&gt; n = head; head = head.getNext(); he…

http://stackoverflow.com/comment/31323477
type: Comment
type: QuestionComment
score: 3
has text: Can you include the stack trace?
comment on: http://stackoverflow.com/q/20874629

http://stackoverflow.com/comment/31369191
comment on: http://stackoverflow.com/q/20899532
score: 0
type: Comment
type: QuestionComment
has text: for better help sooner post an [SSCCE](http://sscce.org/)

http://stackoverflow.com/comment/31569280
score: 1
comment on: http://stackoverflow.com/q/21005625
has text: Also, just a style recommendation: please don't user lower-case names for classes. Good habits now, less frustration with coworkers later ;)
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20905221
score: 0
has comment: http://stackoverflow.com/comment/31380656
has comment: http://stackoverflow.com/comment/31382338
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: javascript
type: UnansweredQuestion
answer count: 0
tagged with: jquery
has title: Create JSON on web server, Parse using jQuery
has body: The following java code generates a simple JSON. Email rem = new Reminder("gidutz", Calendar.getInstance(), duedate, "someOne", "title the title", "data", "sender"); JSONObject email = new JSONObject(); email.put("id", rem.getId()); email.put("title", rem.getTitle()); email.put("creattion_date", creation); email.put("due_date", creation); email.put("creattion_date", due); try { ServerSocket sc = new ServerSocket(8082); while (true) { Socket client = sc.accept(); PrintWriter out = new PrintWriter(client.getOutputStream()); out.print("HTTP/1.1 200 OK" + CRLF); out.print("Content-type: application/json" + CRLF); out.print(CRLF); out.print(email.toString()); out.print(CRLF); out.flush(); client.close(); } } catch (IOException e) { e.printStackTrace(); } When I access via browser localhost:8082 the following JSON shows: {"id":513097,"title":"title the title","due_date":"2014-01-03-15-01","creattion_date":"2014-01-04-15-01"} The following html page should parse the JSON However, no alert is showing. any idea what is wrong?
type: Question
has comment: http://stackoverflow.com/comment/31380065

http://stackoverflow.com/a/20965329
has comment: http://stackoverflow.com/comment/31494593
downvote count: 0
has comment: http://stackoverflow.com/comment/31609185
has comment: http://stackoverflow.com/comment/31494835
answers question: http://stackoverflow.com/q/20965229
type: Answer
has comment: http://stackoverflow.com/comment/31609517
has comment: http://stackoverflow.com/comment/31609378
has comment: http://stackoverflow.com/comment/31494615
has comment: http://stackoverflow.com/comment/31494643
upvote count: 1
score: 1
has body: You can use org.codehaus.jettison.json.JSONArray for the same (Download jar). Example Code : JSONObject json = new JSONObject(result_string); JSONArray rows = json .getJSONArray("rows"); Creating distance matrix for TCP problem : You can use the following code : JSONObject json1 = new JSONObject(json); String places[] ={"Paris" , "Toulon" , "Nantes" , "Marseille" }; String[][] result=new String[places.length][places.length]; JSONArray rows = json1.getJSONArray("rows"); //JSONObject[] elements=new JSONObject[places.length]; for (int i = 0; i &lt; rows.length(); i++) { JSONObject obj=rows.getJSONObject(i); JSONArray elements=obj.getJSONArray("elements"); for (int j = 0; j &lt; elements.length(); j++) { JSONObject elem=elements.getJSONObject(j); JSONObject distance = elem.getJSONObject("distance"); result[i][j]=distance.getString("value"); } } for (int i = 0; i &lt; result.length; i++) { String row[]=result[i]; for (int j = 0; j &lt; row.length; j++) { System.out.print(" " +row[j] + " , "); } System.out.println(); } Like this you can get values of json string .

http://stackoverflow.com/q/20857460
has comment: http://stackoverflow.com/comment/31289805
has answer: http://stackoverflow.com/a/20857518
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31289862
has title: Get total value from list of textview
linked to: http://stackoverflow.com/q/4203506
has answer: http://stackoverflow.com/a/20857804
type: UnansweredQuestion
tagged with: android
tagged with: java
has body: I want to get total of amount in a textview as shown below. // List of Amount for(t=0;t&lt;pname.length;t++) { newRow = (TableRow) new TableRow(this); float val1= Float.parseFloat(price); float val2= Float.parseFloat(rate); String resultamount = Float.toString(val2- val1); Double value1 = Double.parseDouble(resultamount); ilist[a]=(TextView) new TextView(this); ilist[a].setText(String.format("%.2f", value1)); } I have created another tablerow outside of for loop to get the total value. I am now confused how to get the total from the list. I tried but I am getting the last value of the list as total.
type: Question

http://stackoverflow.com/q/20891666
answer count: 2
has answer: http://stackoverflow.com/a/21767017
linked to: http://stackoverflow.com/q/8288405
score: 0
has answer: http://stackoverflow.com/a/20892473
tagged with: android
has title: Google Analytics Android error java.lang.NullPointerException
has comment: http://stackoverflow.com/comment/31356575
possible better answer: http://stackoverflow.com/a/20892473
has comment: http://stackoverflow.com/comment/31356295
has comment: http://stackoverflow.com/comment/31356347
tagged with: google-analytics
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31356120
accepted answer: http://stackoverflow.com/a/21767017
has body: I'm trying to work on Google Analytics for Androi. I get the message, and I'm following the advanced configuration of Android Analytics in Google Android SDK. java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.secondapp/com.example.secondapp.MainActivity}: java.lang.NullPointerException And I get this error: 01-02 15:39:38.410: D/AndroidRuntime(1338): Shutting down VM 01-02 15:39:38.410: W/dalvikvm(1338): threadid=1: thread exiting with uncaught exception (group=0xb1ab7ba8) 01-02 15:39:38.420: E/AndroidRuntime(1338): FATAL EXCEPTION: main 01-02 15:39:38.420: E/AndroidRuntime(1338): Process: com.example.secondapp, PID: 1338 01-02 15:39:38.420: E/AndroidRuntime(1338): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.secondapp/com.example.secondapp.MainActivity}: java.lang.NullPointerException 01-02 15:39:38.420: E/AndroidRuntime(1338): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 01-02 15:39:38.420: E/AndroidRuntime(1338): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 01-02 15:39:38.420: E/AndroidRuntime(1338): at android.app.ActivityThread.access$800(ActivityThread.java:135) 01-02 15:39:38.420: E/AndroidRuntime(1338): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 01-02 15:39:38.420: E/AndroidRuntime(1338): at android.os.Handler.dispatchMessage(Handler.java:102) 01-02 15:39:38.420: E/AndroidRuntime(1338): at android.os.Looper.loop(Looper.java:136) 01-02 15:39:38.420: E/AndroidRuntime(1338): at android.app.ActivityThread.main(ActivityThread.java:5017) 01-02 15:39:38.420: E/AndroidRuntime(1338): at java.lang.reflect.Method.invokeNative(Native Method) 01-02 15:39:38.420: E/AndroidRuntime(1338): at java.lang.reflect.Method.invoke(Method.java:515) 01-02 15:39:38.420: E/AndroidRuntime(1338): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 01-02 15:39:38.420: E/AndroidRuntime(1338): at com.andro…
type: Question

http://stackoverflow.com/q/20913773
has title: Is a ternary expression faster than Boolean logic?
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/31413333
type: Question
tagged with: performance
has comment: http://stackoverflow.com/comment/31397186
has body: This doesn't look like a duplicate, as only one my solutions involves a branch. Essentially, which of these two lines is more efficient? will be a java app, but it'd be nice to know a general answer well. shouldRefresh = useCache ? refetchIfExpired : true; shouldRefresh = !useCache || refetchIfExpired;
possible better answer: http://stackoverflow.com/a/20913823
tagged with: boolean
answer count: 2
has answer: http://stackoverflow.com/a/20913823
downvote count: 0
has answer: http://stackoverflow.com/a/20913803
has comment: http://stackoverflow.com/comment/31398160
has comment: http://stackoverflow.com/comment/31397187
favorite count: 0
duplicate of: http://stackoverflow.com/q/9745389
accepted answer: http://stackoverflow.com/a/20913803
has comment: http://stackoverflow.com/comment/31397168
score: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/31386271
has text: I'm confused. You must know where to get this stacktrace from because you already included one in your question?! Change `Log.d("myapp", Log.getStackTraceString(new Exception()));` to `Log.d("myapp", Log.getStackTraceString(e));` and update your question with the new stacktrace. Or just use `Log.d("myapp", "Error decrypting data", e);`.
score: 1
comment on: http://stackoverflow.com/q/20902854
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21012543
possible better answer: http://stackoverflow.com/a/21012564
has answer: http://stackoverflow.com/a/21012564
tagged with: arrays
has answer: http://stackoverflow.com/a/21012561
answer count: 6
score: 2
has body: I would like to convert string to string array.. I have done something like this: String name = "name"; String[] letters = name.split("(?&lt;=.)"); System.out.println("letters = " + Arrays.toString(letters)); But now I want something like this: String name = "John Mark Lester Andrew Todd"; To print array like this: [John, Mark, Lest, Andrew, Todd] So I want to look for spaces in my string and then put them into a string array. Do you have ideas to do this? Help is much appreciated. Thanks.
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/21012570
has comment: http://stackoverflow.com/comment/31582224
accepted answer: http://stackoverflow.com/a/21012561
downvote count: 2
has answer: http://stackoverflow.com/a/21012651
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21012697
has title: Java convert string to string array by spaces
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/21012609

http://stackoverflow.com/q/20888975
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20892454
accepted answer: http://stackoverflow.com/a/20892454
has answer: http://stackoverflow.com/a/20889161
has answer: http://stackoverflow.com/a/20889397
tagged with: java
possible better answer: http://stackoverflow.com/a/20889159
has body: I got a sprite, I know the position, and the rectangle behind. I want to get the location behind the sprite, I know the offset. My point would be like: Point p=new Point(sprite.getX()-offset,sprite.getY()-sprite.getHeight()/2); If I rotate my sprite around its center origin, I want to get the new location of that point. An image that will explain better:
type: Question
tagged with: math
has title: get a point after rotating the rectangle
score: 5
has answer: http://stackoverflow.com/a/20889159
downvote count: 0
favorite count: 0
upvote count: 5
answer count: 4

http://stackoverflow.com/a/21014093
has comment: http://stackoverflow.com/comment/31584730
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31585160
has comment: http://stackoverflow.com/comment/31585253
has body: I dont know what you want to do with double characters, but if you add this few lines to your code at the end you are getting the right result. Iterate over the sorted String and replace the charakters in the original String with their indices in the sorted String. String originalStr = "airport"; for(int i = 0; i&lt;str.length(); i++) { originalStr = originalStr.replace(str.charAt(i), String.valueOf(i+1).charAt(0)); } System.out.println(originalStr); Output: 1254357 If you want to get the output: 1254367 use replaceFirst: originalStr = originalStr.replaceFirst(String.valueOf(str.charAt(i)), String.valueOf(i+1)); Input:Orange Output:561432 Input:Monkey Output:354216 The whole code: String str = "airport"; String originalStr = str; //creat a backup of str because you change it in your code Character[] chars = str.toCharArray(); Arrays.sort(chars, new Comparator&lt;Character&gt;() { public int compare(Character c1, Character c2) { int cmp = Character.compare( Character.toLowerCase(c1.charValue()), Character.toLowerCase(c2.charValue())); if (cmp != 0) { return cmp; } return Character.compare(c1.charValue(), c2.charValue()); } }); str = String.valueOf(chars); System.out.println(str); //Iterate over the sorted String and replace the charakters in the original String with their indices in the sorted String for(int i = 0; i&lt;str.length(); i++) { originalStr = originalStr.replaceFirst(String.valueOf(str.charAt(i)), String.valueOf(i+1)); } System.out.println(originalStr);
type: Answer
has comment: http://stackoverflow.com/comment/31585489
score: 1
accepted answer of: http://stackoverflow.com/q/21013726
has comment: http://stackoverflow.com/comment/31584933
has comment: http://stackoverflow.com/comment/31585079
has comment: http://stackoverflow.com/comment/31585392
upvote count: 1
answers question: http://stackoverflow.com/q/21013726
has comment: http://stackoverflow.com/comment/31585528
has comment: http://stackoverflow.com/comment/31584803
has comment: http://stackoverflow.com/comment/31584908

http://stackoverflow.com/comment/31458107
type: AnswerComment
comment on: http://stackoverflow.com/a/20944063
score: 0
type: Comment
has text: @Nicolas...do u have any solution

http://stackoverflow.com/a/20903260
score: 5
has comment: http://stackoverflow.com/comment/31376001
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/31376018
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20903193
has body: The method paint is called automatically by Java to paint the window. See the method documentation The method paint2 is not standard and will not be invoked automatically. Either public void paint(Graphics g) { super.paint(g); g.drawString ("Foo", 70, 70); g.drawString ("Bar", 600, 600); } or public void paint(Graphics g) { super.paint(g); g.drawString ("Foo", 70, 70); paint2(g); } public void paint2(Graphics g) { g.drawString ("Bar", 600, 600); }
type: Answer
accepted answer of: http://stackoverflow.com/q/20903193

http://stackoverflow.com/comment/31586265
comment on: http://stackoverflow.com/q/21014784
score: 0
type: Comment
type: QuestionComment
has text: Thanks for your advice, SSCCE added (normal jar, embedding also the applet, but there is a main and a main class in manifest). It can be run with "java -jar" command line.

http://stackoverflow.com/q/20975917
tagged with: jxmapkit
type: AnsweredQuestion
score: 0
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/5853879
has answer: http://stackoverflow.com/a/20997017
has body: Is it possible, to use JXMapKit with Java to render e.g. Openstreetmaps map images without a visible ui? My use case is to have an commandline application on a server to render map images using JXMapKit. Is it possible or is there a better possibility for my goal?
answer count: 1
has title: JXMapkit without visible UI
accepted answer: http://stackoverflow.com/a/20997017
tagged with: swing

http://stackoverflow.com/q/20878039
upvote count: 23
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/1995198
has comment: http://stackoverflow.com/comment/31329573
has comment: http://stackoverflow.com/comment/31329552
has answer: http://stackoverflow.com/a/20878092
score: 19
linked to: http://stackoverflow.com/q/1010645
has body: Why do Java introduces some interface which has no methods defined in it? For example Cloneable, Serializable, Type and many more. Second thing : In Class.class package there is one method defined registerNatives() without body and is called from static block but Class.class is not abstract but is final. Why so? and Why Java need some method without body to be called from static block.?
type: Question
has comment: http://stackoverflow.com/comment/31329505
linked to: http://stackoverflow.com/q/18900736
downvote count: 4
has answer: http://stackoverflow.com/a/48634890
possible better answer: http://stackoverflow.com/a/20878092
tagged with: java-native-interface
has answer: http://stackoverflow.com/a/20878194
has answer: http://stackoverflow.com/a/20878084
tagged with: class
has answer: http://stackoverflow.com/a/20878234
favorite count: 0
has comment: http://stackoverflow.com/comment/31329470
accepted answer: http://stackoverflow.com/a/20878084
answer count: 5
tagged with: interface
has title: Interface with no methods

http://stackoverflow.com/comment/31390030
type: Comment
comment on: http://stackoverflow.com/a/20909695
score: 2
has text: According to the document says 'that the classifiers sources and javadoc are used to deploy the project source code and API docs along with the packaged class files' what do that mean? I think that's the reason why my pom.xml uses it. Why do you need to deploy the API docs and Source code along with packaged classes. Isn't deploy packaged classes not good enough?
type: AnswerComment

http://stackoverflow.com/q/20893974
has title: Javafx Memory leaks
upvote count: 3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31359689
has answer: http://stackoverflow.com/a/26903817
downvote count: 1
type: Question
tagged with: java
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31359865
tagged with: javafx-8
has body: I have a phone book application. On start the application loads every thing to a trie and a list, put them in a list view on the right hand side of the app and there is some textfields and imageview on the left hand side so when new selection is made in the list, those info fields are updated with new contact details. Like that: So after the load up and viewing everything nothing is really created again and I dont keep reference to anything. When new contact selected I get his data and it is replaced with the previous data in fields even the image I only keep reference to the imag location when contact is selected I go load a new image and put it in the image view : public void createImage(String url, double loadWidth, double loadHeight, Point2D viewPortStart) { notifier.setVisible(false); //load the image try{ File file = new File(url); if(!file.exists()) throw new Exception(); Image image = new Image(file.toURI().toURL().toString(),loadWidth,loadHeight,true,true); //set dragging fields this.viewPortStart.x = viewPortStart.getX(); this.viewPortStart.y = viewPortStart.getY(); moved.x = viewPortStart.getX(); moved.y = viewPortStart.getY(); //put image to view view.setImage(image); //update viewport view.setViewport(new Rectangle2D(viewPortStart.getX(),viewPortStart.getY(),SIZE,SIZE)); //notify that this component contains a photo now containsPhoto.setValue(true); notifier.setVisible(false); validProperty().setValue(true); imageLocation = url; imageHeight = loadHeight; imageWidth = loadWidth; } catch (Exception ex) { createEmptyImage(); showImageLoadError(url == null ? "unknown path":url); } } So I started profiling this with Yourkit. On application start it uses 50mb in yourkit and 120mb in task manager. Then I use the keyboard to go down the whole list of cantacts after that I force a garbage collection and the new used memory is 400mb on task manager and 120 mb on yourkit?!!! See below the selected blue line indicate the time where I forced a grabage collection. it…
tagged with: memory-leaks
has comment: http://stackoverflow.com/comment/31359799
tagged with: javafx-2
score: 2

http://stackoverflow.com/comment/31297440
type: Comment
comment on: http://stackoverflow.com/a/20850924
has text: Originally I was using the plain Notepad, after downloading Notepad++ I did what you said and it works like a charm. Was not aware this could be an issue. Thanks for your help!
type: AnswerComment
score: 0

http://stackoverflow.com/a/20859857
has body: JBoss EAP 6.1 actually supports async EJBs as well. But AFAIK async EJBs only really help you when you don't need to wait for the results of the subtasks (eg. you only need the fork part, not the join part). If you use java.util.concurrent.ForkJoinPool there isn't a legal way of using it in Java EE and Java EE 7 / JSR-236 does not help (I raised this point with the EG but they couldn't be bothered). ForkJoinPool spwans threads which is illegal and ManagedThreadFactory from EE 7 / JSR-236 is not a ForkJoinWorkerThreadFactory. In JDK 8 there is a default ForkJoinPool which can be configured to not spawn any threads and run everything in the caller thread (probably through the "java.util.concurrent.ForkJoinPool.common.parallelism" system property). This makes it legal but won't give you any parallelism. On a more general note fork join tasks should be compute bound and not IO bound. In theory spawning thread threads in Java EE is safe as long as you don't use any Java EE features (and let them terminate when your application undeploys). For example: transactions JDBC JPA (including lazy loading) security EJBs remoting class loading JNDI … These features also generally make tasks IO bound instead of CPU bound. And yes the same issues apply to JDK 8 parallel streams.
score: 4
answers question: http://stackoverflow.com/q/20851214
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/a/21716370
has comment: http://stackoverflow.com/comment/43682602
has comment: http://stackoverflow.com/comment/34139730
type: Answer
upvote count: 20
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20896237
has comment: http://stackoverflow.com/comment/34137160
has comment: http://stackoverflow.com/comment/79569288
answers question: http://stackoverflow.com/q/20896237
score: 20
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/111056230
has body: When connecting to Cloud SQL from an authorized App Engine application, the password is not required (actually it will fail if you try to connect with password). Change your connection string to jdbc:google:mysql://&lt;appID:instanceID&gt;/&lt;dbname&gt;? user=root omitting the &amp;password=&lt;password&gt; part

http://stackoverflow.com/a/20914909
has body: It doesn't work. If you turn on compiler warnings you will see the compiler is protesting that an unchecked conversion is being performed. The compiler is telling you it's unable to verify at compile-time that the cast you've inferred is correct.
has comment: http://stackoverflow.com/comment/31399704
has comment: http://stackoverflow.com/comment/31399360
has comment: http://stackoverflow.com/comment/31399519
score: 0
answers question: http://stackoverflow.com/q/20914459
has comment: http://stackoverflow.com/comment/31399274
type: Answer

http://stackoverflow.com/q/20988142
answer count: 1
favorite count: 0
has body: I have established a MySQL connection with java. I also have Hashed my Password with MD5. How do you usually send encrypted MD5 Password to mysql? I do it like below but false, I put the already hashed password to SQL query. MySQL cant read it. String Password = "890621"; //hash value after "890621" being hash MD5. String newHashPassword = "a8ae0ba1adf92c69fd33b1c6d4c2376f"; if (stmt.execute("SELECT * FROM user_info WHERE user_name = 'James' AND password=" + newHashPassword)) { rs = stmt.getResultSet(); } Can anyone show me sample code of how to sent md5 password to MySQL?
has comment: http://stackoverflow.com/comment/31537408
accepted answer: http://stackoverflow.com/a/21009937
score: -1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31537308
tagged with: md5
tagged with: mysql
has comment: http://stackoverflow.com/comment/31537348
downvote count: 1
type: Question
has title: How MYSQL check MD5 password
has comment: http://stackoverflow.com/comment/31537264
tagged with: java
has comment: http://stackoverflow.com/comment/31537272
has answer: http://stackoverflow.com/a/21009937
has comment: http://stackoverflow.com/comment/31577023
has comment: http://stackoverflow.com/comment/31537330
upvote count: 0

http://stackoverflow.com/a/20867940
answers question: http://stackoverflow.com/q/20867912
downvote count: 0
type: Answer
has body: BigInteger is immutable and return a new object each time. Your Sample class is mutable and when you alter it there is only one copy/value it holds.
score: 3
upvote count: 3

http://stackoverflow.com/comment/31452071
has text: thanks. I apparently was conflating the bytecode compilation and the machine-code compilation (JIT, runtime). My concern is not so much that a single test will consume excessive resources, but that the sum total of many tests will be a significant resource hog (and difficult to identify as such). So I was hoping to get a general idea of how this would affect my program(s) before making a habit of designing tests like this.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20941347
type: AnswerComment

http://stackoverflow.com/comment/31577164
type: Comment
comment on: http://stackoverflow.com/q/21009578
type: QuestionComment
has text: How are you starting the new `Activity`? Are you calling `finish()` in the old `Activity`?
score: 1

http://stackoverflow.com/comment/31529306
type: QuestionComment
comment on: http://stackoverflow.com/q/20983658
has text: Your design is wrong. Using Interfaces you can accomplish the same thing. So learn 'Interfaces' and 'Abstraction'.
score: 0
type: Comment

http://stackoverflow.com/q/20871358
has answer: http://stackoverflow.com/a/20871519
score: 0
tagged with: playframework
answer count: 1
has title: HTTP Asynchronous programming
has comment: http://stackoverflow.com/comment/31317835
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20871519
tagged with: java
has body: Learning how to use the Java PlayFrameWork and it talks about how you can do asynchronous server programming - by that I mean, if a result takes a long time to produce, you can return a promise of a result - informing the browser that a result will be returned. Can I ask what in HTTP terms this does and how browsers commonly deal with it? Also, can a result promise be returned to an AJAX call?
tagged with: http
type: Question

http://stackoverflow.com/comment/31537987
score: 0
comment on: http://stackoverflow.com/q/20988575
type: Comment
has text: Did you checked if "remoteDriver.findElementByName("Confirmation")" is not null in that case it will be a null pointer will occur.
type: QuestionComment

http://stackoverflow.com/comment/31366697
type: AnswerComment
has text: That is coming because the getView behavior is like that.
type: Comment
comment on: http://stackoverflow.com/a/20883156
score: 0

http://stackoverflow.com/q/20964068
score: 0
has comment: http://stackoverflow.com/comment/31492650
has comment: http://stackoverflow.com/comment/31492559
tagged with: jsp
has comment: http://stackoverflow.com/comment/31492428
has comment: http://stackoverflow.com/comment/31493058
has comment: http://stackoverflow.com/comment/31493997
has comment: http://stackoverflow.com/comment/31492470
has title: HTTP request with scriptlet in JSP
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/31493277
has comment: http://stackoverflow.com/comment/31492573
has comment: http://stackoverflow.com/comment/31492374
linked to: http://stackoverflow.com/q/3177733
has comment: http://stackoverflow.com/comment/31492995
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31520679
has comment: http://stackoverflow.com/comment/31492719
has comment: http://stackoverflow.com/comment/31492630
tagged with: scriptlet
type: Question
has comment: http://stackoverflow.com/comment/31492594
has body: I'am making a website that communicate with a web server. and in the servlet I'am using http request to send queries and store it in my session. i need values that will be coming from the web server and i dont want to put it to my session. Is it ok to communicate with the web server using scriptlet? &lt;% Gson gson=new Gson(); //send query to web server Httprequest request=new Httprequest("query"); Object[] obj=gson.fromJson(request,obj[].class); %&gt; &lt;select&gt; &lt;% for(int i=0;i&lt;obj.length;i++){ out.println("&lt;option&gt;"+obj[i]+"&lt;/option&gt;"); } %&gt; &lt;/select&gt;
tagged with: httprequest

http://stackoverflow.com/q/20973513
has comment: http://stackoverflow.com/comment/31510751
has comment: http://stackoverflow.com/comment/103523331
tagged with: java
answer count: 1
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/31510239
tagged with: cql
favorite count: 0
tagged with: cassandra
type: Question
has body: I am inserting a set of data in cassandra table .But i am getting un matched column names/values in there.i am posting the code and also the table structure public static void aMethod2FromData(DetailsVO detailsVO) { System.out.println(detailsVO.getA_no()); StringBuilder sb = new StringBuilder(); int num = (int) (Math.random() * 8847); int radar = (int) (Math.random() * 847); sb.append( "INSERT INTO CALL_RATIO_ANALYSYS (A_NO,JAN,FEB,MAR,APR,MAY,JUNE,JULY,AUG,SEP,OCT,NOV,DEC,RADAR_VOICE,RADAR_SMS,RADAR_MMS,RADAR_GPRS,RADAR_OTHER,MMS_INCOMING,MMS_OUTGOING,VOICE_INCOING,VOICE_OUTGOING,SMS_INCOMING,SMS_OUTGOING,GPRS_SOCIAL,GPRS_MAIL,GPRS_GOOGLE,GPRS_ENTERTAINMENT,GPRS_BUSINESS)") .append("VALUES("); sb.append("'").append(detailsVO.getA_no()).append("',"); //calculation for Jan to dec sb.append("'").append(num).append("',"); sb.append("'").append(num).append("',"); sb.append("'").append(num).append("',"); sb.append("'").append(num).append("',"); sb.append("'").append(num).append("',"); sb.append("'").append(num).append("',"); sb.append("'").append(num).append("',"); sb.append("'").append(num).append("',"); sb.append("'").append(num).append("',"); sb.append("'").append(num).append("',"); sb.append("'").append(num).append("',"); sb.append("'").append(num).append("',"); //end here //start calculation of radar sb.append("'").append(radar).append("',"); sb.append("'").append(radar).append("',"); sb.append("'").append(radar).append("',"); sb.append("'").append(radar).append("',"); sb.append("'").append(radar).append("',"); //ends here //mms incoming sb.append("'").append(radar).append("',"); sb.append("'").append(radar).append("',"); //ends here //voice incoming outgoing sb.append("'").append(radar).append("',"); sb.append("'").append(radar).append("',"); //end here //sms incoming outgoing sb.append("'").append(radar).append("',"); sb.append("'").append(radar).append("',"); //ends here //gprs calculation sb.append("'").append(radar).append("',"); sb.append("'").append(radar).ap…
has title: How to solve unmatched column names/values in cassandra?
has answer: http://stackoverflow.com/a/20974124
has comment: http://stackoverflow.com/comment/31509413
upvote count: 2
downvote count: 1

http://stackoverflow.com/comment/32279108
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20998409
type: AnswerComment
has text: Thanks i resolved the issue by removing improt statement from the code. Compiled using the internal sun classes. Thanks for the solution.

http://stackoverflow.com/q/20966818
tagged with: excel
has answer: http://stackoverflow.com/a/75185544
type: AnsweredQuestion
tagged with: java
has title: Apache POI - setting left/right print margin in Excel
has answer: http://stackoverflow.com/a/35989343
type: Question
score: 8
downvote count: 0
has answer: http://stackoverflow.com/a/20977362
answer count: 3
has body: Is that possible - with apache POI - to set left or right print margin for Excel sheet? The default margins are quite big. I cannot see neither setLeftMargin nor setRightMargin in XSSFPrintSetup, but only header and footer: XSSFPrintSetup printSetup = (XSSFPrintSetup) sheet.getPrintSetup(); printSetup.setHeaderMargin(0.5D); printSetup.setFooterMargin(0.5D); Is there any kind friend that could help me a little?
favorite count: 0
tagged with: apache-poi
upvote count: 8
accepted answer: http://stackoverflow.com/a/20977362
possible better answer: http://stackoverflow.com/a/75185544

http://stackoverflow.com/comment/31588737
has text: @beginner_ Edit looks good to me, **except** the `worker.get()` probably defeats the purpose of the worker thread... Don't block and wait, instead handle exceptions in the worker itself, and report back if a problem occurs. Consider also passing `this` to the `MyWorker` constructor, and make your inner class `static`, instead of the `Outer.this.set...`-mess. :-)
type: Comment
score: 1
comment on: http://stackoverflow.com/q/21014861
type: QuestionComment

http://stackoverflow.com/a/20874817
type: Answer
answers question: http://stackoverflow.com/q/20874775
score: 0
has body: public static JLabel[] portion = new JLabel[11]; is just like creating array of nulls, meaning array portion array is empty. You should now iterate it through and populate the array with actual JLable objects. And then try assigning values through setText method.

http://stackoverflow.com/comment/31865658
has text: Nice info. I started with the dragon book but i havent found anything about "pratt parsers" there, yet.
comment on: http://stackoverflow.com/a/21107280
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/20860581
upvote count: 1
answers question: http://stackoverflow.com/q/20860543
downvote count: 0
score: 1
has body: To append the stuff at the end of the file, use the append() method of FileWriter
type: Answer

http://stackoverflow.com/comment/31541857
type: Comment
score: 2
type: AnswerComment
has text: If the `CLASSPATH` variable is set and doesn't contain the current directory then you may need this, otherwise the [current directory is searched by default](http://docs.oracle.com/javase/tutorial/essential/environment/paths.html#classpath).
comment on: http://stackoverflow.com/a/20990671

http://stackoverflow.com/comment/31592933
comment on: http://stackoverflow.com/a/21018887
type: AnswerComment
score: 0
type: Comment
has text: Sorry but i am not familiar with the "ANCHOR" term. Can you please give me the path which you are asking me to update

http://stackoverflow.com/q/20909242
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31387842
tagged with: collections
has title: Java - how do I check if a string exists in each of the elements of a HashSet
type: Question
has answer: http://stackoverflow.com/a/20909289
has answer: http://stackoverflow.com/a/20909356
tagged with: hashset
has answer: http://stackoverflow.com/a/20909424
has answer: http://stackoverflow.com/a/20909293
has comment: http://stackoverflow.com/comment/31388138
possible better answer: http://stackoverflow.com/a/20909356
score: 2
has comment: http://stackoverflow.com/comment/31387915
downvote count: 0
has body: final HashSet&lt;String&gt; VALUES = new HashSet&lt;String&gt;(Arrays.asList(new String[] {"OK (0.07, 0.05, 0.01)", "OK (0.07, 0.05, 0.02)", "OK (0.07, 0.05, 0.03)", "OK (0.07, 0.05, 0.04)"})); String s="OK"; System.out.println(VALUES.contains(s)); Gives me false. How do I check if "OK" exists in each of the elements?
has answer: http://stackoverflow.com/a/20909304
favorite count: 0
upvote count: 2
answer count: 5
accepted answer: http://stackoverflow.com/a/20909424
has comment: http://stackoverflow.com/comment/31387843

http://stackoverflow.com/a/20991256
answers question: http://stackoverflow.com/q/20991172
has body: SimpleDateFormat.format(Date) SimpleDateFormat.format(Object) There are these two methods there in SimpleDateFormat. With what you do you're calling the 2nd one. And as this String you pass in is an invalid date, you get this exception. I think you think that new Date() will give you date without the time part in Java. No, it gives you the time part too. So your new Date() + "23:59" becomes something like Wed Jan 08 04:13:58 EST 201423:59 Therefore the problem you get.
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/31542637
has comment: http://stackoverflow.com/comment/31542329
downvote count: 0
score: 1

http://stackoverflow.com/q/20977226
tagged with: tomcat
favorite count: 0
accepted answer: http://stackoverflow.com/a/20977254
score: 2
upvote count: 2
tagged with: java
possible better answer: http://stackoverflow.com/a/20977367
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20977367
has answer: http://stackoverflow.com/a/20977254
tagged with: servlets
answer count: 2
has title: Putting a link with a query as a parameter of a get request
downvote count: 0
has body: So basically I'm trying to create a very simple server which with take a request which include a link to be stored, but my problem is, is if that link contains a query with an &amp;, everything past the &amp; is not stored because the server thinks it's an entirely different parameter within the query. I'll clear this up with an example, but firstly here is the code: package com.something.tomcatServer; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class javaQuery extends HttpServlet { String storedId = null; public void storeId(String u){ storedId = u; } public String retrieveId(){ return storedId; } protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { } protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String request = req.getParameter("request"); if(request.equalsIgnoreCase("sendId")){ String url = req.getParameter("id"); if(url != null){ storeId(url); }else{ resp.getWriter().println("ERROR: No ID was inputted to store for the sendId request."); } }else if(request.equalsIgnoreCase("retrieveId")){ String retrievedId = retrieveId(); resp.getWriter().println(retrievedId); } } } So basically in the doGet it's saying there are two request types "sendId" and "retrieveId". "retrieveId" works perfectly fine, it just retrieves the last stored URL, but sendId doesn't work in this case: Example: localhost:8080/javaQuery?request=sendId&amp;url= http://m.yahoo.com/?.tsrc=yahoo&amp;mobile_view_default=true, now if I do localhost:8080/javaQuery?request=retrieveId it will only output http://m.yahoo.com/?.tsrc=yahoo, because of the &amp; in the url. I hope this makes sense. What I'm asking is how I could go about fixing this problem as I am not completely sure. Any insight whatsoever is helpful, thank you.

http://stackoverflow.com/comment/31377420
has text: I'm not using calculateAmmo for the heroAmmo though - it is simply the code above where it sets a string for 'ammoLevel'
type: QuestionComment
comment on: http://stackoverflow.com/q/20903991
score: 0
type: Comment

http://stackoverflow.com/q/20931053
tagged with: spring
accepted answer: http://stackoverflow.com/a/20933604
has answer: http://stackoverflow.com/a/27904754
upvote count: 23
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/27904754
score: 23
type: Question
has answer: http://stackoverflow.com/a/62355822
tagged with: frameworks
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/20933604
tagged with: elasticsearch
tagged with: spring-data-elasticsearch
has answer: http://stackoverflow.com/a/42129862
has body: I'm developing a system which is planning to use elasticsearch as an data repository. I'm trying to choose the best way to develop my application that can index and query data from elasticsearch. The system I have is built on top of Spring framework. Is it a good choice to use Spring-data-elasticsearch(https://github.com/spring-projects/spring-data-elasticsearch)? Or is it a good choice to use elasticsearch core libraries itself? I need to handle nested data (inner object) but Spring-data-elasticsearch seems to have no operations for that recently. I hope I can find a solution for the question. Thanks in advance.
answer count: 4
has title: The Best way to use ElasticSearch in Spring java framework

http://stackoverflow.com/comment/31584217
has text: 'Java' is to 'JavaScript' as 'Car' is to 'Carpet'. So which language are you using?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21013550

http://stackoverflow.com/q/20907696
has title: is a==null? brach1 : branch2 - not lazy evaluated in java?
tagged with: java
has comment: http://stackoverflow.com/comment/31384645
type: Question
possible better answer: http://stackoverflow.com/a/20907735
has answer: http://stackoverflow.com/a/20907735
has comment: http://stackoverflow.com/comment/31384589
duplicate of: http://stackoverflow.com/q/3279743
upvote count: 3
answer count: 3
linked to: http://stackoverflow.com/q/3279743
has answer: http://stackoverflow.com/a/20907727
accepted answer: http://stackoverflow.com/a/20907727
favorite count: 0
has body: how can i get null pointer exception from this line of code? String a = "localUri: "+ mCurrentImageUri == null? "none" : mCurrentImageUri.toString(); mCurrentImageUri == null, but I have thought it won't evaluate mCurrentImageUri.toString() if so half-related: how to write similar to this c# syntax? string a = myVar?? "none"
has answer: http://stackoverflow.com/a/20907742
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: syntax

import
type: Tag
tags question: http://stackoverflow.com/q/20859108
tag name: import
tags question: http://stackoverflow.com/q/20961074
tags question: http://stackoverflow.com/q/20989009
tags question: http://stackoverflow.com/q/20978703

http://stackoverflow.com/q/20867875
answer count: 1
tagged with: oauth
type: UnansweredQuestion
tagged with: oauth-provider
has answer: http://stackoverflow.com/a/20868064
has body: I need to create my own oauth1 provider in java. Can any one help me how can i create oauth1 provider in java. Currently i'm using this package for implement it but can't get more help about how can i use this.using this I google this question but didn't get any helping material. If some one give a link or working example , i will appreciate it
tagged with: java
type: Question
tagged with: spring-security
has title: implement Oauth1 Provider in java
score: 0

http://stackoverflow.com/comment/31432009
type: Comment
type: QuestionComment
has text: @AndrewThompson I have added an answer if OP wants to use JApplet. I tested it on my system. super.paint() was not called after setting content pane's background.
score: 0
comment on: http://stackoverflow.com/q/20931057

http://stackoverflow.com/q/20907206
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20961958
has body: I am quite new to Spring and Spring-Batch in particular. Still I somehow managed to install the Spring Batch-Admin. I added custom jobs and Hibernate/JPA for persistence. Everything is working as expected, up to the point where the first chunk should be persisted. Then I receive the following error-message: org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is java.lang.IllegalStateException: Already value [org.springframework.jdbc.datasource.ConnectionHolder@60d31437] for key [org.springframework.jdbc.datasource.DriverManagerDataSource@12da4b19] bound to thread [jobLauncherTaskExecutor-1] This is the full stacktrace: org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is java.lang.IllegalStateException: Already value [org.springframework.jdbc.datasource.ConnectionHolder@43f9e588] for key [org.springframework.jdbc.datasource.DriverManagerDataSource@84f171a] bound to thread [jobLauncherTaskExecutor-1] at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:427) at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371) at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:335) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:105) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at com.sun.proxy.$Proxy41.saveIfUnique(Unknown Source) at com.qompa.batch.ArticleItemWriter.write(ArticleItemWriter.java:28) at org.springframework.batch.core.step.item.SimpleChunkProcessor.writeItems(SimpleChunkProcessor.java:171) at org.spring…
upvote count: 35
tagged with: java
tagged with: hibernate
possible better answer: http://stackoverflow.com/a/21059045
has answer: http://stackoverflow.com/a/51860428
type: Question
has answer: http://stackoverflow.com/a/20961958
has answer: http://stackoverflow.com/a/58508376
answer count: 6
tagged with: spring-batch
score: 35
has answer: http://stackoverflow.com/a/62579590
tagged with: jpa
downvote count: 0
has answer: http://stackoverflow.com/a/21059045
has title: Could not open JPA EntityManager for transaction; nested exception is java.lang.IllegalStateException
favorite count: 0
has answer: http://stackoverflow.com/a/52772801
tagged with: spring

http://stackoverflow.com/q/21015318
has title: Merge two list into a single list
has answer: http://stackoverflow.com/a/21015364
accepted answer: http://stackoverflow.com/a/21015357
type: Question
has comment: http://stackoverflow.com/comment/31586837
has answer: http://stackoverflow.com/a/63134612
score: 4
has body: I have a ArrayList as below. ArrayList&lt;ArrayList&lt;String&gt;&gt; a = new ArrayList&lt;ArrayList&lt;String&gt;&gt;(); Where ArrayList 'a' contains two ArrayList of string as below. [a,b,c,d] &amp; [1,2,3,4] How to merge these two list into a single list as below. [a,b,c,d,1,2,3,4] Thanks In Advance.
has answer: http://stackoverflow.com/a/21015441
has answer: http://stackoverflow.com/a/21015357
has answer: http://stackoverflow.com/a/57076427
possible better answer: http://stackoverflow.com/a/21015358
upvote count: 4
favorite count: 0
linked to: http://stackoverflow.com/q/3975783
answer count: 9
linked to: http://stackoverflow.com/q/189559
has answer: http://stackoverflow.com/a/21015358
tagged with: merge
tagged with: collections
has answer: http://stackoverflow.com/a/21015442
type: AnsweredQuestion
tagged with: list
downvote count: 0
has answer: http://stackoverflow.com/a/21015355
has answer: http://stackoverflow.com/a/21015858
tagged with: java

http://stackoverflow.com/comment/31304122
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20864408
has text: The guy who told me to write some code for this app says he wants one thing to happen when the button is shortpressed and something else when it is longpressed. I'll probably put it as an ActionView, as soon as I can figure out how to do that...

http://stackoverflow.com/q/20871297
tagged with: encryption
has comment: http://stackoverflow.com/comment/31316878
upvote count: 1
has comment: http://stackoverflow.com/comment/31316863
possible better answer: http://stackoverflow.com/a/20871376
type: Question
has body: I am doing an HTTP Post from Android like: HttpPost httppost = new HttpPost("example.com/ex.php"); PHP receives the request does what it is supposed to and sends the response back to Android. When I decrypt the APK I show the URL (example.com/ex.php) I want to encrypt this URL. I used Pro-Guard but not give me any benefit still I can see the URL. Is there any way to encrypt this URL or there is a way to make certification on server side?
has answer: http://stackoverflow.com/a/20871376
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20871338
answer count: 2
has title: Encryption String in Android
accepted answer: http://stackoverflow.com/a/20871338
downvote count: 0
tagged with: url
has comment: http://stackoverflow.com/comment/31316893
favorite count: 0
tagged with: android
tagged with: hosting
type: AnsweredQuestion

playframework-2.0
tags question: http://stackoverflow.com/q/20974572
tags question: http://stackoverflow.com/q/20933598
tags question: http://stackoverflow.com/q/20976909
tags question: http://stackoverflow.com/q/20865686
tags question: http://stackoverflow.com/q/20958783
tags question: http://stackoverflow.com/q/21003479
tags question: http://stackoverflow.com/q/20930601
tags question: http://stackoverflow.com/q/20851598
type: Tag
tags question: http://stackoverflow.com/q/20865100
tag name: playframework-2.0

http://stackoverflow.com/comment/31283301
type: Comment
score: 0
has text: Its a kind or homework. Try using Arrays class
type: QuestionComment
comment on: http://stackoverflow.com/q/20853856

http://stackoverflow.com/comment/31406308
has text: But this is not an attempt to inject a map that's registered as a bean. Autowired does support injecting all implementations which is what the question asked. See the docs: http://docs.spring.io/spring/docs/2.5.x/reference/beans.html#beans-autowired-annotation
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20918905

http://stackoverflow.com/comment/31440978
comment on: http://stackoverflow.com/a/20924839
has text: thanks for help. I was opinion that servlet can't be set as app entry point. Obviously wrong (still learning)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31372435
score: 0
type: Comment
type: QuestionComment
has text: No, I'm not getting any errors or anything. The console just keeps clean. I've added my pom.xml. Please check.
comment on: http://stackoverflow.com/q/20901205

http://stackoverflow.com/a/20950259
answers question: http://stackoverflow.com/q/20949437
has comment: http://stackoverflow.com/comment/31466492
has body: Note: see owlstead's answer for an excellent description of the flaws in your code example Your encrypt() and decrypt() operations are performing AES encryption and decryption respectively, using Java's JCE libraries. A JCE provider will be selected to perform the actual cryptography - the provider chosen will be the first in the list of providers that offers an implementation of AES. You have defined the algorithm as only "AES", so the mode of operation and padding will be chosen by the provider. If you want to control this, use the form "AES/mode/padding" (see the docs for valid choices) The getRaw method derives an AES key from a password. The raw bytes of the password provide the&nbsp;seed for a random number generator. The random number generator is then used to generate sufficient key material for a 128-bit AES key. A different password will produce a different seed, which should produce a different stream of random bytes and thus a different key. I suspect this approach is weakened by the lack of entropy present in most people's passwords, leading to a reduced key space and easier attacks. There is no key storage in your example code. JCE keys are normally persisted using a KeyStore object and the storage mechanism is provider-dependent.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31477048
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/31470372
has comment: http://stackoverflow.com/comment/31466404
accepted answer of: http://stackoverflow.com/q/20949437
has comment: http://stackoverflow.com/comment/31470328
score: 3

http://stackoverflow.com/comment/31389635
has text: Better in which sense? Speed or correctness? `0.1` isn't precisely representable in two's complement floating point.
comment on: http://stackoverflow.com/q/20909967
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/31319001
type: Comment
has text: I optimized it, but then it didn't work so I simplified it. The for loops iterate through each boolean in both of the arrays xD.
comment on: http://stackoverflow.com/q/20872319
score: 0
type: QuestionComment

http://stackoverflow.com/q/20850609
has answer: http://stackoverflow.com/a/20850793
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/20850663
has body: Problem description: We have a given matrix randomly filled with digits and have to create separate threads for each row of the matrix that count how many times the digits encounter in that row. Without these sleeps in the main thread, it's not working correctly.. Here's my solution. Also it's following here: public class TestingMatrixThreads { public static void main(String[] arr) throws InterruptedException { int[][] a = new int[67][6]; // class.Count works with class.Matrix, that's why I've made it this way Matrix m = new Matrix(a); m.start(); Thread.sleep(1000); // Here comes the BIG question -> how to avoid these // manually created pauses Count c; Thread t; // Creating new threads for each row of the matrix for (int i = 0; i < Matrix.matr.length; i++) { c = new Count(i); t = new Thread(c); t.start(); } //Again - the same question System.out.println("Main - Sleep!"); Thread.sleep(50); System.out.println("\t\t\t\t\tMain - Alive!"); int sum = 0; for (int i = 0; i < Count.encounters.length; i++) { System.out.println(i + "->" + Count.encounters[i]); sum += Count.encounters[i]; } System.out.println("Total numbers of digits: " + sum); } } class Count implements Runnable { int row; public static int[] encounters = new int[10]; // here I store the number of each digit's(array's index) encounters public Count(int row) { this.row = row; } public synchronized static void increment(int number) { encounters[number]++; } @Override public void run() { System.out.println(Thread.currentThread().getName() + ", searching in row " + row + " STARTED"); for (int col = 0; col < Matrix.matr[0].length; col++) { increment(Matrix.matr[row][col]); } try { Thread.sleep(1); // If it's missing threads are starting and stopping consequently } catch (InterruptedException e) { } System.out.println(Thread.currentThread().getName() + " stopped!"); } } class Matrix extends Thread { static int[][] matr; public Matrix(int[][] matr) { Matrix.matr = matr; } @Override public void run() { //print(); fil…
has title: How to remove manually created pauses in Main-thread?
has answer: http://stackoverflow.com/a/20850661
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/20850661
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20850663
tagged with: synchronize
tagged with: java
type: Question

http://stackoverflow.com/a/20954299
has body: You are getting a reference to the SharedPreferences from the MainActivity SharedPreferences sp = MainActivity.sp; However when the activity isn't running, you will be getting a NPE (of sp =null ) A Broadacast reciever already has access to the context so use that to accuire a reference to the SharedPreferences @SuppressWarnings("deprecation") public void onReceive(Context context, Intent intent) SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); /* * Your code */ }
answers question: http://stackoverflow.com/q/20953897
has comment: http://stackoverflow.com/comment/31506458
score: 0
type: Answer

cryptography
tag name: cryptography
type: Tag
tags question: http://stackoverflow.com/q/20920803
tags question: http://stackoverflow.com/q/20958443
tags question: http://stackoverflow.com/q/20949437
tags question: http://stackoverflow.com/q/20977067
tags question: http://stackoverflow.com/q/21018355
tags question: http://stackoverflow.com/q/20853157
tags question: http://stackoverflow.com/q/20882322
tags question: http://stackoverflow.com/q/20858406

http://stackoverflow.com/comment/31401360
has text: Not all of that code can go in `doInBackground()`. The `UI` stuff will need to go in one of the other `AsyncTask` methods.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20915964
type: Comment

http://stackoverflow.com/comment/31475196
type: QuestionComment
comment on: http://stackoverflow.com/q/20953319
score: 1
has text: See [here](http://stackoverflow.com/questions/3308939/jfreechart-obtain-data-source-value-on-mouse-click) for a solution
type: Comment

http://stackoverflow.com/a/20959657
has body: Test Case 1 - Yes, test the true and false cases on the boundary conditions (10, 11). Test Case 2 - Mock shouldlock and verify that it is called with x (probably using a constant value for the test). Using something like Mockito and have it call the real method only when calling lock. Test Case 3 - Same as test case 2, but verify shouldlock is called wtih x * 2. Test case 4 - You'd have to test the boundary cases for each type: FOO with 10 and 11, BAR with 5 and 6. Test Case 5 - Yes, only one test for FOOBAR is required. You'll have to write tests for the new values. If there are more enum values but they all go to the default case, no more unit tests are required. If there is additional logic, unit tests should be written (preferably before the production code) to test that logic.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20959301
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/20959301

http://stackoverflow.com/q/20931284
tagged with: arduino
has title: Android Button Can Be Click Once Only
type: Question
has comment: http://stackoverflow.com/comment/31430284
has comment: http://stackoverflow.com/comment/31430133
has answer: http://stackoverflow.com/a/20931453
score: 0
answer count: 1
tagged with: button
has body: I'm creating an on and off app controller for a led which is connected to my arduino microcontroller. Everythings seems to be okay already except for the bottons, both in ON and OFF. It works but it can only be click once. I have read some forums related with my problem and one of it said to remove static from some statements I have but I cannot remove it since there will be errors then. Here are some of my codes in my MainActivity.java: //@@@@@@@@@@for the controller btn_d1_on = (Button) findViewById(R.id.device1_on); btn_d1_off = (Button) findViewById(R.id.device1_off); //@@@@@@@@@@for the controller btn_d1_on.setOnClickListener(new OnClickListener() { public void onClick(View v) { //sendData("1"); //Toast msg = Toast.makeText(getBaseContext(), "The device is now On", Toast.LENGTH_SHORT); //msg.show() btn_d1_on.setEnabled(false); try { sendData("1"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); //@@@@@@@@@@for the controller btn_d1_off.setOnClickListener(new OnClickListener() { public void onClick(View v) { //sendData("0"); //Toast msg = Toast.makeText(getBaseContext(), "The device is now On", Toast.LENGTH_SHORT); //msg.show(); btn_d1_off.setEnabled(false); try { sendData("0"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); private void sendData(String message) throws IOException //public void sendData(String message) { byte[] msgBuffer = message.getBytes(); Log.d(tagStateCTRL, "...Sending data: " + message + "..."); //outStream.write(msgBuffer); BluetoothCommandService.write(msgBuffer); } While here is my BluetoothCommandService.java where write(byte[] out) was change into public static void write(byte[] out) instead of public void write(byte[] out)... import java.util.UUID; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import android.bluetooth.BluetoothA…
has comment: http://stackoverflow.com/comment/31430226
type: UnansweredQuestion
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
tagged with: java

http://stackoverflow.com/a/21015157
type: AcceptedAnswer
has body: You seem to have adjusted Eclipse JVM memory settings (you are editing eclipse.ini file) not your application. You shall increase the heap size of your Java application in the Eclipse run configuration view. And also you shall consider lazy loading entities (which is B in this case) that consume high memory resources.
type: Answer
accepted answer of: http://stackoverflow.com/q/21015063
answers question: http://stackoverflow.com/q/21015063
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/q/20934408
has body: I want to create a game and when I move the mouse to a button I want to play back a sound. This is the JFrame class: package jatek; public class jatek extends javax.swing.JFrame { public jatek() { initComponents(); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { UjJatek = new javax.swing.JButton(); Kilepes = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("AKASZTOFA"); setBounds(new java.awt.Rectangle(500, 250, 0, 0)); setFocusable(false); setMaximumSize(new java.awt.Dimension(800, 560)); setMinimumSize(new java.awt.Dimension(800, 550)); setPreferredSize(new java.awt.Dimension(800, 545)); setResizable(false); getContentPane().setLayout(null); UjJatek.setIcon(new javax.swing.ImageIcon(getClass().getResource("/jatek/szoveg.png"))); // NOI18N UjJatek.setBorderPainted(false); UjJatek.setContentAreaFilled(false); UjJatek.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { UjJatekMouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { UjJatekMouseEntered(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { UjJatekMouseExited(evt); } }); getContentPane().add(UjJatek); UjJatek.setBounds(470, 160, 180, 50); Kilepes.setIcon(new javax.swing.ImageIcon(getClass().getResource("/jatek/kilepes1.png"))); // NOI18N Kilepes.setBorderPainted(false); Kilepes.setContentAreaFilled(false); Kilepes.setFocusable(false); Kilepes.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { KilepesMouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { KilepesMouseEntered(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { KilepesMouseExited(evt); } }); getContentPane().add(Kilepes); Kilepes.setBounds(480, 340, 170, 50); jLabel1.setIcon(new …
has comment: http://stackoverflow.com/comment/31435768
has comment: http://stackoverflow.com/comment/31435853
has answer: http://stackoverflow.com/a/20934758
tagged with: swing
downvote count: 1
tagged with: jbutton
has comment: http://stackoverflow.com/comment/31435805
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31435743
tagged with: java
score: -1
type: Question
accepted answer: http://stackoverflow.com/a/20934758
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31435738
favorite count: 0
tagged with: javasound
has title: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException on mouse move

http://stackoverflow.com/comment/31301345
type: Comment
type: QuestionComment
has text: @nachokk Unfortunately it does not even begin to address the compilation problem. I think that has been handled pretty well already.
comment on: http://stackoverflow.com/q/20862919
score: 0

http://stackoverflow.com/a/20990655
has body: Check this cron trigger expression examples shown here. You will have to use a Quartz scheduler in Spring. This might be a good place to start off with the Taskexecuter in Spring too. http://docs.spring.io/spring/docs/3.0.x/reference/scheduling.html http://quartz-scheduler.org/documentation/quartz-2.1.x/tutorials/crontrigger
downvote count: 0
answers question: http://stackoverflow.com/q/20990389
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/a/20896118
type: Answer
has comment: http://stackoverflow.com/comment/31363490
score: 0
has body: I think your getting NPE in one of these two lines IdSPAJ_tt.setText("AndroidESPAJ"+a); helper.insertTertanggung(IdSPAJ_tt.getText().toString(),nama_tt.getText().toString(),gelar_tt.getText().toString()); If this is the case then make sure 1. helper is initialized with helper=new DBSpaj(mContext); 2. all views are referenced using findViewById();
answers question: http://stackoverflow.com/q/20895646

http://stackoverflow.com/comment/31592629
type: QuestionComment
comment on: http://stackoverflow.com/q/21018649
score: 0
has text: Have you verified that the `WebElement` you get from Fearfox is still the correct one? Web pages tend to change over night.
type: Comment

http://stackoverflow.com/a/32036084
upvote count: 2
has body: There is also a one liner. Decrement: mCurrentIndex = (mShowTipsTextBank.length + (mCurrentIndex - 1)) % mShowTipsTextBank.length; Increment: mCurrentIndex = (mCurrentIndex + 1) % mShowTipsTextBank.length;
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21017763

http://stackoverflow.com/q/20853488
upvote count: 2
has answer: http://stackoverflow.com/a/20853618
accepted answer: http://stackoverflow.com/a/20853618
favorite count: 0
tagged with: el
has body: I have three bean classes Animal , Dog and Pug (names changed for an example) class Animal { List <Dog> dogList; } class Dog { price; List<Pug> PugList; } class Pug { color; weight; } below is the jsp page : <c:forEach var="animal" items="${Animal.dogList}" varStatus="outerLoop"> <c:forEach var="dog" items="${animal.PugList}" varStatus="innerLoop"> color : </c:forEach> price : </c:forEach> I have a page where I have to display color and weight of all the Pugs including the price of the dog and there are 7 dog objects (static number) and 1-5 dog objects will have only one pug objects (static number) but 6th and 7th dog will have two pugs each (again static number). Here is my problem : so the <c:forEach> logic is working fine but the ids are not coming the way I want, I want all the pugs id different so that i can fetch the values by ids. the above code snippet will always give me pug attributes - colorid and weightid as 1 (colorid1 and weightid1) because 1-5 dog instance are having only one pug instance. and 5th and 6th dog instance are having two pugs each so they too should give me different ids so that i can fetch their values.
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/44721723
has answer: http://stackoverflow.com/a/44721723
type: Question
answer count: 2
tagged with: jstl
has title: generate dynamic ids for in foreach loop
tagged with: jsp

http://stackoverflow.com/q/20984836
has answer: http://stackoverflow.com/a/20984883
has body: I need execute the async task every time the app is opened or executed, because I use this Asyntask to fetch some json data from http and in every app execution Must be fresh data. Any idea how to force this? Thanks @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); etResponse = (TextView)findViewById(R.id.etResponse); etdia = (TextView)findViewById(R.id.dia); etmes = (TextView)findViewById(R.id.mes); // check if you are connected or not if(isConnected()){ } new HttpAsyncTask().execute("URL TO EXECUTE"); }
accepted answer: http://stackoverflow.com/a/20984849
tagged with: android
type: AnsweredQuestion
tagged with: java
type: Question
has title: Force asynctask to exeute every time app is opened
possible better answer: http://stackoverflow.com/a/20984883
score: 0
has answer: http://stackoverflow.com/a/20984849
answer count: 2

http://stackoverflow.com/comment/139987959
has text: I suspect that the behaviour described in the question comes from an extra digit in front of the string, for example `001062014`. This answer handles that case badly, yielding `december 10, 62013` on my computer. The OP needs better validation, and `SimpleDateFormat` never helped much in that respect. Fortunately `SimpleDateFormat` and related classes were obsoleted with java.time in Java 8 a few months after this answer was written.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/20962295

http://stackoverflow.com/comment/31504287
score: 1
comment on: http://stackoverflow.com/q/20970565
has text: You misspelled _french_ twice in your question, but not in your code. Did you write this?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31317753
type: Comment
comment on: http://stackoverflow.com/a/20871508
has text: This is how i am calling List messages = session.getNamedQuery("NotificationDetails") .setParameter("City", city) .list(); for (int i = 0; i < messages.size(); i++) { Message message = (Message)messages.get(i); System.out.println(message.getMerchant_id()); }
type: AnswerComment
score: 0

http://stackoverflow.com/q/20952872
has answer: http://stackoverflow.com/a/20953265
tagged with: rest
upvote count: 1
tagged with: wadl
answer count: 1
favorite count: 0
has title: Can the wadl file be generated at build time?
has body: I am using Jersey. My wadl files are accessible once my code is deployed and my web server is up and running, but I would like to generate the wadl file at build time so I can perform operations on it with other build targets. I see that the Jersey folks made a Maven plugin for this, but I am using Ant. How can I do this?
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/20953265
tagged with: jersey
tagged with: ant

http://stackoverflow.com/q/21017094
has body: I have a program that uses two JTables, with two buttons to transfer information between them, E.G: _____ _____ | | | | | A | Button 1 (&gt;&gt;&gt;) | B | | | Button 2 (&lt;&lt;&lt;) | | |_____| |_____| The aim of this is to transfer information between the records that update a database table, which all works fine. Then I tried to incorporate the drag and drop function. The drag and drop function only applies to Table B. It works perfectly on initialization when Table B does not have any records to populate immediately and you update it using Table A. When you transfer any in to them from Table A, you can drag and drop rows easily and the first column is sorted numerically. I have incorporated methods to automatically update the fields in the first column to increment in tens. i.e 10, 20, 30, 40 etc. The bug comes into play when the table is initialized with existing information. When you try to drag and drop a row, two rows become identical using the same number of indices. E.G Index | First Column Value | ID | ( remaining columns omitted) 0 10 1 1 20 2 2 30 3 3 40 4 Lets say I move index 3 to index 1, the table would become: Index | First Column Value | ID | ( remaining columns omitted) 0 10 1 1 20 4 2 20 4 3 30 3 The thing is, this doesn't update this way in the database, it is updated still using the ID of 2 with the column value, even though this will not show in the table. Code for DnD functionality: TableRowTransferHandler: private int[] rows = null; private int addIndex = -1; //Location where items were added private int addCount = 0; //Number of items added. private int max = 0; private final DataFlavor localObjectFlavor; private Object[] transferedObjects = null; private JComponent source = null; private JTable table; TableRowSorter&lt;TableModel&gt; sorter; public TableRowTransferHandler(TableRowSorter&lt;TableModel&gt; sorter) { this.sorter = sorter; localObjectFlavor = new ActivationDataFlavor( Object[].class, DataFlavor.javaJVMLocalObjectMimeType, "A…
type: Question
has title: Bug in JTable - same value appear after drag and drop
tagged with: jtable
accepted answer: http://stackoverflow.com/a/21558747
score: 0
has comment: http://stackoverflow.com/comment/31595544
has comment: http://stackoverflow.com/comment/31606984
answer count: 1
has comment: http://stackoverflow.com/comment/31595787
tagged with: drag-and-drop
has comment: http://stackoverflow.com/comment/31589819
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21558747
tagged with: java
tagged with: swing

http://stackoverflow.com/q/21005775
tagged with: unit-testing
type: Question
has answer: http://stackoverflow.com/a/21005996
tagged with: java
tagged with: easymock
score: 15
answer count: 1
has title: EasyMock: Get real parameter value for EasyMock.anyObject()?
has body: In my unit tests I'm using EasyMock for creating mock objects. In my test code I have something like this EasyMock.expect(mockObject.someMethod(anyObject())).andReturn(1.5); So, now EasyMock will accept any call to someMethod(). Is there any way to get real value that is passed to mockObject.someMethod(), or I need to write EasyMock.expect() statement for all possible cases?
favorite count: 0
has comment: http://stackoverflow.com/comment/31569622
has comment: http://stackoverflow.com/comment/31569553
upvote count: 15
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/21005996

dao
tags question: http://stackoverflow.com/q/20856153
tags question: http://stackoverflow.com/q/20892680
tags question: http://stackoverflow.com/q/20972877
type: Tag
tag name: dao
tags question: http://stackoverflow.com/q/20919158
tags question: http://stackoverflow.com/q/20955627
tags question: http://stackoverflow.com/q/20888794
tags question: http://stackoverflow.com/q/20885056

http://stackoverflow.com/a/20918570
has body: This sounds like it may be Eclipse bug 372654. This is marked as fixed in Eclipse 3.8 / 4.3 (Kepler)
score: 0
has comment: http://stackoverflow.com/comment/31459641
has comment: http://stackoverflow.com/comment/31495921
has comment: http://stackoverflow.com/comment/31436724
has comment: http://stackoverflow.com/comment/31550678
has comment: http://stackoverflow.com/comment/31433645
has comment: http://stackoverflow.com/comment/31549739
answers question: http://stackoverflow.com/q/20917832
type: Answer
has comment: http://stackoverflow.com/comment/31551202
has comment: http://stackoverflow.com/comment/31455687

http://stackoverflow.com/q/20960983
linked to: http://stackoverflow.com/q/17533280
favorite count: 0
tagged with: resteasy
tagged with: rest
tagged with: unmarshalling
has title: How do I make a RESTful service handle custom object in the Response?
score: 2
has answer: http://stackoverflow.com/a/21101746
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31487157
type: Question
has body: How do I make custom object in a restful Response look like a native type. In other words, I don't want to use a getter and setter, but rather have the object marshal and unmarshall like a string. I can use a constructor for unmarshall, but I don't know how to get the object through the Response of the service. When I run the sample, I get this result: 123 <myType/> def I am trying to get myType to look like nType. Here is a short code example: package rscust; import java.util.HashSet; import java.util.Set; import javax.ws.rs.*; import javax.ws.rs.core.*; import javax.xml.bind.annotation.XmlRootElement; @Path("/") public class Service extends Application { @XmlRootElement public static class Data { public String nType; public MyType myType; public NotMyType notMyType; public Data() {} } // custom class does not work in Response public static class MyType { private String value; public MyType() {} public MyType(String value) { this.value=value; } public String toString() { return value; } } // works with getter and setter, but I don't want that public static class NotMyType { private String value; public NotMyType() {} public NotMyType(String value) { this.setValue(value); } public String getValue() { return value; } public void setValue(String value) { this.value = value; } } @GET @Produces(value={MediaType.APPLICATION_XML}) public Response get( @QueryParam(value = "ntype")String nType, @QueryParam(value = "mytype")MyType myType, @QueryParam(value = "notmytype")NotMyType notMyType ) { Data data = new Data(); data.nType = nType; data.myType = myType; data.notMyType = notMyType; return Response.ok().entity(data).build(); } private HashSet<Object> singletons; public Service() { super(); singletons = new HashSet<Object>(); singletons.add(this); } public Set<Object> getSingletons() { return singletons; } }
tagged with: java
tagged with: marshalling
upvote count: 2
has comment: http://stackoverflow.com/comment/31487023
has answer: http://stackoverflow.com/a/20961133
answer count: 2
has comment: http://stackoverflow.com/comment/31487032

http://stackoverflow.com/a/20966783
has comment: http://stackoverflow.com/comment/31528672
has comment: http://stackoverflow.com/comment/31531681
type: Answer
has body: This is how to do it without valueOf in generally O(1): public enum XStatus { ; private XStatus() { XResult xr = Helper.NAMES.get(this.name()); // do whatever with } static { Helper.NAMES = null; // get rid of the map } // after the constants are instantiated private static class Helper { static Map&lt;String, XResult&gt; NAMES = new HashMap&lt;String, XResult&gt;(); static { for(XResult xr : XResult.values()) { NAMES.put(xr.name(), xr); } } } } Note that this is basically the same as valueOf but you don't have to try-catch. Of course valueOf only throws RuntimeExceptions so you only have to catch if you have constants that do not parallel XResult. Also, just throwing this out there, a more automatic solution would be something like this: public final class XStatus { private XStatus(XResult xr) { // } private static final XStatus[] TABLE; // or an EnumMap // with Collections.unmodifiableMap static { XResult[] xrValues = XResult.values(); TABLE = new XStatus[xrValues.length]; for(XResult xr : xrValues) { TABLE[xr.ordinal()] = new XStatus(xr); } } public static XStatus xStatusFor(XResult xr) { return TABLE[xr.ordinal()]; } } That will mirror XResult 1:1 without relying on any kind of String evaluation. You need an XResult to retrieve its corresponding constant but that's the point. Also if for some reason XResult were to change outside of your control you don't need to change XStatus.
score: 0
answers question: http://stackoverflow.com/q/20963142
has comment: http://stackoverflow.com/comment/31511014
has comment: http://stackoverflow.com/comment/31510772

http://stackoverflow.com/comment/31385397
comment on: http://stackoverflow.com/a/20907949
score: 0
type: AnswerComment
type: Comment
has text: So how would I use `@Max` to validate a `BigDecimal` with `7,2`?

http://stackoverflow.com/a/20958390
type: Answer
score: 6
upvote count: 6
answers question: http://stackoverflow.com/q/20958350
has body: All you want is if (condition) value = !value; No need to bring the conditional operator in; that would just be unnecessary clutter. The reason this would be preferable over value = condition ? !value : value; is because the above performs an assignment irrespective of condition's value; if condition is false, we just assign value to itself. This works as well, but isn't really what you want logically. You want to invert value (i.e. perform an assignment) if condition is true. I would argue that the the second variant is simply a misuse of the conditional operator. Beyond that, the first variant is certainly more readable and easier to follow.
downvote count: 0

http://stackoverflow.com/comment/31332600
type: Comment
has text: ... although if you're getting at the fact that `valueOf(long)` caches -128L to 127L, yeah that would be a difference and slight reason to prefer the boxing.
score: 0
comment on: http://stackoverflow.com/a/20879247
type: AnswerComment

http://stackoverflow.com/a/20871779
upvote count: 10
has body: That is a design decision. Normally you wouldn't do that. But if you think it is crucial for the user of your code to catch an Exception, then it is a way to hint him doing that. Another way would be to just add it to the documentation, and explain why it is important to catch the Exception.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20871763
score: 10

session-timeout
type: Tag
tags question: http://stackoverflow.com/q/20923882
tag name: session-timeout

http://stackoverflow.com/comment/34469512
comment on: http://stackoverflow.com/a/22633677
type: AnswerComment
type: Comment
has text: You can find a good OSGi tutorial here: http://www.vogella.com/tutorials/OSGi/article.html
score: 1

http://stackoverflow.com/comment/31550049
type: QuestionComment
comment on: http://stackoverflow.com/q/20993591
score: 0
has text: I've just run a test using the same headers that you've specified above and the csv file is decompressed fine for me in both Chrome/Firefox. However, I'm running Ubuntu, not Windows. Perhaps it's a platform (Windows specific) issue?
type: Comment

http://stackoverflow.com/a/20925435
answers question: http://stackoverflow.com/q/20895982
type: Answer
has body: I can still not call non-static functions, but a work around is using the singelton pattern which restricts the instantiation of a class to one object and call static functions that are able to call non-static methods. This is done by adding a class/object reference to itself in the constructor: private static MyActivity m_instance; public MyActivity() { m_instance = this; } It is now possible to call non-static functions in static functions. For example the non-static function bluetoothConnect() above can now be rewritten as: public static void connectBluetooth() { Log.d(QtApplication.QtTAG, "connectBluetooth() entered"); m_instance.bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if(m_instance.bluetoothAdapter == null) { Log.d(QtApplication.QtTAG, "Bluetooth adapter is not found"); return; } if(!m_instance.bluetoothAdapter.isEnabled()) { Log.d(QtApplication.QtTAG, "Bluetooth is off"); Intent enableBluetoothIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); m_instance.startActivityForResult(enableBluetoothIntent, ENABLE_BLUETOOTH_REQUEST); } else { Log.d(QtApplication.QtTAG, "Bluetooth is on"); m_instance.startDiscovery(); } } The only difference here is adding the static keyword to the method and adding "m_instance." before every non-static method call. This function can now be called from C++ as a static functions: QAndroidJniObject::callStaticMethod&lt;void&gt;("org/qtproject/qt5/android/bindings/MyActivity", "connectBluetooth"); I guess the downside since this is a singleton is that only one object of this class can be made, but as far as I see it will not limit much.. This was just a workaround, I'm still very interested on how I can call non-static functions. This answer will not be accepted as the accepted answer.
score: 0

http://stackoverflow.com/q/20902342
favorite count: 0
has comment: http://stackoverflow.com/comment/31374438
type: Question
upvote count: 2
tagged with: regex
tagged with: java
linked to: http://stackoverflow.com/q/560263
has title: Approximate Regular Expression Equivalence
downvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/31374363
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20902518
has comment: http://stackoverflow.com/comment/31374469
has comment: http://stackoverflow.com/comment/31374305
has comment: http://stackoverflow.com/comment/31374560
has body: Theoretically regex equivalence is a hard problem having naive solution with exponential space and time complexity. But for practical purposes, is there an approximate equivalence measure for regexes? I'm thinking about generating random strings from first regex and then checking it against the other and then repeat it the other way. Is there a more elegant check available? Relevant links: Regular expressions Equivalence https://cstheory.stackexchange.com/questions/20401/sub-optimal-regex-equivalence PS : I want to code the approach in java though general solutions and ideas are welcome.
has comment: http://stackoverflow.com/comment/31374494
score: 1

http://stackoverflow.com/q/20901021
has comment: http://stackoverflow.com/comment/31379566
favorite count: 0
has comment: http://stackoverflow.com/comment/31372189
type: UnansweredQuestion
has body: public class frame extends JFrame { /** * Creates new form frame8 */ public frame8() { initComponents(); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); jMenu2 = new javax.swing.JMenu(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jMenu1.setText("File"); jMenuBar1.add(jMenu1); jMenu2.setText("Edit"); jMenuBar1.add(jMenu2); setJMenuBar(jMenuBar1); pack(); }// &lt;/editor-fold&gt; /** * @param args the command line arguments */ 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(frame8.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(frame8.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(frame8.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(frame8.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() { new frame8().setVisible(true); } }); } // Variables declaration - do not modify priv…
has comment: http://stackoverflow.com/comment/31372934
has title: how could i set menu bar position in middle using netbeans ide
has comment: http://stackoverflow.com/comment/31379539
has comment: http://stackoverflow.com/comment/31378597
tagged with: swing
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/20906696
tagged with: java
score: -1
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/20901312
has comment: http://stackoverflow.com/comment/31372272

http://stackoverflow.com/comment/31450350
score: 0
comment on: http://stackoverflow.com/q/20941658
type: Comment
type: QuestionComment
has text: Same exception: `com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "38991692" (class WikipediaPages), not marked as ignorable (one known property: "wikipediaPageMap"])`.

http://stackoverflow.com/comment/31433118
has text: @JBNizet Can you give me some references? I didn't know that s1+s2+s3+s4+... is actually done using StringBuilder.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20932739

http://stackoverflow.com/q/20863253
answer count: 2
duplicate of: http://stackoverflow.com/q/10705705
score: 0
has answer: http://stackoverflow.com/a/20864537
has comment: http://stackoverflow.com/comment/31302010
tagged with: dictionary
has title: java set Map contents in constructor
tagged with: constructor
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/20863500
tagged with: java
has body: Is there a way in java to specify the elements in a Map when calling the Map's constructor? As an example of what I mean, let's say I want a map of the following key/value pairs: foo: bar baz: bat I can add them to an existing Map like this: Map&lt;String, String&gt; myMap = new HashMap&lt;String, String&gt;(); myMap.put("foo", "bar"); myMap.put("baz", "bat"); Is there a way to do something like this (with object literals borrowed from javascript as a substitute for what I want): Map&lt;String, String&gt; myMap = new HashMap&lt;String, String&gt;({"foo": "bar", "baz": "bat"}); The reason I ask (in case it makes a difference), is that I want to pass a bunch of HashMaps in-line to a function call, and it would be quite convenient if I didn't have to create variables to hold them and add elements to each one, one at a time. I'm considering using a JSON parser and writing my Maps as javascript objects to save time, but it would a bit silly if that was really the optimal way to do this.

http://stackoverflow.com/a/20942347
has comment: http://stackoverflow.com/comment/31473267
has comment: http://stackoverflow.com/comment/31474395
has comment: http://stackoverflow.com/comment/31452567
upvote count: 3
has body: A better solution (IMO) would be to make lastIdUsed an instance field of the PhoneBook class. It sounds like you are already serializing an instance of that class ... FWIW - making lastIdUsed an instance field of Person is just bad object modelling. The field is almost never going to be useful and almost never going to have a valid value. It will only have a valid value in the case of the first serialized Person in a PhoneBook.
has comment: http://stackoverflow.com/comment/31452088
has comment: http://stackoverflow.com/comment/31451835
score: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31452469
answers question: http://stackoverflow.com/q/20942291
type: Answer
accepted answer of: http://stackoverflow.com/q/20942291
has comment: http://stackoverflow.com/comment/31473504

http://stackoverflow.com/q/20919158
has body: How to design a CRUD app, with DAOs and Service layers without dependency injection in java. I'm trying to do a skeleton web app with servlets and jsp only. I tried this way, Please suggest any betterment is possible, with respect to more daos, services and a web app perspective. public interface UserDAO { public void create(User user); public void update(User user); ... } public class UserDAOJDBC implements UserDAO { private DAOFactory daoFactory; public UserDAOJDBC(DAOFactory daoFactory) { this.daoFactory = daoFactory; } public void create(User user) { Connection connection = null; PreparedStatement preparedStatement = null; ResultSet generatedKeys = null; try { connection = daoFactory.getConnection(); preparedStatement = connection.prepareStatement(..); preparedStatement.executeUpdate(); } catch (SQLException e) { ... } finally { ... } } .... } public abstract class DAOFactory { public static DAOFactory getInstance(String dbnAPI){ DAOFactory instance; instance = new DriverManagerDAOFactory(url, username, password); return instance; } abstract public Connection getConnection() throws SQLException; abstract public UserDAO getUserDAO(); } public class DriverManagerDAOFactory extends DAOFactory { private String url; private String username; private String password; public DriverManagerDAOFactory(String url, String username, String password) throws SQLException { this.url = url; this.username = username; this.password = password; } @Override public Connection getConnection() throws SQLException { return DriverManager.getConnection(url, username, password); } @Override public UserDAO getUserDAO() { return new UserDAOJDBC(this); } } public interface UserService { public void createUser(User user); public void updateUser(User user); ... } public class UserServiceImpl implements UserService { private DAOFactory daoFactory = null; public UserServiceImpl(DAOFactory daoFactory) { this.daoFactory = daoFactory; } public void createUser(User user) { UserDAO userDAO = daoFactory…
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/49324648
upvote count: 2
tagged with: java
tagged with: service-layer
type: UnansweredQuestion
tagged with: dao
score: 2
has title: dao and service layer without dependency injection in java
answer count: 0
downvote count: 0

http://stackoverflow.com/q/20911395
downvote count: 0
tagged with: solr
has answer: http://stackoverflow.com/a/20911994
accepted answer: http://stackoverflow.com/a/20911994
has answer: http://stackoverflow.com/a/20911733
type: Question
has comment: http://stackoverflow.com/comment/31393529
tagged with: java
has comment: http://stackoverflow.com/comment/31392283
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/31392539
possible better answer: http://stackoverflow.com/a/20911733
has body: I try to understand solr official tutorial. I make query: http://localhost:8983/solr/collection1/select/?indent=on&q=*&fl=name,id and see next response: 0 125 name,id on * ... ... ... ... ... ... ... ... ... ... why is numfound equals 28 but doc number is 10?
has title: solr. what does it mean numfound?
favorite count: 0
score: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/31418279
has text: I was just asking about that piece of code specifically. I'm pretty new to coding myself, and I was trying to figure out the specific reason that code was applied there. If you check my rep, Im new to the forums to. I would've commented my question, but I can't comment yet
comment on: http://stackoverflow.com/a/20924649
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/a/21003472
has body: I think I may have found my answer, thanks to @petey. Paint colorMultiplier = new Paint(); colorMultiplier.setColorFilter(new PorterDuffFilter(Color.parseColor("#123456"), PorterDuff.Mode.MULTIPLY)); canvas.drawBitmap(alphaMask, 0, 0, colorMultiplier);
answers question: http://stackoverflow.com/q/21002932
score: 0
type: Answer

http://stackoverflow.com/q/20876684
type: UnansweredQuestion
upvote count: 1
tagged with: swing
downvote count: 1
has title: Memory Leaks in Java (Swing)
has answer: http://stackoverflow.com/a/20878632
has comment: http://stackoverflow.com/comment/31327849
tagged with: java
has comment: http://stackoverflow.com/comment/31327574
has comment: http://stackoverflow.com/comment/31327233
type: Question
has comment: http://stackoverflow.com/comment/31327352
has body: My custom JPanel is retaining a large number of int arrays, as seen below in YourKit: (source: gyazo.com) I assumed this was the result of Graphic objects being undisposed of, but even with disposing every graphics object I use, the memory issues still occur. The garbage collector will remove the objects if I force a heap dump (and the arrays are marked as unreachable). The behaviour causes Java to reach a high memory allocation (~700MB) however. Are there any other common sources of this sort of issue in swing/JPanels?
score: 0
has comment: http://stackoverflow.com/comment/31327208
tagged with: memory-leaks
answer count: 1
favorite count: 0

button
tags question: http://stackoverflow.com/q/20910838
tags question: http://stackoverflow.com/q/20931284
tags question: http://stackoverflow.com/q/20861373
tags question: http://stackoverflow.com/q/20956538
tags question: http://stackoverflow.com/q/20854796
tags question: http://stackoverflow.com/q/20911466
tags question: http://stackoverflow.com/q/20953307
tags question: http://stackoverflow.com/q/20985622
tags question: http://stackoverflow.com/q/20987701
tags question: http://stackoverflow.com/q/21006570
tags question: http://stackoverflow.com/q/20867021
type: Tag
tags question: http://stackoverflow.com/q/20862199
tags question: http://stackoverflow.com/q/20853740
tag name: button
tags question: http://stackoverflow.com/q/20901149
tags question: http://stackoverflow.com/q/20886415

compression
tags question: http://stackoverflow.com/q/20919856
tags question: http://stackoverflow.com/q/21002163
tag name: compression
tags question: http://stackoverflow.com/q/20979312
tags question: http://stackoverflow.com/q/20917623
type: Tag

http://stackoverflow.com/q/20874238
score: 7
tagged with: java
tagged with: multithreading
has answer: http://stackoverflow.com/a/20874295
upvote count: 7
has title: System.nanoTime vs System.currentTimeMillis
has answer: http://stackoverflow.com/a/20875065
has body: According to its documentation, System.nanoTime returns nanoseconds since some fixed but arbitrary origin time. However, on all x64 machines I tried the code below, there were time jumps, moving that fixed origin time around. There may be some flaw in my method to acquire the correct time using an alternative method (here, currentTimeMillis). However, the main purpose of measuring relative times (durations) is negatively affected, too. I came across this problem trying to measure latencies when comparing different queues to LMAX's Disruptor where I got very negative latencies sometimes. In those cases, start and end timestamps were created by different threads, but the latency was computed after those threads had finished. My code here takes time using nanoTime, computes the fixed origin in currentTimeMillis time, and compares that origin between calls. And since I must ask a question here: What is wrong with this code? Why does it observe violations of the fixed origin contract? Or does it not? import java.text.*; /** * test coherency between {@link System#currentTimeMillis()} and {@link System#nanoTime()} */ public class TimeCoherencyTest { static final int MAX_THREADS = Math.max( 1, Runtime.getRuntime().availableProcessors() - 1); static final long RUNTIME_NS = 1000000000L * 100; static final long BIG_OFFSET_MS = 2; static long startNanos; static long firstNanoOrigin; static { initNanos(); } private static void initNanos() { long millisBefore = System.currentTimeMillis(); long millisAfter; do { startNanos = System.nanoTime(); millisAfter = System.currentTimeMillis(); } while ( millisAfter != millisBefore); firstNanoOrigin = ( long) ( millisAfter - ( startNanos / 1e6)); } static NumberFormat lnf = DecimalFormat.getNumberInstance(); static { lnf.setMaximumFractionDigits( 3); lnf.setGroupingUsed( true); }; static class TimeCoherency { long firstOrigin; long lastOrigin; long numMismatchToLast = 0; long numMismatchToFirst = 0; long numMismatchToFirstBig = 0; long numC…
type: Question
has comment: http://stackoverflow.com/comment/31323003
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/20875065
has comment: http://stackoverflow.com/comment/31355859
favorite count: 0
linked to: http://stackoverflow.com/q/510462
linked to: http://stackoverflow.com/q/66789144
tagged with: nanotime
has comment: http://stackoverflow.com/comment/31323401
has comment: http://stackoverflow.com/comment/31323024
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20874295

http://stackoverflow.com/a/20880470
type: Answer
upvote count: 7
score: 7
answers question: http://stackoverflow.com/q/20879258
downvote count: 0
has body: You are mixing JUnit 3 (junit.framework.*) and JUnit 4 (org.junit.*) code. The problem should disappear if you are using JUnit 4 only. Remove extends TestCase (they are simple not needed, because your tests are annotated with @Test. Add the @Before annotation to your setUp() methods. Use JUnit4's Suite: https://github.com/junit-team/junit/wiki/Aggregating-tests-in-suites

http://stackoverflow.com/comment/31542180
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20990565
has text: @blackbelt thank you dear. I have an answer below
score: 0

http://stackoverflow.com/comment/31471752
comment on: http://stackoverflow.com/a/20953140
type: AnswerComment
has text: There is something else at play. I call `session.flush()` before and after SP execution to make sure DB state is correct before SP execution and that the SP state is available back to the transaction (supposedly) after it has been executed.
score: 0
type: Comment

http://stackoverflow.com/comment/31409042
has text: @Omar,Do i need to make any changes in CopyDirectoryExample java program??
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20919295
type: Comment

http://stackoverflow.com/comment/31498062
has text: please post your LogCat here.
comment on: http://stackoverflow.com/q/20967264
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/31403393
score: 1
comment on: http://stackoverflow.com/q/20917088
type: QuestionComment
type: Comment
has text: You would have to ask the person that wrote the perfectly valid code.

http://stackoverflow.com/q/20903048
has body: Im trying to make a simple login system with php + a mysql database / java for android. For communication between both im using Json. I've the php code here: (A simple example of what i wanna archieve). &lt;?php include("../dbfunctions.php"); class mobilelogin{ private $user; private $pass; public function getData(){ $get-&gt;user = $_POST['user']; $get-&gt;pass = $_POST['pass']; return $get; } public function getDbData($user){ $dbfunctions = new dbfunctions; $getvalue = $this-&gt;getData(); return $dbfunctions-&gt;returnUser($user); // get pass by user } public function md5convert($user){ return md5($this-&gt;getDbData($user)); // convert this pass to md5 } public function check(){ // check everthing here $getvalue = $this-&gt;getData(); if(isset($getvalue-&gt;user) &amp;&amp; isset($getvalue-&gt;pass)) // everthing filled in { return "valid"; }else{ return "invalid"; } } public function response(){ // show data here in json format echo json_encode(array('result' =&gt; $this-&gt;check())); } } header("Content-Type: text/json"); $mobilelogin = new mobilelogin; echo $mobilelogin-&gt;response(); ?&gt; Like you see, im trying just a simple json post example, my result in json is this: { result:invalid } As you see, if the php code receives the post values from java it should display valid otherwise invalid. Now i've this android code, which does a post request: public void login(View v) throws ClientProtocolException, URISyntaxException, IOException, JSONException { HttpPost httppost = new HttpPost(processUrl); try { List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(2); nameValuePairs.add(new BasicNameValuePair("user", uservalidated)); nameValuePairs.add(new BasicNameValuePair("pass", passvalidated)); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); client.execute(httppost); Toast.makeText(getBaseContext(),"Everthing well.",Toast.LENGTH_LONG).show(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException…
answer count: 1
score: 0
tagged with: android
type: UnansweredQuestion
tagged with: php
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: mysql
has title: Get json info direct back from post request
type: Question
has answer: http://stackoverflow.com/a/20904046

http://stackoverflow.com/q/20971607
type: Question
upvote count: 3
tagged with: rest
answer count: 1
has body: I'm trying to test a restful web-service with SoapUI which has the following signature: @PUT @Path("{addressId}") @Consumes(MediaType.MULTIPART_FORM_DATA) public Response upload(@PathParam(PARAM_ADDRID) Long addressId, @FormDataParam("header") MultivaluedMap&lt;String, String&gt; header, @FormDataParam("file") InputStream inputStream) {... I'm not able to pass the "header"-param correctly. The "header"-param should not be sent into the header's request. That's why I defined that with the annotation @FormDataParam. This can't be changed. How can i achieve this?
favorite count: 0
has comment: http://stackoverflow.com/comment/33377311
has answer: http://stackoverflow.com/a/28696667
tagged with: soapui
accepted answer: http://stackoverflow.com/a/28696667
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/45682589
has title: Passing a form-data multivaluedmap parameter with SoapUI

http://stackoverflow.com/a/20863196
has body: You named your class Scanner. Name it something else, then add import java.util.Scanner; to your imports. Instead of accessing the library Scanner class you are trying to access your own class- which doesn't have any of the functionality you are trying to use.
type: Answer
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/20863160

http://stackoverflow.com/a/21003897
upvote count: 1
answers question: http://stackoverflow.com/q/21003353
downvote count: 0
type: Answer
has body: System.out.println(...) prints to the local console context only. If there is no local console you'll see no output. session.getBasicRemote().sendText(...); prints to a remote connection. They both perform a print of text, but to two entirely different targets.
score: 1

http://stackoverflow.com/a/21011731
has body: Create your own comparator in combination with Collections.Sort(collection, Comparator). The way this differs from a normal Comparator is that you have to explicitly give preference to the entries that you always want on top. public class Main { public static void main(String[] args) { new Main(); } public Main(){ List&lt;Country&gt; list = new ArrayList&lt;&gt;(); list.add(new Country("Belgium")); list.add(new Country("United Kingdom")); list.add(new Country("Legoland")); list.add(new Country("Bahrain")); list.add(new Country("United States of America")); list.add(new Country("Mexico")); list.add(new Country("Finland")); Collections.sort(list, new MyComparator()); for(Country c : list){ System.out.println(c.countryName); } } } class Country { public Country(String name){ countryName = name; } int id; String countryCode; String countryName; } class MyComparator implements Comparator&lt;Country&gt; { private static List&lt;String&gt; important = Arrays.asList("United Kingdom", "United States of America"); @Override public int compare(Country arg0, Country arg1) { if(important.contains(arg0.countryName)) { return -1; } if(important.contains(arg1.countryName)) { return 1; } return arg0.countryName.compareTo(arg1.countryName); } } Output: United States of America United Kingdom Bahrain Belgium Finland Legoland Mexico I misread your question at first (or it was added as a ninja edit) so here's the updated version.
answers question: http://stackoverflow.com/q/21011662
type: Answer
downvote count: 0
score: 10
has comment: http://stackoverflow.com/comment/92663868
upvote count: 10

http://stackoverflow.com/a/20942587
type: Answer
accepted answer of: http://stackoverflow.com/q/20941602
score: 0
type: AcceptedAnswer
has body: Similar to Turix's solution but without the C++ global variable. Have loadFile() return a file descriptor and pass this to getX(). You should also have a closeFile() method to close the opened file after all of the X values are retrieved. Since you have a lot a values you can also pass getX() a native array of doubles so it can retrieve many values in a single call. This is a different design but it would be much more efficient. Also, consider using SWIG to create your wrapper classes. It makes creating and managing the Java side much easier.
answers question: http://stackoverflow.com/q/20941602

http://stackoverflow.com/comment/31331544
comment on: http://stackoverflow.com/a/20878956
type: AnswerComment
score: 0
type: Comment
has text: @MrNice, I think OP is checking in real device 'Micromax A89 Ninja phone' as he mentioned in the question.

http://stackoverflow.com/comment/31455830
has text: Violating the contracts in these methods is a critical bug, and until you resolve it you cannot hope to have any sort of reliable behavior. You'll need to figure out this "somehow" before you can go any further.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/20944638
type: AnswerComment

http://stackoverflow.com/q/20991205
tagged with: java
tagged with: amazon-dynamodb
type: Question
has answer: http://stackoverflow.com/a/20991555
has comment: http://stackoverflow.com/comment/31542212
has comment: http://stackoverflow.com/comment/31542641
tagged with: eclipse
score: 0
has body: i am trying to run simple AWS project in Eclipse but not able to do that. I am very new with this. I have already followed all the step given in official site don,t know what i am missing. please if anyone who has already done this guide me. Thanks a ton.... Sample Code: https://github.com/naohta/java_hello_dynamodb Guidlines: http://aws.amazon.com/eclipse/faqs/#What_is_the_AWS_Toolkit_for_Eclipse &amp; http://aws.amazon.com/articles/3586?_encoding=UTF8&amp;jiveRedirect=1
upvote count: 1
has title: How to Set up AWS java project in Eclipse?
downvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/31542720
tagged with: amazon-web-services
favorite count: 0
has comment: http://stackoverflow.com/comment/31542307
type: UnansweredQuestion

http://stackoverflow.com/q/20903266
has title: HSQLDB function creating Caused by: org.hsqldb.HsqlException:
has answer: http://stackoverflow.com/a/20908507
score: 0
has body: ISSUE: I am using HSQLDB as inmemory database for my testing, I am able to execute tables fine, I am getting below exception when I tried to create the function and run. Exception: Caused by: org.hsqldb.HsqlException: error in script file line: 54 org.hsqldb.HsqlException: error in script file: CREATE FUNCTION get_mask() at org.hsqldb.error.Error.error(Unknown Source) Test script for hypersonic: SET DATABASE UNIQUE NAME HSQLDB2467A82B33 SET DATABASE GC 0 SET DATABASE DEFAULT RESULT MEMORY ROWS 0 SET DATABASE EVENT LOG LEVEL 0 SET DATABASE SQL NAMES FALSE SET DATABASE SQL REGULAR NAMES TRUE SET DATABASE SQL REFERENCES FALSE SET DATABASE SQL SIZE TRUE SET DATABASE SQL TYPES FALSE SET DATABASE SQL TDC DELETE TRUE SET DATABASE SQL TDC UPDATE TRUE SET DATABASE SQL TRANSLATE TTI TYPES TRUE SET DATABASE SQL CONCAT NULLS TRUE SET DATABASE SQL NULLS FIRST TRUE SET DATABASE SQL UNIQUE NULLS TRUE SET DATABASE SQL CONVERT TRUNCATE TRUE SET DATABASE SQL AVG SCALE 0 SET DATABASE SQL DOUBLE NAN TRUE SET DATABASE SQL LONGVAR IS LOB FALSE SET DATABASE TRANSACTION CONTROL LOCKS SET DATABASE DEFAULT ISOLATION LEVEL READ COMMITTED SET DATABASE TRANSACTION ROLLBACK ON CONFLICT TRUE SET DATABASE TEXT TABLE DEFAULTS '' SET FILES WRITE DELAY 0 SET FILES BACKUP INCREMENT FALSE SET FILES CACHE SIZE 10000 SET FILES CACHE ROWS 2000 SET FILES SCALE 64 SET FILES LOB SCALE 32 SET FILES DEFRAG 0 SET FILES NIO FALSE SET FILES NIO SIZE 256 SET FILES LOG TRUE SET FILES LOG SIZE 0 SET DATABASE SQL SYNTAX ORA TRUE CREATE USER SA PASSWORD DIGEST 'd41d8cd98f00b204e9800998ecf8427e' CREATE SCHEMA PUBLIC AUTHORIZATION DBA SET SCHEMA PUBLIC CREATE MEMORY TABLE PUBLIC.EMPLOYEEDETAILS(EMPNAME VARCHAR(20)) CREATE MEMORY TABLE PUBLIC.VW_OH_MKT_OFFERS(MKT_OFFER_UID VARCHAR(12) NOT NULL PRIMARY KEY,INTENT VARCHAR(3),LEGACY_OFFER_CODE VARCHAR(12),PRODUCT_LINE_CODE VARCHAR(10),STATUS VARCHAR(1),BEGIN_DATE DATE,END_DATE DATE,SOURCE_KEY_UID VARCHAR(12),SOURCE_KEY_CODE VARCHAR(20),PT_CODE VARCHAR(12),OFFER_GROUP_CODE V…
tagged with: junit
answer count: 1
tagged with: hsqldb
type: UnansweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/q/20920784
has comment: http://stackoverflow.com/comment/31410003
has answer: http://stackoverflow.com/a/20920859
has comment: http://stackoverflow.com/comment/31409788
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31409727
score: 3
has answer: http://stackoverflow.com/a/20920820
accepted answer: http://stackoverflow.com/a/20920819
has title: Intent.putExtra - How to send a string to the next activity?
upvote count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/20920859
has comment: http://stackoverflow.com/comment/31410073
tagged with: eclipse
has comment: http://stackoverflow.com/comment/31409663
type: Question
has answer: http://stackoverflow.com/a/20920800
has answer: http://stackoverflow.com/a/20920851
downvote count: 0
has answer: http://stackoverflow.com/a/20920840
answer count: 6
has comment: http://stackoverflow.com/comment/31409672
has comment: http://stackoverflow.com/comment/31409950
has comment: http://stackoverflow.com/comment/31410042
has comment: http://stackoverflow.com/comment/31409714
tagged with: android
has answer: http://stackoverflow.com/a/20920819
favorite count: 0
has body: OK, I create a simple string from some data entered by the user. I now want this data to passed as a string (CSV like string) across to the next activity. In one example I have seen this: intent.putExtra(EXTRA_MESSAGE, string_to_be_sent) But this throws an error saying EXTRA_MESSAGE isn't a value - ie. it is recognised by the intent. I think the example is outdated. What should I use to send a string? I have looked at documentation and found this: public Intent putExtra (String name, String value) But what would be the name of my value?? Anything I choose, or does it have to be a package name?? Thanks for the help :)
has comment: http://stackoverflow.com/comment/31409745
has comment: http://stackoverflow.com/comment/31410016
tagged with: android-intent

http://stackoverflow.com/a/20867890
has body: @Happy_New_Year is right. You are missing {} in else parts. If you don't put {}, then the only very next statement would be considered as the else part. The button.setEnabled(false); is outside of else block. So the button object is not being initialized here.
answers question: http://stackoverflow.com/q/20867021
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/20859430
possible better answer: http://stackoverflow.com/a/20860077
has answer: http://stackoverflow.com/a/20859610
accepted answer: http://stackoverflow.com/a/20859610
has comment: http://stackoverflow.com/comment/31300454
has comment: http://stackoverflow.com/comment/31301249
linked to: http://stackoverflow.com/q/161224
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20860077
tagged with: java
tagged with: hibernate
has body: I'm new to hibernate and trying to understand it better. I've been attempting to ingest data into my database and on my Track Table there is a unique constraint on the track_uuid. I've attempted to do just a save and catch the exception and move on to next insert however I started using up to many connections. So I started looking around and found that a session has a function saveOrUpdate. http://www.javabeat.net/difference-between-hibernates-saveupdate-and-saveorupdate-methods/ However when I change my save to saveOrUpdate I continue to get an error saying duplicate key value violates unique constraint "track_track_uuid_key". My code: /** * @param p_track the track to parse * @param p_dbTrackMessage the database track message * @param p_session the database session * @return {@link database.model.Track} Returns the ingested database track * @throws Exception error */ private static database.model.Track parseTrack(final Track p_track, final database.model.TrackMessage p_dbTrackMessage, final Session p_session) throws Exception { // the db track model final database.model.Track dbTrack = new database.model.Track(); // get and set track uuid dbTrack.setTrackUuid(p_track.getTrackUUID()); // get and set track number dbTrack.setTrackNumber(p_track.getTrackNumber()); // get and set the track excerise indicator dbTrack.setTrackExerciseIndicator(EnumDatabaseLoader.loadByName( TrackExerciseIndicator.class, p_track.getExerciseIndicator().name(), p_session)); // get and set track simulation indicator dbTrack.setTrackSimulationIndicator(EnumDatabaseLoader.loadByName( TrackSimulationIndicator.class, p_track.getSimulationIndicator().name(), p_session)); // get and set the track status final TrackStatus trackStatus = p_track.getTrackStatus(); if (trackStatus != null) { dbTrack.setTrackStatus(EnumDatabaseLoader.loadByName( database.model.TrackStatus.class, trackStatus.name(), p_session)); } try { p_session.getTransaction().begin(); // save the track p_session.save(dbTrack); // Err…
has comment: http://stackoverflow.com/comment/31294043
type: Question
answer count: 2
has title: How does Hibernates session.saveOrUpdate work?
score: 0

http://stackoverflow.com/comment/31303048
type: Comment
comment on: http://stackoverflow.com/q/20863805
score: 0
has text: Yeah waht is the physical properties of these images? Width, Height, color space?
type: QuestionComment

http://stackoverflow.com/comment/31559541
type: QuestionComment
score: 2
has text: The "most" efficient solution? Why are you implementing in such a high level language? Just use C, then you don't even have the ArrayList option.
comment on: http://stackoverflow.com/q/21000555
type: Comment

http://stackoverflow.com/q/21002537
has comment: http://stackoverflow.com/comment/31563139
downvote count: 6
type: AnsweredQuestion
has title: How does Java affect the client-side?
has answer: http://stackoverflow.com/a/21002592
possible better answer: http://stackoverflow.com/a/21002697
has body: I seem to be confused on a few levels of understanding Java, here is what I am curious about: Is Java a client-side and server-side language? Is it more a client-side or server-side, if both are applicable? I don't know if this is the correct way to put this, if it isn't, please kindly me inform me of where this question would do better. Thank you so much!
has comment: http://stackoverflow.com/comment/31563076
has answer: http://stackoverflow.com/a/21002697
has comment: http://stackoverflow.com/comment/31563131
type: Question
has answer: http://stackoverflow.com/a/21002649
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/31563258
has comment: http://stackoverflow.com/comment/31565274
has comment: http://stackoverflow.com/comment/31563340
upvote count: 4
has comment: http://stackoverflow.com/comment/31566941
answer count: 3
has comment: http://stackoverflow.com/comment/31563134
has comment: http://stackoverflow.com/comment/31563090
has comment: http://stackoverflow.com/comment/31563336
has comment: http://stackoverflow.com/comment/31563697
favorite count: 0
accepted answer: http://stackoverflow.com/a/21002649
has comment: http://stackoverflow.com/comment/31563860

http://stackoverflow.com/a/20933350
type: Answer
answers question: http://stackoverflow.com/q/20933260
downvote count: 0
score: 1
has body: You have to set all the values in ABArray to zero every time you start to work inside the while loop. Right now on the third time you start the while loop (with AABB input) you still keep the values which were left from the previous run of the loop - 5 in the 0-indexed element of an array and 6 in the 1-indexed element of an array, thus the program gives you the wrong output.
upvote count: 1

http://stackoverflow.com/a/21011275
accepted answer of: http://stackoverflow.com/q/21011048
has comment: http://stackoverflow.com/comment/31580052
upvote count: 2
answers question: http://stackoverflow.com/q/21011048
has body: Method cannot be resolved simply means Eclipse cannot find the method definition. You have probably not loaded the jar file correctly in eclipse. To do so, add the Jar file as a reference library in your Eclipse project. Also, in your source code, import the necessary class from the jar file using import [classname]. You can actually open the jar file in eclipse and look inside it to find the correct class you need. This is really helpful to get the syntax write. An import may look like this import com.myjar.className To add a jar file look here
has comment: http://stackoverflow.com/comment/31580018
score: 2
has comment: http://stackoverflow.com/comment/31580005
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31580028
has comment: http://stackoverflow.com/comment/31581807
type: Answer

http://stackoverflow.com/comment/31278231
score: 1
type: Comment
type: QuestionComment
has text: Posting a runnable example will rove the guess work from the answers...
comment on: http://stackoverflow.com/q/20850845

http://stackoverflow.com/comment/31449026
comment on: http://stackoverflow.com/a/20940511
score: 0
type: Comment
has text: using getDrawable leads to this: putInt (String,int) in Bundle cannot be applied to (String, android.graphics.drawable.Drawable)
type: AnswerComment

http://stackoverflow.com/comment/31567473
score: 0
comment on: http://stackoverflow.com/q/21004775
type: Comment
type: QuestionComment
has text: Implement `interface Comparable` then use Collections.sort(yourList) make null greater than not null and you will get version 2 of your list.

http://stackoverflow.com/comment/52431815
type: Comment
has text: The corrected answer (using `floor` instead of `(int)`) is better. But the comparison should be to `0.0005` rather than `0.001`. REASON: Values that *round* to a whole number (when keeping 3 decimal digits) should be considered whole. If the value *rounds* to a non-whole, it should not be considered whole. For example, the input `1.00099` would round to `1.001`, and that is how it should be displayed.
type: AnswerComment
comment on: http://stackoverflow.com/a/20913616
score: 0

http://stackoverflow.com/a/20978326
has body: If I understand what you're after, you could use something like this pruneList method public static void pruneList(java.util.List&lt;String&gt; al, String match) { java.util.Iterator&lt;String&gt; iter = al.iterator(); while (iter.hasNext()) { if (iter.next().contains(match)) { continue; } iter.remove(); } } public static void main(String[] args) { String[] arr = { "name1 info A", "name2 info B", "name3 info C", "name4 info A" }; java.util.List&lt;String&gt; al = new java.util.ArrayList&lt;String&gt;( java.util.Arrays.asList(arr)); System.out.println("Before pruning"); System.out.println(al); pruneList(al, "A"); System.out.println("After pruning"); System.out.println(al); } Which outputs Before pruning [name1 info A, name2 info B, name3 info C, name4 info A] After pruning [name1 info A, name4 info A]
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20978138
upvote count: 1
score: 1

http://stackoverflow.com/a/38917244
answers question: http://stackoverflow.com/q/20873034
type: Answer
has body: You can also use the tools such as WYSIWYG (i.e. What You See IS What You Get). Where without knowledge of ui you can still design ui.
score: 0

http://stackoverflow.com/comment/31556656
score: 0
comment on: http://stackoverflow.com/q/20999164
type: QuestionComment
has text: you can select the part you want to format and then press `CTRL + SHIFT + f` so only the selected part gets formated
type: Comment

http://stackoverflow.com/q/20929618
has body: Ok so im new to programming GUIs in Java and I need some help on how to add buttons and Labels. I went around looking at an example and I figured it this was how it worked to basically add a button: import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; public class GUI_Tests extends JFrame{ public static void main(String[] args){ private JButton button; button = new JButton("pls work"); add(button); } } Well that didnt work at all... Can someone show me how its done and give me some pointers?
tagged with: swing
has answer: http://stackoverflow.com/a/20929652
tagged with: jbutton
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20929699
tagged with: user-interface
has comment: http://stackoverflow.com/comment/31427334
score: 0
answer count: 5
has title: Java GUI Help (JFrame, JButton, etc)
has answer: http://stackoverflow.com/a/20929674
has answer: http://stackoverflow.com/a/20929733
has answer: http://stackoverflow.com/a/20929682
tagged with: jframe
type: UnansweredQuestion

http://stackoverflow.com/q/20908697
has comment: http://stackoverflow.com/comment/31387400
has answer: http://stackoverflow.com/a/20920633
downvote count: 0
has answer: http://stackoverflow.com/a/20920834
has body: I'm implementing an enterprise application using spring mvc and hibernate. The application architecture is composed by the following layers: View Controller Service Domain Peristence The data access is implemented with classic dao pattern and allows CRUD operations + generic queries. Where should I implement specific queries? I guess two solutions: implement specific queries in the service layer by creating hibernate criteria and passing it to the persistence layer implement specific queries in DAO classes by create a function for each query and call the functions in the service layer. What should I do? Are there better solutions?
favorite count: 0
possible better answer: http://stackoverflow.com/a/20909831
answer count: 5
has answer: http://stackoverflow.com/a/20909831
tagged with: spring
tagged with: spring-mvc
accepted answer: http://stackoverflow.com/a/20920633
type: AnsweredQuestion
upvote count: 3
has answer: http://stackoverflow.com/a/20909644
has answer: http://stackoverflow.com/a/20909421
has comment: http://stackoverflow.com/comment/31386775
tagged with: java
tagged with: hibernate
type: Question
score: 3
has title: Where should I implement specific queries in mvc architecture(spring + hibernate)?
has comment: http://stackoverflow.com/comment/31387561

http://stackoverflow.com/comment/31530459
score: 0
comment on: http://stackoverflow.com/q/20983834
type: Comment
type: QuestionComment
has text: int numberofcharacters = Tobeencrypted.length(); is line 43 in eclipse

http://stackoverflow.com/comment/31513862
score: 0
comment on: http://stackoverflow.com/q/20975859
has text: Yes. But they're conventions and not universal truths. I would just group by access modifier, but some people prefer to define things before they are called.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20960004
has comment: http://stackoverflow.com/comment/31485119
has answer: http://stackoverflow.com/a/20960343
has comment: http://stackoverflow.com/comment/31485023
type: Question
tagged with: vector
accepted answer: http://stackoverflow.com/a/20960343
has body: I have a java class with a number of vectors I use this line to add elements from a database... public void addUserSet(ResultSet userData){ int i = 0; while (accountData.next()){ userID.addElement(new String(userData.getString("User_ID"))); i++; } } also I intend to call it within a jsp page... % getUserSet(index); %> I want to be able to save userID.get(someElement) as a string. not for a System.out.println() which I've seen a lot of but to save as a string so it can be manipulated like a string. What would be the simplest method of doing that?
tagged with: database
tagged with: jsp
score: 0
answer count: 1
tagged with: string
type: AnsweredQuestion
tagged with: java
has title: convert java vector element into a string

http://stackoverflow.com/q/20993033
accepted answer: http://stackoverflow.com/a/20993217
has comment: http://stackoverflow.com/comment/31545395
has title: Accessing Class Object before initializing in Android
has body: I have a class named ItemsAdapter where I have three arguments and I am instantiating this class in another class named ItemsActivity.While doing so, I need to put up all the three arguments and the last argument is where I am gonna pass a method known as getImages() which is in the same class ItemsAdapter. I can access this only by using the ItemsAdapter object but it's not feasible. This is what I have tried : CODE : ItemsAdapter mAdapter = null; ArrayList&lt;String&gt; image_items = mAdapter.getImages(); mAdapter = new ItemsAdapter(this,R.layout.item,image_items); UPDATE : public ArrayList&lt;String&gt; getImages() { String path = android.os.Environment.getExternalStorageDirectory() + "/Pictures/SanPics2/"; File mainfolder = new File(path); ArrayList&lt;String&gt; files = new ArrayList&lt;String&gt;(); if(mainfolder.listFiles() == null) return null; for(File f : mainfolder.listFiles()) { if(f.getName().contains(".jpg")) { files.add(f.getAbsolutePath()); } } return files; } This is the method which I am trying to access. It throws NullPointerException as predicted. Is there a another way around this where I can access the method getImages() in ItemsAdapter class. Apologies if the question is dumb(i know it is) but I am just a beginner to programming and stuffs. Any idea on how to achieve this would be highly appreciated. Thanks in advance.
has comment: http://stackoverflow.com/comment/31545523
possible better answer: http://stackoverflow.com/a/20993108
has comment: http://stackoverflow.com/comment/31545467
has answer: http://stackoverflow.com/a/20993217
has answer: http://stackoverflow.com/a/20993108
tagged with: android
has comment: http://stackoverflow.com/comment/31545729
has comment: http://stackoverflow.com/comment/31545762
has comment: http://stackoverflow.com/comment/31545451
has comment: http://stackoverflow.com/comment/31545392
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31545633
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31545876
has comment: http://stackoverflow.com/comment/31545469
has comment: http://stackoverflow.com/comment/31545577
has answer: http://stackoverflow.com/a/20993169
score: 0
answer count: 3

http://stackoverflow.com/comment/31450277
score: 0
type: Comment
type: QuestionComment
has text: Correct, this is the only thing I am doing with XML. If possible, I want to avoid use a whole parsing library.
comment on: http://stackoverflow.com/q/20941650

http://stackoverflow.com/q/20890483
tagged with: java
type: Question
has body: I have a string like this String a = "background-image: url(www.google.com); background-repeat: no-repeat;-webkit-background-size: 1001px 1903px;height: 1903px; width: 1001px; text-align: center; margin: 0 auto;"; I have to get the height: and width: values from the String and replace it with user inputted values from the form.What would be the best way to parse it?
answer count: 2
accepted answer: http://stackoverflow.com/a/20890619
has comment: http://stackoverflow.com/comment/31353313
has comment: http://stackoverflow.com/comment/31352789
has comment: http://stackoverflow.com/comment/31352687
tagged with: parsing
score: 0
tagged with: html-parsing
possible better answer: http://stackoverflow.com/a/20891115
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20891115
has title: Java parsing this particular string without unique delimeters
has answer: http://stackoverflow.com/a/20890619

http://stackoverflow.com/q/20915372
possible better answer: http://stackoverflow.com/a/20915626
has answer: http://stackoverflow.com/a/20915419
type: AnsweredQuestion
tagged with: java
tagged with: multithreading
type: Question
has body: I have some serialized classes which have several members that are classes that initiate some life-long threads.(while(true){doSth();sleep(100)}). Now I wonder which is a good practice to handle them. Wether I should create those objects by implementing read/writeObject methods or I should divide the factories for creating those objects and take out all transient object creations in a different create method and run the both factory methods when I want to create them from scratch and use only the transient factory method for the case I read them from a serialized stream?
has comment: http://stackoverflow.com/comment/32718312
accepted answer: http://stackoverflow.com/a/20915419
tagged with: transient
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/20915626
tagged with: serialization
has title: Correct practice to handle thread containing transient members in serialized classes

http://stackoverflow.com/comment/31435738
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20934408
has text: In which line the ex. occurs?

http://stackoverflow.com/a/20963086
score: 4
has comment: http://stackoverflow.com/comment/31491098
has body: I'm not sure if it helps you, but i usually put config data in some editable file: file params.ini vertices 3 n_poly 80 mutation_rate 0.0001f photo_interval_sec 60 target_file monalisa.jpeg randomize_start true min_alpha 20 max_alpha 90 I use this class to load it: import java.io.*; import java.util.HashMap; import java.util.Scanner; public class Params { static int VERTICES = 0; static int N_POLY = 0; static float MUTATION_RATE = 0.0f; static int PHOTO_INTERVAL_SEC = 0; static String TARGET_FILE; static boolean RANDOMIZE_START = false; static int MIN_ALPHA = 0; static int MAX_ALPHA = 0; public Params() { Scanner scanner = new Scanner(this.getClass().getResourceAsStream("params.ini")); HashMap<String, String> map = new HashMap<String, String>(); while (scanner.hasNext()) { map.put(scanner.next(), scanner.next()); } TARGET_FILE = map.get("target_file"); VERTICES = Integer.parseInt(map.get("vertices")); N_POLY = Integer.parseInt(map.get("n_poly")); MUTATION_RATE = Float.parseFloat(map.get("mutation_rate")); PHOTO_INTERVAL_SEC = Integer.parseInt(map.get("photo_interval_sec")); RANDOMIZE_START = Boolean.parseBoolean(map.get("randomize_start")); MIN_ALPHA = Integer.parseInt(map.get("min_alpha")); MAX_ALPHA = Integer.parseInt(map.get("max_alpha")); } } Then just load and read: // call this to load/reload the file new Params(); // then just read int vertices = Params.VERTICES; Hope it helps!
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/20963019
downvote count: 0

http://stackoverflow.com/q/20914319
has body: When I run SHOW VARIABLES LIKE '%version%' in MySQL command line console it runs very fine, but when I run the same code in the Java application I'm working on it produces the following error: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'VARIABLES' in 'field list' Here is my Java code: ConnectionHelper.setDatabaseName('information_schema'); Statement statement = ConnectionHelper.getStatement(); ResultSet = statement.executeQuery ("SHOW VARIABLES LIKE '%version%'"); String serverVersion = null; while (resultSet.next()) { serverVersion = resultSet.getString(3); } The ConnectionHelper is just a class that creates and sets up a connection to any database passed as parameter to the setDatabaseName() method. I've even tried not to set any database since the query runs in MySQL command line console even without selecting any database, but still produces the same error. Please I really need help.
score: 4
favorite count: 0
tagged with: exception
possible better answer: http://stackoverflow.com/a/20914457
has answer: http://stackoverflow.com/a/20914457
type: AnsweredQuestion
has title: MySQL - "SHOW VARIABLES LIKE '%version%'" not working in my Java application
tagged with: mysql
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/20914388
upvote count: 4
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/20914388

filewriter
tag name: filewriter
tags question: http://stackoverflow.com/q/20890980
tags question: http://stackoverflow.com/q/20890202
type: Tag
tags question: http://stackoverflow.com/q/20850741
tags question: http://stackoverflow.com/q/20900603

http://stackoverflow.com/a/20880476
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20880231
type: Answer
has comment: http://stackoverflow.com/comment/31363510
upvote count: 1
has body: Garbage collection is the process of looking at heap memory, identifying which objects are in use and which are not, and deleting the unused objects. An in use object, or a referenced object, means that some part of your program still maintains a pointer to that object. An unused object, or unreferenced object, is no longer referenced by any part of your program. So the memory used by an unreferenced object can be reclaimed. The information learned from the object allocation behavior can be used to enhance the performance of the JVM. Therefore, the heap is broken up into smaller parts or generations. The heap parts are: Young Generation, Old or Tenured Generation, and Permanent Generation The Young Generation is where all new objects are allocated and aged. When the young generation fills up, this causes a minor garbage collection. Minor collections can be optimized assuming a high object mortality rate. A young generation full of dead objects is collected very quickly. Some surviving objects are aged and eventually move to the old generation. Stop the World Event - All minor garbage collections are "Stop the World" events. This means that all application threads are stopped until the operation completes. Minor garbage collections are always Stop the World events. The Old Generation is used to store long surviving objects. Typically, a threshold is set for young generation object and when that age is met, the object gets moved to the old generation. Eventually the old generation needs to be collected. This event is called a major garbage collection. Major garbage collection are also Stop the World events. Often a major collection is much slower because it involves all live objects. So for Responsive applications, major garbage collections should be minimized. Also note, that the length of the Stop the World event for a major garbage collection is affected by the kind of garbage collector that is used for the old generation space. The Permanent generation contains me…

heartbeat
tags question: http://stackoverflow.com/q/20971249
type: Tag
tag name: heartbeat

http://stackoverflow.com/comment/31297645
has text: 1) For better help sooner, post an [SSCCE](http://sscce.org/). 2) Please don't forget to add a '?' to questions! Some people do a search in the page for '?' and if none exists in the 'question' go directly to the next (actual) question in line. 3) Please use code formatting for code, input/output & structured documents like HTML or XML. To do that, select the sample and click the `{}` button above the messaged posting/editing form.
score: 2
comment on: http://stackoverflow.com/q/20861373
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/52433395
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20913587
has text: ... it gets worse. Consider `(new Double(123456788.0/6)).toString()` => `2.0576131333333332E7`. Skipping exponent `E7`, we see that the final digit is `2` not `3`. Again, the inexactness of double. But if you say "I'll just skip the last digit and check what comes before", then what happens if you see `2.05761333335`. Is that a repeating decimal? No. On the other hand, it might *originally* have been a repeating decimal, but then you did some (non-exact) math, like adding another number to it, and it got *slightly off*. That's non-exact math for you.

nexus
type: Tag
tag name: nexus
tags question: http://stackoverflow.com/q/20875846

http://stackoverflow.com/a/20914868
upvote count: 2
type: Answer
score: 2
has body: The single greatest benefit of error codes -- along with more informative strings -- is that they can be looked up even after your code has been translated into another language which you may not read. The next greatest benefit is that if someone ever writes code that reads your error messages -- perhaps your own company, to help folks manage your appliction -- it is tremendously helpful for them to have an error code at the start of the message. That both speeds up their decision of what to do, and partially guards them against the risk that you might rephrase the message later (which would mess up attempts to search for the message text). Any convention can work if you reliably stick with it. If you're thinking about the long term and multiple products, you'll probably want the code to include some indication of which code (application and/or library and/or other module) issued the error, and then you want to be able to quickly find the error in that product's support table. IBM usually uses a moderately recognizable alphabetic prefix to identify the code, and a numeric suffix to indicate the specific message. Other companies probably do it differently.
has comment: http://stackoverflow.com/comment/31399299
answers question: http://stackoverflow.com/q/20914771
has comment: http://stackoverflow.com/comment/31399222
downvote count: 0
has comment: http://stackoverflow.com/comment/31399477

http://stackoverflow.com/comment/31534925
score: 0
type: Comment
type: QuestionComment
has text: Never mind the code, please show us sample input (log file lines) and desired output
comment on: http://stackoverflow.com/q/20986514

http://stackoverflow.com/a/21008413
upvote count: 4
answers question: http://stackoverflow.com/q/21006120
type: AcceptedAnswer
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/31604304
type: Answer
has comment: http://stackoverflow.com/comment/31603055
has comment: http://stackoverflow.com/comment/31604805
has body: You can create an entity resolver, and make use of it. The following example uses the JAXP DocumentBuilder, and a CatalogResolver public static void main(String[] args) throws ParserConfigurationException, SAXException, IOException, TransformerConfigurationException, TransformerException { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); db.setEntityResolver(new CatalogResolver()); File src = new File("src/article.xml"); Document doc = db.parse(src); // Here, we execute the transformation // Use a Transformer for output File stylesheet = new File("src/aticle.xsl"); TransformerFactory tFactory = TransformerFactory.newInstance(); StreamSource stylesource = new StreamSource(stylesheet); Transformer transformer = tFactory.newTransformer(stylesource); DOMSource source = new DOMSource(document); StreamResult result = new StreamResult(System.out); transformer.transform(source, result); } create a catalog properties file, and place it on your classpath CatalogManager.properties has to be the name, see CatalogManager API documentation define a catalog XML file, point your properties file, above to it. From http://www.xml.com/pub/a/2004/03/03/catalogs.html you can find a very simple catalog XML file : &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"&gt; &lt;public publicId="-//OYRM/foo" uri="src/bar.dtd"/&gt; &lt;/catalog&gt; With the above catalog.xml and CatalogManager.properties, you'll end up resolving references to the publicId "-//OYRM/foo" to the uri src/bar.dtd xml-commons contains the resolver : http://xerces.apache.org/mirrors.cgi#binary for a more complete treatment of the topic of Resolvers read Tom White's article from XML.com The transformer application was cribbed from the Java trail for Extensible StyleSheet Language Transformations > Transforming Data with XSLT
accepted answer of: http://stackoverflow.com/q/21006120

http://stackoverflow.com/comment/31581717
comment on: http://stackoverflow.com/a/21011937
has text: Nothing, it's perfect! Okay. Almost perfect.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31464605
has text: @Ruben In your case the moment you are initializing `String` array is empty. You can check this my putting `debug` point in `main()` too. So you are getting all `null`. But in this case, we are accessing array after initialize. So now you will have mapped value for the `key`. please leave a comment if you did not get my point clear.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20949703

http://stackoverflow.com/q/20983547
favorite count: 0
tagged with: ldap
tagged with: openldap
has title: Get Ldap server version with java
type: UnansweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20994718
has answer: http://stackoverflow.com/a/20983599
type: Question
answer count: 2
has body: I found this simple example with java how to connect to LDAP server: import javax.naming.*; import javax.naming.directory.*; import java.util.Hashtable; /** * Demonstrates how to create an initial context to an LDAP server * using SSL. For this example to work, JSSE must be installed and * configured, and the issuer of the LDAP server's certificate must * be in the JSSE trust store. * * usage: java Ssl */ class Ssl { public static void main(String[] args) { // Set up environment for creating initial context Hashtable env = new Hashtable(11); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, "ldap://localhost:636/o=JNDITutorial"); // Specify SSL env.put(Context.SECURITY_PROTOCOL, "ssl"); // Authenticate as S. User and password "mysecret" env.put(Context.SECURITY_AUTHENTICATION, "simple"); env.put(Context.SECURITY_PRINCIPAL, "cn=S. User, ou=NewHires, o=JNDITutorial"); env.put(Context.SECURITY_CREDENTIALS, "mysecret"); try { // Create initial context DirContext ctx = new InitialDirContext(env); System.out.println(ctx.lookup("ou=NewHires")); // ... do something useful with ctx // Close the context when we're done ctx.close(); } catch (NamingException e) { e.printStackTrace(); } } } Is there any way to get the LDAP server and version when I'm connected?
upvote count: 1
downvote count: 0

http://stackoverflow.com/a/20907472
type: Answer
score: 2
downvote count: 0
has body: user[] array = new user[2]; is just a definition of array but the elements of arrays are NOT initialized/are NULL. Hence accessing an attribute or method will result in NullPointerException. You should initialize array element before using them, like this: array[0] = new user(); array[1] = new user();
upvote count: 2
accepted answer of: http://stackoverflow.com/q/20907451
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20907451

http://stackoverflow.com/a/20885860
has body: Ingredients: a mouseListener detecting the mousePressed "below" the last row if so, set the anchor of the row selection model to the last row Something like: MouseListener l = new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { Rectangle lastRow = table.getCellRect(table.getRowCount() - 1, 0, false); if (e.getY() &lt; lastRow.y + lastRow.height) return; System.out.println(table); table.getSelectionModel().setAnchorSelectionIndex(table.getRowCount()-1); } }; table.addMouseListener(l);
type: AcceptedAnswer
downvote count: 0
score: 3
type: Answer
accepted answer of: http://stackoverflow.com/q/20882223
answers question: http://stackoverflow.com/q/20882223
upvote count: 3
has comment: http://stackoverflow.com/comment/31381381
has comment: http://stackoverflow.com/comment/31371341

http://stackoverflow.com/comment/31292090
type: QuestionComment
comment on: http://stackoverflow.com/q/20858109
has text: @AndrewThompson, that was _my_ comment haha
score: 0
type: Comment

xsockets.net
type: Tag
tag name: xsockets.net
tags question: http://stackoverflow.com/q/20890674

http://stackoverflow.com/q/20974892
has answer: http://stackoverflow.com/a/21125353
has title: Use Mockito to Stub methods in the same class as the class under test (CUT)
type: Question
upvote count: 27
tagged with: mockito
has answer: http://stackoverflow.com/a/20975267
accepted answer: http://stackoverflow.com/a/20975267
answer count: 2
downvote count: 0
favorite count: 0
type: AnsweredQuestion
score: 27
has body: I am trying to test some legacy code using Mockito, and the method is a of type void. I have stubbed out a lot of the calls to methods in other classes, this works fine. However, I also need to be able to stub out certain calls to other methods inside the same class. Currently this is not working. e.g. My Class is like below: public class Test { public Test(dummy dummy) { } public void checkTask(Task task, List &lt;String&gt; dependencyOnLastSuccessList) throws TaskException { callToOtherClass.method1 // This works fine, I can stub it using mockito updateAndReschedule(Long id, String message) // call to method in same class, I cannot stub it } public void updateAndReschedule(Long id, String message) { //method logic..... } } This is my testClass showing what I have at the minute: @Test public void testMyMethod() { Test testRef = new Test(taskJob); Test spy = spy (testRef); // when a particular method is called, return a specific object when(callToOtherClass.method1).thenReturn(ObjectABC); //doNothing when my local method is called doNothing().when(spy).updateAndReschedule(1, "test"); //make method call spy.checkTask(ts, taskDependencies); }
tagged with: java
possible better answer: http://stackoverflow.com/a/21125353

http://stackoverflow.com/comment/31539792
has text: Hello, I am a bit confused. I mean I know the usage of synchronize ( sequential access to a code that may be run from different threads ) but this synchronization with main memory makes me "foggy". Let's say we enter getA. I assume that 'a' will be read from main memory. But since we synchronized on 'this' will also 'nr' be read from memory (because it is an instance variable, belonging to 'this' which we've used to synchronize)?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20982263

error-handling
tags question: http://stackoverflow.com/q/20931921
tag name: error-handling
tags question: http://stackoverflow.com/q/20858992
tags question: http://stackoverflow.com/q/21004935
tags question: http://stackoverflow.com/q/20929621
tags question: http://stackoverflow.com/q/20887829
tags question: http://stackoverflow.com/q/20946862
tags question: http://stackoverflow.com/q/20914771
type: Tag

http://stackoverflow.com/q/20929621
has body: I'm currently working on an assignment (Java) for school. In the instructions/rubric, I'm told that I need to use I/O Exception Handling for command line arguments and other things. **What The Program Needs to do: ** Take two command line arguments when it runs, or else throw an error. The rubric includes this requirement : "I/O error handling is done if no command arguments" The problem is, every time I try to use an I/O exception catch, I receive this error: "Unreachable catch block for IOException. This exception is never thrown from the try statement body" The quick fix suggestions I get from Eclipse: 1. Remove Catch clause 2. Replace Catch clause with close Here is my Code: import java.awt.Robot; import java.io.BufferedReader; import java.io.File; import java.io.IOException; public class DecipherText { public static void main(String[] args) throws IOException { String firstArg; String secondArg; if (args.length &gt; 0) { try { firstArg = args[0]; secondArg = args[1]; } catch (IOException e) { System.out.println("Usage Error: Not enough Arguments"); System.out.println(e); return; } } String inputFile = args[0]; String outputFile = args[1]; } public static boolean receiver() { return false; } public static boolean output() { // Outputs The Final File return false; } } My question(s) are: If so, what am I doing wrong? Is this requirement impossible/asking for the wrong usage of the I/O Error exception handling? Any help is greatly appreciated. Thanks, Sully
tagged with: command-line
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20929684
has comment: http://stackoverflow.com/comment/31427126
tagged with: java
tagged with: error-handling
type: Question
has comment: http://stackoverflow.com/comment/31427142
has answer: http://stackoverflow.com/a/20929651
accepted answer: http://stackoverflow.com/a/20929651
has comment: http://stackoverflow.com/comment/31427083
has title: I/O Error Exception Handling: Unreachable catch block for IOException. This exception is never thrown from the try statement body
upvote count: 2
possible better answer: http://stackoverflow.com/a/20929684
answer count: 3
has comment: http://stackoverflow.com/comment/31427097
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/71168458
tagged with: io
tagged with: arguments

http://stackoverflow.com/comment/31418737
type: Comment
comment on: http://stackoverflow.com/a/20920301
type: AnswerComment
has text: Can you use this in my code (I am amateur...)
score: 0

http://stackoverflow.com/comment/31444901
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20938923
score: 1
has text: Hint: `unsupported platform 'ppc'`

http://stackoverflow.com/comment/43803596
comment on: http://stackoverflow.com/a/21860328
type: Comment
score: 1
has text: Well, sure... As long as your TargetType doesn't use generics itself. But that seems pretty limiting.
type: AnswerComment

http://stackoverflow.com/comment/31331863
score: 0
type: QuestionComment
type: Comment
has text: Sorry it was java.. Thanks for informing
comment on: http://stackoverflow.com/q/20879368

http://stackoverflow.com/comment/31589772
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21016490
has text: But if I ignore that error it is giving Your project contains error(s), please fix them before running your application

http://stackoverflow.com/q/20893480
upvote count: 1
tagged with: jfreechart
type: Question
tagged with: java
has body: I would like to display the (x, y) location of the mouse pointer with respect the coordinate system of the current jfree chart. I would like to do this constantly even if the mouse pointer is not set on any part of the graph. I know I can activate the tooltip the way explained here but that displays the mouse location only if the mouse is on top of a graph point. How can I see the XYs all the time next to mouse pointer (tooltip or something)?
answer count: 1
downvote count: 0
has title: Is there a way to update and display x y next to mouse pointer in jfreechart?
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/6087680
has answer: http://stackoverflow.com/a/20900152
linked to: http://stackoverflow.com/q/20081801
score: 1

http://stackoverflow.com/comment/31396423
has text: Where did you log in into Google Drive?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20913363

http://stackoverflow.com/a/20921767
has comment: http://stackoverflow.com/comment/31411851
type: AcceptedAnswer
downvote count: 0
has body: It is a problem with your environment, not with your code (although the code does contain a clue). Your code tells jndi how to look up the initial context through an environment variable called org.jboss.ejb.client.naming. The variable contains a full name of your class, complete with its package name. When you renamed the project, you probably changed the package name as well. Now the environment variable org.jboss.ejb.client.naming points to some class that does not exist. You need to change that variable to reference your renamed class name to fix the problem.
answers question: http://stackoverflow.com/q/20921618
type: Answer
accepted answer of: http://stackoverflow.com/q/20921618
score: 1
upvote count: 1

http://stackoverflow.com/a/63081499
answers question: http://stackoverflow.com/q/20949686
score: 2
downvote count: 0
type: Answer
upvote count: 2
has body: in the file: .settings/org.eclipse.jdt.core.prefs add: org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore

http://stackoverflow.com/comment/31346163
type: Comment
comment on: http://stackoverflow.com/a/20886943
type: AnswerComment
has text: Would you mind setting my anwser to correct then ?
score: 0

celltable
type: Tag
tag name: celltable
tags question: http://stackoverflow.com/q/20940564

http://stackoverflow.com/q/20891386
upvote count: 12
has comment: http://stackoverflow.com/comment/31355281
has comment: http://stackoverflow.com/comment/31355026
has comment: http://stackoverflow.com/comment/31354534
tagged with: multithreading
has title: How to detect thread being blocked by IO?
type: AnsweredQuestion
downvote count: 0
tagged with: java
has body: In Java, thread can have different state: NEW, RUNNABLE, BLOCKED, WAITING, TIMED_WAITING, TERMINATED However, when the thread is blocked by IO, its state is "RUNNABLE". How can I tell if it is blocked by IO?
score: 12
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31360382
has answer: http://stackoverflow.com/a/20892193
accepted answer: http://stackoverflow.com/a/20892193
favorite count: 0
has comment: http://stackoverflow.com/comment/31354640
possible better answer: http://stackoverflow.com/a/47525670
has answer: http://stackoverflow.com/a/47525670

http://stackoverflow.com/comment/31388891
comment on: http://stackoverflow.com/q/20908946
type: QuestionComment
type: Comment
has text: @AndreyChaschev I have update my question to show how I am using the JSOUP parser.
score: 0

http://stackoverflow.com/q/21013399
has title: What does mvn sonar:sonar do?
has body: What are the maven lifecycle phases does the command mvn sonar:sonar execute? While I see the logs that run over the screen, at a very high level test, install that I spotted out. Consider the following example, I have a maven project like the following maven-root maven-child-1 maven-child-2 Consider the following scenario, I have done them sequentially at root level mvn clean install mvn sonar:sonar -- See the report Modified child-2 by adding some test cases to increase the code coverage Run mvn sonar:sonar My changes for the test cases are not reflecting in the report. I have deleted the report from sonarqube mvn sonar:sonar Still that generates me the old report. In brief, Do I need to perform mvn clean install and then mvn sonar:sonar ? If mvn sonar:sonar covers executing the mvn clean install, why the report gives me old numbers?
downvote count: 0
accepted answer: http://stackoverflow.com/a/21041002
favorite count: 0
tagged with: maven
score: 11
has answer: http://stackoverflow.com/a/60674822
has comment: http://stackoverflow.com/comment/94299127
upvote count: 11
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/60674822
has answer: http://stackoverflow.com/a/21041002
type: Question
has comment: http://stackoverflow.com/comment/120611828
answer count: 2
has comment: http://stackoverflow.com/comment/31583880
tagged with: sonarqube
has comment: http://stackoverflow.com/comment/31584031

http://stackoverflow.com/a/20936075
type: Answer
answers question: http://stackoverflow.com/q/20933824
has comment: http://stackoverflow.com/comment/31439555
has comment: http://stackoverflow.com/comment/31574707
has body: The true way of doing this depends on your non-functional requirements. If you expect non-Java clients to request the (status) data from the database, or clients are behind a proxy, then write your application server as a web-service. Since you are writing a server that clients will depend on, also think about scalability (deploy the web-service on multiple web-servers behind a load-balancer) and availability (if one web-server goes down, the load-balancer should direct requests to other web-servers that are still up). And don't forget maintainability: ideally you should be able to upgrade/downgrade your application server without clients noticing. If there are only Java clients (or the data on the line is only question-answer type text like with telnet), then you will need threads and also a database connection pool. I have used Yapool to create an "always on" application server like this. It contains a ServerSocket that you can use/look at to learn this stuff (see also the unit tests). A database pool implementation is also included. I have also combined Yapool with a basic JSP web-service framework to create a war-file that can be deployed on Tomcat, exposing the application server as a (very simple) web-service. The advantage of a web-service like this is that you do not need to worry (much) about threads and connections: Tomcat does that for you. If you want to take it a step further, I suggest learning about REST. As for receiving two types of lists: you are inventing your own protocol here and are free to send and receive data to/from the client as long as the client mirrors the server protocol exactly. You can send/receive any kind of object with the ObjectInputStream/ObjectOutputStream as long as it is serializable. Lists and Maps are already serializable. For example server protocol: out.writeUTF("Server ready"); out.flush(); // If we are here, then connection was probably not a portscan out.writeObject(tfList); out.writeObject(multipleList); out.flush(); …
score: 0
accepted answer of: http://stackoverflow.com/q/20933824
has comment: http://stackoverflow.com/comment/31486590
has comment: http://stackoverflow.com/comment/31564757
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31481485
has comment: http://stackoverflow.com/comment/31748518

http://stackoverflow.com/comment/31412244
score: 1
comment on: http://stackoverflow.com/q/20922164
has text: Other than that, your code *does* work properly.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31503052
has text: i went back to create statement statement and used a boolean , its working fine now. Also FYI even though the table is in the SYS schema user louise CAN access it. connection.createStatement(); System.out.println("Insert Record Query :"+QUERY); boolean returnValue = statement.execute(QUERY);
comment on: http://stackoverflow.com/q/20967440
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20886207
has body: Try this, changing your Activity name to the full class name: &lt;activity android:name="com.example.android.mediaRecorder.MainActivity"
upvote count: 2
answers question: http://stackoverflow.com/q/20885968
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/a/21010674
type: Answer
score: 2
upvote count: 2
has body: Consider using java.util.concurrent.Future.get(long, TimeUnit). Runnable yourTask = &lt;wrap your work code in a Runnable&gt;; Future future = threadpool.submit(yourTask); try { Object result = future.get(10, TimeUnit.SECONDS); } catch (Exception e) { &lt;handle exception, e.g. TimeoutException&gt; } finally { &lt;your closing code&gt; } Here is an example to create/destroy a threadpool : import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; private ExecutorService threadpool; public void start() { threadpool = Executors.newCachedThreadPool(); } public void stop() throws InterruptedException { threadpool.shutdown(); if (false == threadpool.awaitTermination(1, TimeUnit.SECONDS)) threadpool.shutdownNow(); }
downvote count: 0
answers question: http://stackoverflow.com/q/21010529

http://stackoverflow.com/comment/119571817
comment on: http://stackoverflow.com/a/20886297
has text: I tried the approach mentioned here along with the other fields but for some reason due to the `@XmlPath(".")` all the fields would be moved into `map`. I have few additional fields along with `Map<String,Object>` and I expect those fields to be unmarshalled directly to the respective field names and only unknown fields to be mapped to `Map<String,Object>` but for some reason all fields are moved within the `Map` which is not expected. Can you please provide some more explanation.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31516950
score: 3
type: Comment
type: QuestionComment
has text: What on Earth is a NetBeans Class ??
comment on: http://stackoverflow.com/q/20977448

http://stackoverflow.com/comment/31488108
has text: thanks, I've updated my post, but what I'm interested in really is not graph theory but rather something much simpler - the best class design approach to managing my rooms and knowing the exits. But yes it may/will be cyclic in that A->B, A->C, A->D, B->A C->E
score: 0
comment on: http://stackoverflow.com/q/20961432
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31289525
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20856235
type: Comment
has text: first of all, thanks for your time and support. Second, I generated the R.java following this link http://stackoverflow.com/questions/16583118/google-maps-api-v2-class-not-found/16583424#16583424 Again, thanks and happy new year :)

http://stackoverflow.com/a/20987814
has body: Specify the proxy configuration in maven settings.xml file, It will download automatically. optional true http proxyuser proxypass proxy.host.net 80 local.net|some.host.com
has comment: http://stackoverflow.com/comment/31536639
answers question: http://stackoverflow.com/q/20987647
score: 0
type: Answer

http://stackoverflow.com/comment/31466400
comment on: http://stackoverflow.com/q/20949672
score: 0
has text: Is the number the hex RGB value? If so, you could write a method that looks at the separate R, G, and B components to see which are dominate. For instance, `255,12,46` would be dominantly Red, `189,20,198` would be dominantly purple (red and blue are close to each other).
type: QuestionComment
type: Comment

http://stackoverflow.com/q/20882633
tagged with: unix
has answer: http://stackoverflow.com/a/20885179
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20883197
tagged with: java
has title: UNIX STDOUT end symbol
linked to: http://stackoverflow.com/q/3991819
tagged with: stdout
has answer: http://stackoverflow.com/a/20883197
type: Question
accepted answer: http://stackoverflow.com/a/20885179
linked to: http://stackoverflow.com/q/1908610
score: 0
has body: I want to execute multiple commands from Java Process but I don't want to spawn a new process for executing every command. So I made an Object called Shell that holds InputStream and OutputStream for Process. The problem is that if I don't terminate a process by appending "exit\n" I can't tell where is the end of the InputStream and the InputStream gets into waiting state when I've read the whole output so I need to know when to stop doing next read. Is there some kind of a standard symbol at the end of the output? Because what I came up with is final String outputTerminationSignal = checksum(command); command += ";echo \"" + outputTerminationSignal + "\";echo $?\n" This way when I get the outputTerminationSignal line I can get the exit code and stop reading. final String line = bufferedReader.readLine(); if (line != null &amp;&amp; line.equals(outputTerminationSignal)) { final String exitCode = bufferedReader.readLine(); } Of course this is exploitable and error-prone because the real output in some case may match my generated outputTerminationSignal and the app will stop reading when it shouldn't. I wonder if there is some standard so called "outputTerminationSignal" comming from the output I am not aware of.
answer count: 2

webview
tags question: http://stackoverflow.com/q/20908771
tags question: http://stackoverflow.com/q/20910405
tag name: webview
tags question: http://stackoverflow.com/q/20856136
tags question: http://stackoverflow.com/q/21013810
type: Tag

http://stackoverflow.com/a/20985619
score: 0
accepted answer of: http://stackoverflow.com/q/20985529
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20985529
has comment: http://stackoverflow.com/comment/31533037
has comment: http://stackoverflow.com/comment/31551199
has comment: http://stackoverflow.com/comment/31532914
type: Answer
has comment: http://stackoverflow.com/comment/31532988
has body: I don't know the OSX code - however, it looks to be that you have this: Graphics g = bs.getDrawGraphics(); g.drawImage(img, 0, 0, WIDTH, HEIGHT, null); g.dispose(); bs.show(); .. sitting outside any method - it doesn't appear to be wrapped in anything... I would advise that you start from the top and make sure you have matching { and } braces - that is to say that where you have one open { you also have a closed one } - when you identify the one that doesn't have an end (or start) then you will find the error in your code. I THINK You need to change this: private void render() { BufferStrategy bs = this.getBufferStrategy(); if (bs == null) { createBufferStrategy(3); return; } for (int i = 0; i&lt;(WIDTH*HEIGHT); i++); pixels[i] = screen.pixels[i]; } Graphics g = bs.getDrawGraphics(); g.drawImage(img, 0, 0, WIDTH, HEIGHT, null); g.dispose(); bs.show(); To This - notice its now wrapped in { } ok :) Again - i do not know OSX, though the syntax below looks correct private void render() { BufferStrategy bs = this.getBufferStrategy(); if (bs == null) { createBufferStrategy(3); return; } for (int i = 0; i&lt;(WIDTH*HEIGHT); i++){ // changed ; for { pixels[i] = screen.pixels[i]; } Graphics g = bs.getDrawGraphics(); g.drawImage(img, 0, 0, WIDTH, HEIGHT, null); g.dispose(); bs.show(); } // added this here
has comment: http://stackoverflow.com/comment/31533020
has comment: http://stackoverflow.com/comment/31532932
has comment: http://stackoverflow.com/comment/31533146

http://stackoverflow.com/comment/31593145
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21016592
type: Comment
has text: 10.0.2.2 is only used when you are testing in emulator.. because emulator takes the normal localhost IP which is 127.0.0.1 so to connect to your server localhost you use another Localhost IP which is 10.0.2.2. but you are developing using your phone so you need to provide your PC IP address.. follow this [tutorial](http://www.howtogeek.com/howto/17012/how-to-find-your-ip-address-in-ubuntu/) to get IP address in Ubuntu

http://stackoverflow.com/q/20978535
tagged with: spring-mvc-test
tagged with: java
has answer: http://stackoverflow.com/a/20987253
accepted answer: http://stackoverflow.com/a/20987253
score: 9
tagged with: junit
answer count: 1
has title: Testing Spring MVC Router with MockMVC
favorite count: 0
upvote count: 9
has body: I'm trying to test my Spring MVC webapp with Spring test. It uses springmvc-router for routing and that appears to break the tests, which work fine when I use @RequestMapping instead of my routes.conf file. I have a .jsp file called valid.jsp, and it displays fine when I run the development site from Jetty. The controller is: @Controller @EnableWebMvc public class AuthController { public String valid() { return "valid"; } } My routes.conf file maps GET /valid authController.valid. Now, my tester looks like @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"/test-context.xml", "/spring/spring-security.xml", "file:src/main/webapp/WEB-INF/mvc-config.xml"}) @WebAppConfiguration @Import(RouteConfig.class) public class AuthControllerTest { private MockMvc mockMvc; @Autowired private WebApplicationContext webApplicationContext; @Autowired private AuthenticationManager authenticationManager; @Before public void init() { MockitoAnnotations.initMocks(this); mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).dispatchOptions(true).build(); } @Test public void testValid() throws Exception { mockMvc.perform(get("/validation-success")) .andDo(print()) .andExpect(status().isOk()); } When the mockMvc.perform() is run, a NullPointerException is thrown: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.NullPointerException at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:943) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:822) at javax.servlet.http.HttpServlet.service(HttpServlet.java:668) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:807) at org.springframework.test.web.servlet.TestDispatcherServlet.service(TestDispatcherServlet.java:64) at javax.servlet.http.HttpServlet.service(HttpServlet.java:770) at org.springframework.mock.web.MockFilterChain$ServletFilterProxy.doFilter(M…
downvote count: 0
type: Question
tagged with: spring-mvc
type: AnsweredQuestion

http://stackoverflow.com/q/20942861
has comment: http://stackoverflow.com/comment/31452822
has answer: http://stackoverflow.com/a/20943405
has comment: http://stackoverflow.com/comment/31452645
accepted answer: http://stackoverflow.com/a/20943048
answer count: 5
possible better answer: http://stackoverflow.com/a/20943405
tagged with: android
has comment: http://stackoverflow.com/comment/31452672
has body: I want to pass string data from my Activity class to a class which is a TCPClient class. So basically, this string contains the IP address the user inputs from my Activity class view. And then in return I need to pass the IP address to TCPClient class. Below are the codes that I'm working on. MainActivity.class: String add1 = etIPAddress1.getText().toString(); String add2 = etIPAddress2.getText().toString(); String add3 = etIPAddress3.getText().toString(); String add4 = etIPAddress4.getText().toString(); String new_IPAddress = add1 + "." + add2 + "." + add3 + "." + add4; Log.d("E", new_IPAddress); TCPClient.class: public class TCPClient { private String serverMessage; //public static final String SERVERIP = "192.168.254.105"; //your computer IP address public static final String SERVERIP = ""; public static final int SERVERPORT = 4444; private OnMessageReceived mMessageListener = null; private boolean mRun = false; PrintWriter out; BufferedReader in; /** * Constructor of the class. OnMessagedReceived listens for the messages received from server */ public TCPClient(OnMessageReceived listener) { mMessageListener = listener; } Does anybody here know how to do this? I would gladly appreciate your help. Thanks.
has comment: http://stackoverflow.com/comment/31452661
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20943071
has comment: http://stackoverflow.com/comment/31452628
tagged with: java
has comment: http://stackoverflow.com/comment/31452700
type: Question
has answer: http://stackoverflow.com/a/20943009
has answer: http://stackoverflow.com/a/20943652
has answer: http://stackoverflow.com/a/20943048
has comment: http://stackoverflow.com/comment/31452737
score: 0
has title: Android pass data from Activity class to class

http://stackoverflow.com/comment/31412577
has text: @ruakh You are correct - but things like JIT, Hotspot etc happens at the JVM stage, not at the compiler stage and they can be described as compilation.
type: QuestionComment
comment on: http://stackoverflow.com/q/20915991
score: 0
type: Comment

http://stackoverflow.com/comment/31480086
type: Comment
comment on: http://stackoverflow.com/a/20957551
type: AnswerComment
score: 0
has text: If you use Java 8 then it's easy: `list.stream().filter(i -> i%2 == 0).map(i -> i * 3).collect(toList());`.

http://stackoverflow.com/comment/31501469
type: Comment
type: QuestionComment
has text: [Click me gently](http://www.javaworld.com/article/2074996/hashcode-and-equals-method-in-java-object---a-pragmatic-concept.html).
comment on: http://stackoverflow.com/q/20969184
score: 4

http://stackoverflow.com/comment/31376318
score: 0
comment on: http://stackoverflow.com/a/20880343
type: Comment
type: AnswerComment
has text: The compuware.com link in this explained what I was looking for "When an object is no longer used, the garbage collector reclaims the underlying memory and reuses it for future object allocation. This means there is no explicit deletion and no memory is given back to the operating system."

http://stackoverflow.com/comment/31404406
comment on: http://stackoverflow.com/q/20917777
type: Comment
type: QuestionComment
has text: i am not sure when i should clean up the local references.I am trying to clean the local reference using (*env)->DeleteLocalRef( env, cls); But still the issue is seen.
score: 0

http://stackoverflow.com/q/20912906
has answer: http://stackoverflow.com/a/20913752
answer count: 2
has answer: http://stackoverflow.com/a/43449860
type: UnansweredQuestion
tagged with: spring
has body: I am trying to config two sessionFactories using spring. My config looks similar to the one listed here Here's my config.xml ${hibernate.connection.url} ${hibernate.connection.driver_class} ${hibernate.connection.username} ${hibernate.connection.password} ...Mappings ${hibernate.dialect} ${hibernate.jdbc.batch_size} true ${hibernate.default_batch_fetch_size} ${hibernate.c3p0.min_size} ${hibernate.c3p0.max_size} ${hibernate.c3p0.timeout} ${hibernate.c3p0.max_statements} org.hibernate.connection.C3P0ConnectionProvider ${hibernate.connection.mirror_url} ${hibernate.connection.driver_class} ${hibernate.connection.mirror_username} ${hibernate.connection.mirror_password} ...Mappings ${hibernate.dialect} ${hibernate.jdbc.batch_size} true ${hibernate.default_batch_fetch_size} ${hibernate.c3p0.min_size} ${hibernate.c3p0.max_size} ${hibernate.c3p0.timeout} ${hibernate.c3p0.max_statements} org.hibernate.connection.C3P0ConnectionProvider Then each dao gets a different sessionFactory assigned This config gets loaded when its added to the context web.xml: contextConfigLocation /WEB-INF/classes/test-data.xml /WEB-INF/classes/test-services.xml ... The problem shows whenever I start the server each sessionFactory built, but at the end of the second one this shows up: [INFO] [org.springframework.beans.factory.support.DefaultListableBeanFactory]:? - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@97aaa6: defining beans [... Many elements...]; root of factory hierarchy [INFO] [org.springframework.orm.hibernate3.LocalSessionFactoryBean]:? - Closing Hibernate SessionFactory [INFO] [org.hibernate.impl.SessionFactoryImpl]:? - closing [INFO] [org.springframework.orm.hibernate3.LocalSessionFactoryBean]:? - Closing Hibernate SessionFactory [INFO] [org.hibernate.impl.SessionFactoryImpl]:? - closing Any help, or lead would be appreciated, if you need more info please ask
has title: Spring multiple SessionFactory config?
score: 0
tagged with: spring-orm
tagged with: sessionfactory
type: Question
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/31358310
type: Comment
comment on: http://stackoverflow.com/a/20893011
score: 0
type: AnswerComment
has text: This works, but to my mind is treating the symptoms

http://stackoverflow.com/q/20925250
tagged with: http-status-code-400
has comment: http://stackoverflow.com/comment/31418197
has title: Error 400 in rest client
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/20925723
type: UnansweredQuestion
has body: I am trying to test my Restful webservice , so i made a simple core java client, but unfortunately it is getting a 400 error from the server. I also tried to test the web-service from the Advance REST client, there i am getting correct response.So, please let me know where is the error in my rest client code. public void testPostRequestWithJsonPayload() throws IOException { String url = "http://localhost:14443/de.vogella.jersey.first/rest/employee/get"; String charset = "UTF-8"; URL service = new URL(url); URLConnection connection = service.openConnection(); connection.setDoOutput(true); // Triggers POST. connection.setRequestProperty("Accept-Charset", charset); connection.setRequestProperty("Content-Type", "application/json; charset="+charset); OutputStreamWriter wr = new OutputStreamWriter( connection.getOutputStream()); // ============================================= JSONObject data = new JSONObject(); data.put("jsonParam", "2"); wr.write(data.toString()); connection.connect(); InputStream stream = connection.getInputStream(); int c; StringBuilder d = new StringBuilder(); while ((c = stream.read()) != -1) { char ch = (char) c; d.append(ch); } System.out.println(d.toString()); } Web-service goes like this @POST @Path("/get") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response getEmplByPostWithJson(JSONObject id) { System.out.println("getEmplByPostWithJson"); EmployeeDAO dbHandler = new EmployeeDAOImpl(); String value; int empId = 0; try { value = id.getString("jsonParam"); empId = Integer.parseInt(value); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } Employee fetchedEmployee = dbHandler.findEmployee(empId); JSONObject o = new JSONObject(); try { o.put("empName", fetchedEmployee.getEmpName()); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } ResponseBuilder rb = new ResponseBuilderImpl(); rb.type(MediaType.APPLICATION_JSON); rb.entity(o); return rb.…
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has comment: http://stackoverflow.com/comment/31418227

http://stackoverflow.com/comment/114442650
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21012166
type: Comment
has text: This solution will display a context menu even if table has no rows inside it.. Also it does not add the context menu based on row, rather it adds based on right click. So if you right click on table header also, still you see the context menu, which seems not appropriate.

http://stackoverflow.com/comment/31549554
type: QuestionComment
has text: hi i got it , it was the problem , becs i didnt included , mimepull.jar file. it should be there with multipart jar file.
score: 0
comment on: http://stackoverflow.com/q/20991866
type: Comment

javapolicy
tags question: http://stackoverflow.com/q/20978646
tag name: javapolicy
type: Tag

http://stackoverflow.com/comment/31397983
has text: Probably need more debugging. Run this through a debugger and see if you reach `hasUniqueLocs()` or add a print statement at the beginning. Also - Maroun has a good point - if there aren't any locations you won't reach the print statement.
score: 2
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20914224

http://stackoverflow.com/comment/31442597
has text: no persistence code posted, so leave people to guess whats in the DAO? not looked at the log seemingly also. Not looked at what 'state' your objects are in when you look at them (again you don't say where that is in your persistence code, so left to guesswork)
comment on: http://stackoverflow.com/q/20937219
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/20997439
has comment: http://stackoverflow.com/comment/31553997
downvote count: 0
answer count: 1
tagged with: javascript
tagged with: jquery
favorite count: 0
has comment: http://stackoverflow.com/comment/31630486
tagged with: http://stackoverflow.com/tag/html
has body: I am trying to change the size of the posts on grid mode in tumblr. I noticed that I can change the width of each post through CSS. But I just cannot seem to find where I change the height size of a grid post to a fixed size. For example, I would like to post an image with words underneath it and if the text does not fit in the fixed size. I would like the post to have periods to show that they can continue reading by clicking on the post. I have been using the Chrome Developer Tools to find certain div and class tags, but I just cannot seem to figure this out. All help will be much appreciated.
has comment: http://stackoverflow.com/comment/31629717
has title: Changing posts on grid to a fixed size (Photo posts with writing underneath.)
tagged with: css
has comment: http://stackoverflow.com/comment/31630448
type: UnansweredQuestion
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21039608
score: 1
tagged with: java

http://stackoverflow.com/q/20874834
favorite count: 0
has body: I'm trying to display result of analysed text in jTextArea, and I'm coding this program via Netbeans. Below is the code that I'm trying to repair in order the result to show in jTextArea3 but its showing non static variable cannot be referenced from static content error. Since in Netbeans jTextArea code will be generated by itself, I couldn't change anything. PLease help me public static void main(String[] args) throws NetworkException, AnalysisException { File textSRC = new File("MyText.txt"); String myTextCount = null; BufferedReader myTextBr = null; String check = ""; try { String myTextCurrentLine; myTextBr = new BufferedReader(new FileReader(textSRC)); while ((myTextCurrentLine = myTextBr.readLine()) != null) { myTextCount = myTextCount + " " + myTextCurrentLine; } // Sample request, showcasing a couple of TextRazor features String API_KEY = "7d5066bec76cb47f4eb4e557c60e9b979f9a748aacbdc5a44ef9375a"; TextRazor client = new TextRazor(API_KEY); client.addExtractor("words"); client.addExtractor("entities"); client.addExtractor("entailments"); client.addExtractor("senses"); client.addExtractor("entity_companies"); String rules = "entity_companies(CompanyEntity) :- entity_type(CompanyEntity, Company')."; client.setRules(rules); AnalyzedText response = client.analyze(myTextCount); File file = new File("Hello1.txt"); // creates the file file.createNewFile(); // creates a FileWriter Object FileWriter writer = new FileWriter(file); // Writes the content to the file for (Sentence sentence : response.getResponse().getSentences()) { for (Word word : sentence.getWords()) { System.out.println("----------------"); System.out.println("Word: " + word.getLemma()); for (Entity entity : word.getEntities()) { ///System.out.println("Matched Entity: " + entity.getEntityId()); } for (Sense sense: word.getSenses()) { //System.out.println("Word sense: " + sense.getSynset() + " has score: " + sense.getScore()); } } } // Use a custom rule to match 'Company' type entities for (Custom custo…
tagged with: static
accepted answer: http://stackoverflow.com/a/20874943
has title: non static variable jTextArea cannot be referenced from static content
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/2559527
score: 1
tagged with: java
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/31324053
type: Question
answer count: 1
duplicate of: http://stackoverflow.com/q/11993077
downvote count: 0
has comment: http://stackoverflow.com/comment/31323960
tagged with: netbeans-7
has answer: http://stackoverflow.com/a/20874943

http://stackoverflow.com/comment/31308290
score: 0
type: AnswerComment
has text: it gives that 'the method trim() is undefined for the type Editable'
comment on: http://stackoverflow.com/a/20858598
type: Comment

http://stackoverflow.com/comment/31511687
type: AnswerComment
has text: Well, it really looks like there is no way to make it without any hacks. It is interesting that JPA does not allow such a thing. For the production this is really annoying issue. Anyway, thanks for the answer.
type: Comment
comment on: http://stackoverflow.com/a/20974620
score: 0

http://stackoverflow.com/q/20995802
favorite count: 0
has body: I'm new in Java. I have a school project. I should detect 1500 random lines of a big text file? Actually, the text file includes 5 million lines. I want to read line by line a .txt file, then detect 1500 lines randomly, and write the random lines into the new .txt file Would you please help me in this matter. Thanks in advance.
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/31550831
has comment: http://stackoverflow.com/comment/31550742
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/31550545
has title: How Can I Detect 1500 Random Lines From a big Text File in Java?
type: Question
has answer: http://stackoverflow.com/a/20996084
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/20996045
has comment: http://stackoverflow.com/comment/31550429
tagged with: random
has comment: http://stackoverflow.com/comment/31550876

http://stackoverflow.com/comment/31344128
type: Comment
has text: I don't see relation from logs to provided code. Your code throw java.lang.ClassCastException in line 37 but this line is related with menu. Are you sure that this current code?
score: 1
comment on: http://stackoverflow.com/q/20881754
type: QuestionComment

http://stackoverflow.com/comment/31399256
has text: Thanks again, I'll see what I can do(: and if it doesn't work out, you'll be here, right?
comment on: http://stackoverflow.com/a/20914447
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/20947861
score: 0
type: AcceptedAnswer
has body: Try using (T-SQL): SELECT RIGHT(REPLICATE('0',13)+ '12345',13) Or (Oracle) : http://www.techonthenet.com/oracle/functions/lpad.php
type: Answer
accepted answer of: http://stackoverflow.com/q/20947715
answers question: http://stackoverflow.com/q/20947715

http://stackoverflow.com/a/20950797
has comment: http://stackoverflow.com/comment/105001097
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/31466924
has body: For weight to work, the affected dimension (width, in this case) must be 0dp. So, change this: android:layout_width="wrap_content" to this: android:layout_width="0dp" in your imageView definitions (all the three of them)
has comment: http://stackoverflow.com/comment/105000171
downvote count: 0
has comment: http://stackoverflow.com/comment/31466972
has comment: http://stackoverflow.com/comment/31467408
type: Answer
answers question: http://stackoverflow.com/q/20950732

http://stackoverflow.com/a/20923819
has body: Create a simple renderer by overriding the setValue() method of the default renderer: public class YMDRenderer extends DefaultTableCellRenderer { private Format formatter = new SimpleDateFormat("yy/MM/dd"); public void setValue(Object value) { // Format the Object before setting its value in the renderer try { if (value != null) value = formatter.format(value); } catch(IllegalArgumentException e) {} super.setValue(value); } } To take advantage of this type of rendering by using reusable code check out Table Format Renderers. Then all you need to do is specify the formatter: SimpleDateFormat format = new SimpleDateFormat("yy/MM/dd"); TableCellRenderer renderer = new FormatRenderer( format ); Edit: As mentioned by nachokk if you are going to go to the trouble of creating a completely custom renderer then you should probably use an instanceof check to make sure you are formatting the proper class: public class YMDRenderer extends DefaultTableCellRenderer { private Format formatter = new SimpleDateFormat("yy/MM/dd"); public void setValue(Object value) { // Format the Object before setting its value in the renderer if (value instanceof Date) { value = formatter.format(value); } super.setValue(value); } }
has comment: http://stackoverflow.com/comment/31417985
answers question: http://stackoverflow.com/q/20916720
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/31419278
downvote count: 0
has comment: http://stackoverflow.com/comment/31417316
upvote count: 2
has comment: http://stackoverflow.com/comment/31417823

http://stackoverflow.com/comment/31331585
has text: @gandalf: *"if the identifiers are pointers they should act like one"* Well, they aren't, so they don't. C++ array references are a *bit* like `const` pointers, but they aren't really pointers at all. It's just that you can assign an array reference to an appropriately-typed pointer, and the array reference will get converted into a pointer to the first element in the array. Which is not the same as *being* a pointer, any more than when you assign an `int` to a `long` and it's converted in the process, that doesn't mean it was a `long` to begin with.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20879108

http://stackoverflow.com/a/20935067
downvote count: 0
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/31439350
has body: Include following line of code in manifest.xml inside Application Tag <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> and create an integer variable inside res/value folder with version of google play For eg: res/values/version.xml <?xml version="1.0" encoding="utf-8"?> 4030500
upvote count: 2
accepted answer of: http://stackoverflow.com/q/20935035
answers question: http://stackoverflow.com/q/20935035
type: AcceptedAnswer

http://stackoverflow.com/q/21006205
duplicate of: http://stackoverflow.com/q/18424854
has comment: http://stackoverflow.com/comment/31577722
linked to: http://stackoverflow.com/q/14260185
tagged with: java
has body: I want to control the LookAndFeel of every component independently but I am not certain how to organize the code so the main frame of the program has one look and a pop-up window has another or even two pop-up windows have different LookAndFeels without overriding one another. What are the methodologies to group LookAndFeels and apply them liberally across a program while maintaining tight control?
has comment: http://stackoverflow.com/comment/31580087
type: Question
score: 0
has comment: http://stackoverflow.com/comment/31573968
has comment: http://stackoverflow.com/comment/31571242
has comment: http://stackoverflow.com/comment/31570690
has title: Controlling LookAndFeel of Java Swing
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31570752
tagged with: look-and-feel
linked to: http://stackoverflow.com/q/18424854
tagged with: swing

http://stackoverflow.com/comment/31491193
comment on: http://stackoverflow.com/a/20963272
score: 0
type: AnswerComment
has text: I might have actually solved my own question by adding a field `next` to my `LinkedList` implementation. This way, I can build `MyHashTable` (or whatever you'd like to call it) and iterate jump from first `LinkedList` to the next `LinkedList` much like `LinkedList` iterates through `Nodes`. Does this make sense? Sorry again, for any confusion.
type: Comment

http://stackoverflow.com/q/20913363
has body: I'm writing an adroid app that used to upload a chosen image to the users' google drive. I have cloned the code from git to another machine and then the image won't upload any more. I get a com.google.android.gms.auth.GoogleAuthException: Unknown exception. but it's caught here: } catch (IOException e) { e.printStackTrace(); } if(fileContent.length() &gt; 5 * 1024 * 1024) { // Resumable Uploads when the file size exceeds a file size of 5 MB. // check link : // 1) https://code.google.com/p/google-api-java-client/source/browse/drive-cmdline-sample/src/main/java/com/google/api/services/samples/drive/cmdline/DriveSample.java?repo=samples&amp;r=08555cd2a27be66dc97505e15c60853f47d84b5a // 2) http://stackoverflow.com/questions/15970423/uploading-downloading-of-large-size-file-to-google-drive-giving-error AbstractGoogleClientRequest&lt;File&gt; insert = mDriveService.files().insert(body, mediaContent); MediaHttpUploader uploader = insert.getMediaHttpUploader(); uploader.setDirectUploadEnabled(false); uploader.setProgressListener(new FileUploadProgressListener()); destFile = (File) insert.execute(); } else { // Else we go by Non Resumable Uploads, which is safe for small uploads. destFile = mDriveService.files().insert(body, mediaContent).execute(); } this is my login to drive code public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); credential = GoogleAccountCredential.usingOAuth2(this, Collections.singleton(DriveScopes.DRIVE)); startActivityForResult(credential.newChooseAccountIntent(), REQUEST_ACCOUNT_PICKER); Intent intent = getIntent(); } @Override protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) { switch (requestCode) { case REQUEST_ACCOUNT_PICKER: if (resultCode == RESULT_OK &amp;&amp; data != null &amp;&amp; data.getExtras() != null) { String accountName = data.getStringExtra(AccountManager.KEY_ACCOUNT_NAME); if (accountName != null) { credential.setSelectedAccountName(accountName); mDriv…
favorite count: 0
tagged with: google-drive-api
tagged with: google-authentication
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31396748
tagged with: android
has title: cannot upload to google drive from my android app com.google.android.gms.auth.GoogleAuthException: Unknown
has comment: http://stackoverflow.com/comment/31396842
score: 2
downvote count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31396423
linked to: http://stackoverflow.com/q/15970423
upvote count: 2
has answer: http://stackoverflow.com/a/20913696
answer count: 1

http://stackoverflow.com/comment/31356980
type: Comment
has text: What are you trying to do? It looks like you're re-creating it every time anyway. onPause() is always called if you really need to save something.
type: AnswerComment
comment on: http://stackoverflow.com/a/20892548
score: 0

http://stackoverflow.com/comment/31444682
has text: @krzakov It depends; if all you're doing is altering existing elements (without adding/removing), then it should be alright. Where is the exception actually being thrown?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/20938562
type: Comment

http://stackoverflow.com/a/20923471
has comment: http://stackoverflow.com/comment/31433003
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/20922714
has comment: http://stackoverflow.com/comment/31415706
has comment: http://stackoverflow.com/comment/31416084
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/31415987
has comment: http://stackoverflow.com/comment/31451712
has body: I would not advice to use Anatol's method as this will create new views for each item. The best way to approach this would be to handle the click of the check box and update your model accordingly. Then you can do something like this: ListAdapter adapter = myList.getAdapter(); for (int i = 0; i &lt; adapter.getCount(); i++) { if (adapter.getItem(i).isChecked()) { doSomething(); } } Note that isChecked need to be created in your model class. Please let me know if you have any questions.

http://stackoverflow.com/q/20873953
tagged with: java
linked to: http://stackoverflow.com/q/12716850
has answer: http://stackoverflow.com/a/20873989
tagged with: listview
score: 0
answer count: 2
has title: listView crashed randomly when refresh
tagged with: android
accepted answer: http://stackoverflow.com/a/20873989
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20873988
has body: I have a listView whixh is refresh each time the client (my android app) receive a message from the server but the problem is when i click to many time on the refresh button the app crash and send me this error: java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread. Make sure your adapter calls notifyDataSetChanged() when its content changes. edit 1: the crash does not happen every time it onlu happen when i click about ten times quickly on the refresh button activity code: class receiveimplements Runnable { @Override public void run() { try { if (socket != null &amp;&amp; socket.isConnected()) { BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream())); for (; ; ) { while ((textRecu = reader.readLine()) != null) { if (textRecu.length() &lt; 6) { bug = true; break; } Log.d("textrecuapres", textRecu); index++; if (index == 1) { listTitre.add(0, textRecu); sendListeAndMakeAffichage(listSource,listTitre); } else if (index == 2) { listSource.add(0, textRecu); index = 0; } } } } } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } } } public void sendListeAndMakeAffichage(final List&lt;String&gt; sourceList,final List&lt;String&gt; sourceTitre) { runOnUiThread(new Runnable() { @Override public void run() { fragmentListe.setListTitreAndListSource(sourceTitre, sourceList); } }); } Listfragment code: public void setListTitreAndListSource(List&lt;String&gt; listTitre, List&lt;String&gt; listSource) { this.listTitre = listTitre; this.listSource = listSource; adapter.bind(listTitre); setListAdapter(adapter); } adapter code: public void bind(List&lt;String&gt; model) { notifyDataSetChanged(); listeTitre = model; notifyDataSetChanged(); }
type: Question
possible better answer: http://stackoverflow.com/a/20873988

http://stackoverflow.com/a/20985555
has comment: http://stackoverflow.com/comment/31532825
has comment: http://stackoverflow.com/comment/31532729
upvote count: 7
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20985481
answers question: http://stackoverflow.com/q/20985481
has comment: http://stackoverflow.com/comment/31532920
type: Answer
downvote count: 0
score: 7
has body: Check out the "Link Builder" section of the documentation: http://docs.spring.io/spring-hateoas/docs/current/reference/html/#fundamentals.obtaining-links.builder There, it describes how to use a ControllerLinkBuilder to create the Link using a separate controller class. Your User Object would implement Identifiable&lt;Long&gt;, as the example in the page above shows.

http://stackoverflow.com/q/20945099
tagged with: java
score: 0
has body: I have a public dynamic GAE Java backend that works perfectly on the development server but fails to start on the appspot production env. When deployed, the backend shows in the admin console as "Started" but no instances are showing. According to the logs no startup "/_ah/start" request are ever sent to the backend. I have tried connecting to the backend from a browser and from a front-end instance, always getting the 503 http error. The backend url is http://vp3engine-alan.vp3editor.appspot.com/engine/session web.xml snippet: EngineSwitch vp3engine.GAECabinet.EngineSwitchServlet EngineSwitch /_ah/start MainSwitch vp3editor.MainSwitchServlet MainSwitch /* The backends.xml file: true true <!-- fail-fast>true</fail-fast -->
has comment: http://stackoverflow.com/comment/31519996
type: UnansweredQuestion
tagged with: google-app-engine
answer count: 0
has comment: http://stackoverflow.com/comment/31488793
has title: Google app engine Java backend returns "503 Server Error"
type: Question

http://stackoverflow.com/comment/31524286
type: QuestionComment
comment on: http://stackoverflow.com/q/20981057
has text: Add a `in.nextLine();` after the `in.nextInt()` to consume the `"\n"`.
score: 2
type: Comment

http://stackoverflow.com/a/20913221
has body: You can try manipulating the JVM stack size. I'm not sure that this will help in the end, but if you have a machine with a lot of memory, you can increase both the stack and heap and push the failure out further. The default stack size is 384KB. You manipulate it using the -Xss parameter to the JVM. For example, -Xss512k sets the stack size to 512KB.
has comment: http://stackoverflow.com/comment/31396559
has comment: http://stackoverflow.com/comment/31396433
type: Answer
has comment: http://stackoverflow.com/comment/31396295
answers question: http://stackoverflow.com/q/20913118
has comment: http://stackoverflow.com/comment/31397148
score: 0

http://stackoverflow.com/a/20927112
has comment: http://stackoverflow.com/comment/31422097
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/31422198
has body: My advice for you is: Take examples from your book and play with them. Pick a suitable example application (there were some listed on the website for example) and: Start going through its source. Create your own test application that follows the solutions found there. Test changing different things in your app. Experiment with how to solve problems with new framework that you already have solved once with a framework you're familiar with. That way you know exactly what to do and just need to find what's different with the new tools. Find fellow developers to chat with, there surely is a mailing list, forum or IRC channel somewhere that you can discuss solutions on. Study the javadocs. If above doesn't give enough answers, study framework source code. In my biased opinion nothing really beats hands on experience. You can read books and documentation forever, but that will only get you so far. Best way to learn how to use a framework is getting your hands dirty through trial and error. Start writing some code, any code, and tinkering with the framework. You'll slowly start to get a feeling for how things work. Kind of like if you want to learn to speak a new language. Reading, writing, learning vocabulary and doing grammar exercises is all good and peachy, but only way to learn to speak it is by speaking, speaking and speaking. Also, always try to engage in conversations, when you find a fellow developer. You don't want to invent the wheel anew every time you have a new issue and he could've had similar issues or know solutions to your problems. Or he could be able to offer you valuable advice where to go next.
answers question: http://stackoverflow.com/q/20926657
downvote count: 0
type: Answer

http://stackoverflow.com/comment/31524966
has text: `public ListClas(List(Parent) list)` is not valid Java. Did you mean `public ListClas(List<Parent> list)`?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20981077

http://stackoverflow.com/comment/31520192
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20979047
has text: sure the url is right coz it does not open in my browser. I think you are confused.
score: 0

http://stackoverflow.com/comment/31318259
has text: http://en.wikipedia.org/wiki/MP3#File_structure
comment on: http://stackoverflow.com/q/20871618
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/20874196
tagged with: concurrenthashmap
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31322662
has title: synchronization, remove from collection
has body: I am working on website with games and I have map of players and their virtual tables. private final ConcurrentMap&lt;Player, List&lt;Table&gt;&gt; tableOfPlayers = new ConcurrentHashMap&lt;&gt;(); and method to remove table private void removeTable(Player player,Table table) { if(tableOfPlayers.get(player).size() == 1) { tableOfPlayers.remove(player); } else { tableOfPlayers.get(player).remove(table); } } Is there any good way to solve this check-then-act idiom, because now it isn't thread-safe. I know that I can synchronize both add and remove method, but I am wondering if it is possible to make it better. The reason why I check if size is equal to 1 is that if player have only one active table and I decide to remove I no longer need this player in my map.
downvote count: 0
favorite count: 0
type: UnansweredQuestion
answer count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/31495206
comment on: http://stackoverflow.com/q/20965567
type: Comment
has text: Can you list the jars name for us?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/31478287
has text: `readline()` relies on a newline, as per the docs. You aren't sending one so it will block and never return.
comment on: http://stackoverflow.com/q/20956878
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31365467
type: Comment
has text: by running `java -XX:AutoBoxCacheMax=256` in console, I got `Error:could not create the Java Virtual Machine`
comment on: http://stackoverflow.com/a/20897061
score: 0
type: AnswerComment

http://stackoverflow.com/q/21007958
tagged with: wildfly
has title: WildFly - How To View Deployment
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21025644
tagged with: java
tagged with: jboss
type: Question
score: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/21025644
answer count: 1
favorite count: 0
has body: This may be a stupid question, but I've been scouring the documentation and I can't seem to come up with an answer. I've deployed a WAR file through the web interface in WildFly, but how do I view this deployment? In Tomcat it would be something like http://:8080/mydeploymentname, but I can't find something similar for WildFly.
upvote count: 2

http://stackoverflow.com/comment/31287130
type: Comment
has text: Can you post some code with your problem. That way people can help you better.
type: QuestionComment
comment on: http://stackoverflow.com/q/20855811
score: 0

http://stackoverflow.com/comment/31562425
comment on: http://stackoverflow.com/a/21002123
has text: Thank you gtgaxiola , i got it
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31570422
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21003944
has text: Please edit your code to include your call to evaluate. Standing alone, this code is a method declaration with no invocation. The result will depend upon how you call evaluate. Can you include the smallest possible set of working software ?
score: 0

http://stackoverflow.com/a/20982284
answers question: http://stackoverflow.com/q/20982070
has body: List&lt;? extends A&gt; accepts List&lt;A&gt; and List&lt;B&gt; and List&lt;C&gt;, there's no problem with it.
downvote count: 0
score: 1
type: Answer
upvote count: 1

http://stackoverflow.com/q/20896124
has comment: http://stackoverflow.com/comment/43870923
tagged with: tomcat
has comment: http://stackoverflow.com/comment/31369394
tagged with: tomcat-juli
favorite count: 0
has comment: http://stackoverflow.com/comment/31363419
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31369709
has answer: http://stackoverflow.com/a/37502427
has title: tomcat in linux:java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory
has comment: http://stackoverflow.com/comment/59658778
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/30782960
has body: when I startup tomcat in linux,I met a problem. Using CLASSPATH:/data/apache-tomcat-7.0.47/bin/bootstrap.jar:/data/apache-tomcat-7.0.47/bin/tomcat-juli.jar `Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory at org.apache.catalina.startup.Bootstrap.&lt;clinit&gt;(Bootstrap.java:60) Caused by: java.lang.ClassNotFoundException: org.apache.juli.logging.LogFactory 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:423) at java.lang.ClassLoader.loadClass(ClassLoader.java:356) ... 1 more` I know that class can't be found,but the jar has been in the classpath. So why? I will be appreciated if you can answer my question.thank you.
linked to: http://stackoverflow.com/q/7955442
has answer: http://stackoverflow.com/a/23452279
type: Question
score: 3
answer count: 3
tagged with: apache
downvote count: 0
has comment: http://stackoverflow.com/comment/31363456

http://stackoverflow.com/comment/31570432
comment on: http://stackoverflow.com/q/21003807
has text: would that help?: http://stackoverflow.com/questions/9686562/smo-confidence-measure-in-weka
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20978550
possible better answer: http://stackoverflow.com/a/20978613
tagged with: jdbc
has answer: http://stackoverflow.com/a/20978613
has comment: http://stackoverflow.com/comment/31521594
has comment: http://stackoverflow.com/comment/31521504
score: 0
has comment: http://stackoverflow.com/comment/31520112
tagged with: spring
type: AnsweredQuestion
has title: Cannot create JDBC driver of class '' for connect URL 'null' and NullPointerException
has answer: http://stackoverflow.com/a/20979580
tagged with: java
has body: im using Spring, learning with servlets and all that webstuff, i'm trying to create a simple servlet for connecting to mysql server.. here is my code: AccesoDB: package es.prueba.servlet; import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.sql.DataSource; /** * Servlet implementation class AccesoDB */ public class AccesoDB extends HttpServlet { private static final long serialVersionUID = 1L; private DataSource ds = null; ResultSet rs; Context ctx; /** * @see HttpServlet#HttpServlet() */ public AccesoDB() { super(); // TODO Auto-generated constructor stub } @Override public void init(ServletConfig conf) throws ServletException { super.init(conf); try { ctx = new InitialContext(); ds = (DataSource) ctx.lookup("java:comp/env/jdbc/AccesoBD"); } catch ( NamingException e) { e.printStackTrace(); } } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); Connection connection = null; synchronized(ds) { try{ connection = ds.getConnection(); PrintWriter out = response.getWriter(); String query = null; Statement stmt; query = "SELECT * FROM test"; stmt = connection.createStatement(); rs = stmt.executeQuery(query); out.println(rs.toString()); connection.close(); }catch (SQLException e) { e.printStackTrace(); } } } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpSe…
tagged with: servlets
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/20979580
has comment: http://stackoverflow.com/comment/31520410

http://stackoverflow.com/comment/31613203
has text: After downloading the example Excel project that ships with Com4j and receiving the same problem with it, I've switched to Apache POI and am having a much better time.
comment on: http://stackoverflow.com/q/21003738
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/a/20953834
has comment: http://stackoverflow.com/comment/31472438
type: Answer
answers question: http://stackoverflow.com/q/20953444
score: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20953444
has comment: http://stackoverflow.com/comment/31474472
upvote count: 3
type: AcceptedAnswer
has body: This exception is thrown when you try to load a class that was compiled with higher version of Java than the one you are running your application with. See UnsupportedClassVersionError check the version of JVM you run your app with using java -version check the version of class file as suggested in how to check the jdk version used to compile a .class file - using javap -verbose com.microsoft.sqlserver.jdbc.SQLServerDriver If jar is intended to use with higher version of Java, you can either: use higher version of JVM to run the app download older version of driver

http://stackoverflow.com/q/20996490
has comment: http://stackoverflow.com/comment/31554798
score: 0
has body: I have a an outputlable &lt;h:outputLabel id="label1" value="Project Name"/&gt;.Next to that I have another &lt;h:outputLabel id="label2" value="#{XXBean.details.projectName}"/&gt; Both labes are located inside a &lt;p:fieldset&gt; label2 will get rendered based on the value in bean. label2 is getting wrapped in the next line but the wrapped text should start from the starting index of the label2 not from starting index of label1. I tried &lt;h:outputLabel style="white-space: pre;word-wrap: break-word;" /&gt; but it shows the label2 in a straight line and its extending the size of the fieldset. And its not wrapping it as per the expected results given below. Actual result I am getting : label1:labellabel2label2label2label2label2label2label2label2label2 label2label2label2label2 Expected : label1:labellabel2label2label2label2label2label2label2label2label2 label2label2label2label2 Please advise me to get the Expected output.
has title: JSF wrapping the <h:outputLabel> text w.r.t to starting index of the its own in next line
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/31554487
type: AnsweredQuestion
tagged with: jsf
tagged with: primefaces
tagged with: java
has answer: http://stackoverflow.com/a/21000972
accepted answer: http://stackoverflow.com/a/21000972
type: Question
tagged with: jsf-2
answer count: 1
has comment: http://stackoverflow.com/comment/31555185

resin
type: Tag
tag name: resin
tags question: http://stackoverflow.com/q/20971187

http://stackoverflow.com/q/20887903
favorite count: 0
has comment: http://stackoverflow.com/comment/31348673
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/31348007
has comment: http://stackoverflow.com/comment/31347906
upvote count: 2
has comment: http://stackoverflow.com/comment/31348036
tagged with: java
has comment: http://stackoverflow.com/comment/32534528
has comment: http://stackoverflow.com/comment/33262040
has comment: http://stackoverflow.com/comment/31347593
has comment: http://stackoverflow.com/comment/31347917
type: UnansweredQuestion
has title: Wrong position in Custom Adapter
tagged with: eclipse
has body: I have created a Custom Adapter to manage some Buttons inside each ListView item. If I scroll-down the list, and I click a button, the adapter take a wrong position. LISTVIEW item 1 item 2 item 3 item 4 item 5 item 6 item 7 POSITION AFTER CLICK 0 1 2 3 4 5 0 This is my adapter: public DoubleListAdapter(Context context, ArrayList&lt;DoubleListItems&gt; items, String Tag) { super(context, 0, items); this.Tag = Tag; this.context = context; this.items = items; vi = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); } @Override public View getView(int position, View convertView, ViewGroup parent) { final ViewHolder holder; final int Position = position; if (convertView == null) { convertView = vi.inflate(R.layout.double_list_item, null); holder = new ViewHolder(); final DoubleListItems i = (DoubleListItems) items.get(position); holder.item = i; holder.Icon = (ImageView) convertView .findViewById(R.id.IconaDoubleList); holder.Title = (TextView) convertView .findViewById(R.id.TitoloDoubleList); holder.SecondLineDesc = (TextView) convertView .findViewById(R.id.SecondaLineaDesc); holder.SecondLineValue = (TextView) convertView .findViewById(R.id.SecondaLineaValue); holder.ThirdLineDesc = (TextView) convertView .findViewById(R.id.TerzaLineaDesc); holder.ThirdLineValue = (TextView) convertView .findViewById(R.id.TerzaLineaValue); holder.Delete = (Button) convertView .findViewById(R.id.ButtonDeleteItem); holder.Set = (Button) convertView.findViewById(R.id.ButtonSetiItem); holder.Delete.setTag(holder); holder.Delete.setOnClickListener(new OnClickListener() { holder.Set.setTag(holder); holder.Set.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // Log.e("DOUBLELIST ADAPTER ", "Position: " + Position); String Code = i.getKey(); // String Code = holder.item.getKey(); Intent intent; Costanti.curLocale = Costanti.LocaliLavorati.Item("L" + Code); intent = new Intent(context, IncassiTab.class); if (Costanti.curLocale != null) …
has comment: http://stackoverflow.com/comment/31347615
tagged with: listview
score: 2
has comment: http://stackoverflow.com/comment/31369254
downvote count: 0
answer count: 0
tagged with: adapter

http://stackoverflow.com/a/39048857
type: Answer
has body: I had the same problem but it got fixed after I updated the classpathPrefix in my pom.xml. Support_lib/ . After you build the project using maven, the 'target' folder had this Support_lib/ dir with all the spring jar files in it. so I used this dir name in the classpathPrefix and it worked.
score: 0
answers question: http://stackoverflow.com/q/21000685

http://stackoverflow.com/q/20949556
upvote count: 1
has answer: http://stackoverflow.com/a/20953837
has body: I am creating a calculator in Java, and am struggling to come up with a way to handle negative numbers, so far i can parse an expression, for example this: ((4-3)*(4/2))*2 becomes: [4.0, -3.0, +, 4.0, 2.0, /, *, 2.0, *] However i don't know how i would deal with expressions containing negatives, such as: 2*(-2-3) So far i have it so when a negative value is encountered it multiplies the number ahead of it by -1 and adds a + to the end of the list, so the expression becomes this: [2.0, -2.0, -3.0, +, +, *] This is causing many errors in my program, can anyone help with a better method to deal with negatives. Thanks very much for any help
tagged with: list
has comment: http://stackoverflow.com/comment/31464430
tagged with: java
answer count: 3
has comment: http://stackoverflow.com/comment/31464289
downvote count: 0
has answer: http://stackoverflow.com/a/20949757
type: UnansweredQuestion
has title: Java calculator, how to handle negative numbers
has answer: http://stackoverflow.com/a/20955214
has comment: http://stackoverflow.com/comment/31464619
has comment: http://stackoverflow.com/comment/31464652
score: 1
tagged with: calculator
favorite count: 0
tagged with: negative-number
tagged with: parsing
type: Question

http://stackoverflow.com/comment/31392248
type: Comment
comment on: http://stackoverflow.com/a/20910600
type: AnswerComment
has text: Didn't help, still the same result :(
score: 0

http://stackoverflow.com/comment/31547977
type: Comment
has text: The circles are suppose to stay as they are, it is a connect 4 game. Depending on the circle that is clicked i want the counter to be in that circle
comment on: http://stackoverflow.com/a/20994377
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31434995
comment on: http://stackoverflow.com/a/20912634
type: AnswerComment
score: 0
type: Comment
has text: @user2873619 What is `img_buff`? A byte array? If so, no you cannot do that. `setRGB()` takes a integer array of pixel data in whatever format you specified earlier (btw `TYPE_4BYTE_ARGB` doesn't exist). My code in pastebin specifies `TYPE_INT_ARGB`. If you can make the input data come in R G B A (or just R G B), just use the method I created in my answer.

http://stackoverflow.com/a/20870831
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/20870191
downvote count: 0
score: 1
has body: You're not holding a reference to your listener. In order to remove a listener you should hold a reference to it, and then you can pass the reference to the remove listener method. For example you're doing: smiec.addMouseListener(new MouseAdapter(){ ... }); But if you did something like this you'd be able to remove the mouse listener later. MouseListener mouseListener = new MouseAdapter() {...}; smiec.addMouseListener(mouseListener); ... smiec.removeMouseListener(mouseListener); You can see the Java Doc for JLabel, specifically for the removeMouseListener method here.

http://stackoverflow.com/q/20931057
has comment: http://stackoverflow.com/comment/31432013
has comment: http://stackoverflow.com/comment/31429940
possible better answer: http://stackoverflow.com/a/20932353
type: AnsweredQuestion
has body: I have seen this examlpe in a book , and is working fine but the only problem coming up is that the Background Does not turns black on First Call to Paint, When clearCounter become == 5, and then the screen is Cleared and again when Painting Starts, then the Background is turned Black. public class apletprg extends JApplet implements ActionListener { int clearCounter; Timer t; public void init(){ setBackground(Color.black); clearCounter = 0; Timer t = new Timer(1000, this); t.start(); } public void paint(Graphics g) { setBackground(Color.black); clearCounter++; Graphics2D g2 = (Graphics2D) g; if (clearCounter == 5){ g2.clearRect(0, 0, 500, 400); clearCounter=0; } for (int i = 1; i &lt;= 40; i++) { Color c = chooseColor(); g2.setColor(c); Font f = chooseFont(); g2.setFont(f); drawJava(g2); } } public void actionPerformed(ActionEvent ae){ repaint(); } public Color chooseColor(){ int r= (int) (Math.random() * 255); int g= (int) (Math.random() * 255); int b= (int) (Math.random() * 255); Color c = new Color(r,g,b); return c; } public Font chooseFont(){ int fontChoice = (int) (Math.random() * 4) + 1; Font f = null; switch (fontChoice) { case 1: f = new Font("Serif", Font.BOLD + Font.ITALIC, 20);break; case 2: f = new Font("SansSerif", Font.PLAIN, 17);break; case 3: f = new Font("Monospaced", Font.ITALIC, 23);break; case 4: f = new Font("Dialog", Font.ITALIC, 30);break; } return f; } public void drawJava(Graphics2D g2){ int x = (int) (Math.random() * 500); int y = (int) (Math.random() * 400); g2.drawString("Adnan", x, y); } } I Know that the Init () is called only once at the Start , but Why is that not able to change the Background at start?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31430513
upvote count: 1
has comment: http://stackoverflow.com/comment/31432009
has comment: http://stackoverflow.com/comment/31432183
tagged with: swing
has comment: http://stackoverflow.com/comment/31431974
has title: setBackground does not works on First time but on Second, Why?
type: Question
has comment: http://stackoverflow.com/comment/31430374
tagged with: setbackground
has comment: http://stackoverflow.com/comment/31430127
has comment: http://stackoverflow.com/comment/31431084
has comment: http://stackoverflow.com/comment/31430240
has comment: http://stackoverflow.com/comment/31431955
has answer: http://stackoverflow.com/a/20935268
has comment: http://stackoverflow.com/comment/31430056
accepted answer: http://stackoverflow.com/a/20935268
answer count: 2
tagged with: japplet
has comment: http://stackoverflow.com/comment/31432037
has comment: http://stackoverflow.com/comment/31429975
downvote count: 0
has comment: http://stackoverflow.com/comment/31431753
tagged with: applet
has comment: http://stackoverflow.com/comment/31430356
has comment: http://stackoverflow.com/comment/31430190
favorite count: 0
has comment: http://stackoverflow.com/comment/31429858
has answer: http://stackoverflow.com/a/20932353
has comment: http://stackoverflow.com/comment/31432117

http://stackoverflow.com/a/20949442
answers question: http://stackoverflow.com/q/20949337
score: 17
upvote count: 17
has body: You must ensure that DateTimeUtils.setCurrentMillisSystem() is invoked in the tearDown method. So that one test does not affect another. TestNG should invoke tearDown even if an exception occurs in your test. I often prefer another way when I want to decouple a class from System.currentTimeMillis();. I introduce an interface Clock and one implementation SystemClock like this: public interface Clock { public long getCurrentTimeMillis(); } public class SystemClock implements Clock { public long getCurrentTimeMillis(){ return System.currentTimeMillis(); } } For the tests it is then easy to create a mock that either returns a fixed time on every invocation or a series of predefined times. Some might argue that it is overengineering to introduce such an interface to decouple only one method and it would be a performance impact. But fortunately we have a JIT compiler and since JIT knows that only the SystemClock class is loaded it knows that no other implementation exist (at the moment). At this assumption it can just use inline method. So I prefer to write code in the way it can be tested best. EDIT With Java 8 you might want to use the Supplier&lt;Long&gt; interface. E.g. in your client code you can than use method references public class SomeClass { private Supplier&lt;Long&gt; currentTimeMillisSupplier; public SomeClass(){ this(System::currentTimeMillis); } SomeClass(Supplier&lt;Long&gt; currentTimeMillisSupplier){ this.currentTimeMillisSupplier = currentTimeMillisSupplier; } } The default constructor is for 'normal' use, while the other package scoped constructor can be used for unit tests. Just place the test class in the same package. You can also use the Clock interface, because it is a @FunctionalInterface. public class SomeClass { private Clock clock; public SomeClass(){ this(System::currentTimeMillis); } public SomeClass(Clock clock){ this.clock = clock; } }
downvote count: 0
type: Answer

http://stackoverflow.com/comment/31457100
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/20945529
has text: @SachinKumar - So, what is the problem?

http://stackoverflow.com/comment/31492203
type: Comment
type: QuestionComment
has text: before print the data, you could sort then first!
comment on: http://stackoverflow.com/q/20963975
score: 0

http://stackoverflow.com/comment/31393757
type: AnswerComment
comment on: http://stackoverflow.com/a/20912042
has text: Not "any single statement". It's a statement list. The doc you linked (the right one, of course), says that `ForInit` (which is optional) can be a `StatementExpressionList`, which is one or more `StatementExpression`s separated by commas. The same thing for `ForUpdate`. So OP's code could even have been `for (test('1'), test('2'); test('3') && (x <= 2); test('4'), test('5') ) { /* … */ }`. Aside from that omission, this answer is right.
type: Comment
score: 1

http://stackoverflow.com/comment/48688937
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20992221
type: Comment
has text: Using same Code but does not show online user.plz help

http://stackoverflow.com/q/20862535
tagged with: properties
tagged with: build
type: AnsweredQuestion
tagged with: java
tagged with: loops
type: Question
has answer: http://stackoverflow.com/a/20862668
accepted answer: http://stackoverflow.com/a/20862668
tagged with: ant
answer count: 1
has body: I'm running a long, complex Ant script. For debugging purposes, I'd like to to iterate over all available Ant properties (all that are set) and print their name and value. Is there a way to get a hold of a list of Ant properties at a given execution point so I could iterate through them using a for or foreach? I looked quite a bit but I haven't found anything on the subject... Thank you!! Eduardo
score: 0
has title: Interating over all available Ant properties

http://stackoverflow.com/a/20913665
type: Answer
answers question: http://stackoverflow.com/q/20913252
score: 2
has body: It seems like that should be Map&lt;String,List&lt;Map&lt;String,Area&gt;&gt;&gt;, but I've never used GSON before :)
upvote count: 2
has comment: http://stackoverflow.com/comment/31397061
accepted answer of: http://stackoverflow.com/q/20913252
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31397348
has comment: http://stackoverflow.com/comment/31397083

http://stackoverflow.com/comment/31675838
comment on: http://stackoverflow.com/q/20942821
has text: What output does your app produce in logcat? And how do you launch your Activities?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/20955546
accepted answer: http://stackoverflow.com/a/20955723
has body: I would like to know if there is a good way to know approximately how many threads a route is going to use (at least in theory). Also, I am using custom components (some using singleton endpoints and some not). I don't want to use VisualVM at this stage, this is just for getting and approximate count.
answer count: 1
score: 1
favorite count: 0
has title: Counting threads of a Apache Camel route with custom components
tagged with: multithreading
upvote count: 1
has answer: http://stackoverflow.com/a/20955723
type: AnsweredQuestion
tagged with: java
tagged with: apache-camel
type: Question
downvote count: 0

http://stackoverflow.com/a/20926820
type: Answer
answers question: http://stackoverflow.com/q/20926630
score: 0
has body: I think filename is as 102.txt so try this code: try { recsys.tweet.put(Integer.parseInt(filename.substring(0, filename.length - 4)),list); } catch ( NumberFormatException nfe ) { System.out.println("This is not an integer: \"" + filename + "\"."); } if there still error, it may be because of large number. so you can use: recsys.tweet.put(Long.parseLong(filename.substring(0, filename.length - 4)),list); //or use BigInteger recsys.tweet.put(new BigInteger(filename.substring(0, filename.length - 4)),list); You also read hidden file that contains characters, so you need to use this code: if(dr.isDirectory() &amp;&amp; !dr.isHidden()){ }

http://stackoverflow.com/a/20966139
downvote count: 0
has comment: http://stackoverflow.com/comment/31496566
type: Answer
has body: If you run whatever you are doing on one thread, and the gui on another, just terminate the other thread. Try to make your program a Runnable and then run it with an Executor, that'll be a simple solution. For example you could call a method on your main thread from the worker to see if it should terminate. Avoid terminating threads by force as a general advice.
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/20966118
has comment: http://stackoverflow.com/comment/31496434

http://stackoverflow.com/a/20857998
type: Answer
score: 2
has body: You could create a Dispatcher interface which simply defines a method dispatch(String) (or whatever you try to achieve). The base class (ClassB) uses a NullPattern which implements the interface while the child class (ClassC) implements the interface according your needs. The interface is quite simple: public interface Dispatcher { public void dispatch(String message); } The NullPattern is implemented like this: public class NullDispatcher implements Dispatcher { public void dispatch(String message) { // do nothing } } ClassB should be modified like this: public class ClassB { private Dispatcher dispatcher; public ClassB() { dispatcher = new NullDispatcher(); } public void setDispatcher(Dispatcher dispatcher) { // change this to your needs if (dispatcher == null) dispatcher = new NullDispatcher(); else this.dispatcher = dispatcher; } @Test public void myTest() { ClassA a = new ClassA(); a.createRequest(); String test = a.getResponse(); dispatcher.dispatch(test); } } Here a new Dispatcher can be set using the setDispatcher(Dispatcher) method. This dispatcher will be used in myTest to dispatch the result of a.getResponse(). The extending class just needs to set a specific implementation of the Dispatcher. F.e. to print the response to the console you could implement a ConsoleDispatcher like this: public class ConsoleDispatcher implements Dispatcher { public void dispatch(String message) { System.out.println(message); } } To use the ConsoleDispatcher instead of the NullDispatcher in ClassC you might use a code similar to: public class ClassC extends ClassB { public ClassC() { this.setDispatcher(new ConsoleDispatcher()); } } As ClassC extends ClassB you will have access to myTest which uses the defined dispatcher to dispatch the message accordingly. HTH
upvote count: 2
accepted answer of: http://stackoverflow.com/q/20857658
answers question: http://stackoverflow.com/q/20857658
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/31544124
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20966668
type: AnswerComment
has text: ok fine..I will try it out again...is there no way I could change some font xmlparser?

http://stackoverflow.com/comment/31584322
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21013793
has text: @ san . This is override method . I think it can't be change .

textures
tags question: http://stackoverflow.com/q/20911707
tag name: textures
type: Tag

http://stackoverflow.com/comment/31478762
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20957070
has text: I think, no. It does not matter.

synchronization
tags question: http://stackoverflow.com/q/20980379
tags question: http://stackoverflow.com/q/20995715
tags question: http://stackoverflow.com/q/20906548
tag name: synchronization
type: Tag
tags question: http://stackoverflow.com/q/20904601

http://stackoverflow.com/a/20942629
has comment: http://stackoverflow.com/comment/31452204
answers question: http://stackoverflow.com/q/20942506
score: 0
has body: Don't rely on an Intent extra for storing the username, since that will only be populated directly after the user logs in. Replace this: Intent intent = getIntent(); String username = intent.getStringExtra("Welcome back, username"); txt_loggedName.setText(username); With: String username = PreferenceManager.getDefaultSharedPreferences(this).getString("username", "guest"); txt_loggedName.setText("Welcome back, " + username);
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31452165
accepted answer of: http://stackoverflow.com/q/20942506
type: Answer

http://stackoverflow.com/q/20864499
answer count: 3
tagged with: junit
favorite count: 0
accepted answer: http://stackoverflow.com/a/21025960
upvote count: 3
has answer: http://stackoverflow.com/a/20864596
tagged with: unit-testing
type: AnsweredQuestion
score: 3
tagged with: java
has body: I always have the doubt if unit testing isolation should be done at very fine grain like stubbing internal method calls, look at the following example with Java, JUnit and Mockito. package com.company.domain; public class Foo { private FooHelper helper; public setHelper(FooHelper helper) { this.helper = helper; } public Double method1(Integer a, Integer b) { ... // logic here Integer var = method2(a); // internal call to method2 ... // more logic here } protected Integer method2(Integer c) { ... // logic here and return an Integer } } This is the test class: package com.company.domain; @RunWith(MockitoJUnitRunner.class) public class FooTest { @Mock private FooHelper fooHelperMock; // mocking dependencies as usual @InjectMocks @Spy Foo foo; // this way we can stub internal calls @Test public void method1Test() { doReturn(2).when(foo).method2(1); //stub the internal method call ... // stub fooHelperMock method calls here Double result = foo.method1(1, 2); assertEquals(new Double(1.54), result); verify(foo, times(1)).method2(1); ... // verify fooHelperMock method calls here } @Test public void method2Test() { ... // stub fooHelper method calls here assertEquals(new Integer(5), foo.method2(3)); ... // verify fooHelperMock method calls here } } I think this way you are able to really isolate the code under testing at method level even with internal calls. But I cannot find lot of information about this being considered a good practice or not and why.
type: Question
has title: Is it correct to isolate a unit test at method level and stub internal method calls?
tagged with: mockito
possible better answer: http://stackoverflow.com/a/20864592
downvote count: 0
has answer: http://stackoverflow.com/a/21025960
has answer: http://stackoverflow.com/a/20864592

http://stackoverflow.com/comment/31449184
has text: The keyword `static` on an inner class means something totally different. This is not a `static` class in the sense that all it's variables are essentially global - it is a `static` class in the sense that it does not need an enclosing `Thing` class to exist for it to be created. All it's instance variables are as thread safe as any other.
type: AnswerComment
score: 8
type: Comment
comment on: http://stackoverflow.com/a/20940894

http://stackoverflow.com/comment/31376681
score: 0
has text: Here's a guess: JSF is killing you. That's what your profiler says. Why don't you believe it?
type: QuestionComment
comment on: http://stackoverflow.com/q/20902629
type: Comment

http://stackoverflow.com/comment/138674973
has text: Still there in 2024 (using IntelliJ IDEA 2022.1.1 (Community edition) (c) 2000-2024). I just found moving the manifest file to (any) different location and changing the artifact settings to point to the new location fixed it (see my answer below)
type: Comment
comment on: http://stackoverflow.com/a/21074091
score: 0
type: AnswerComment

http://stackoverflow.com/a/20950733
score: 0
answers question: http://stackoverflow.com/q/20892396
has body: i think you just want to create/edit a byte[] or read a byte[] because a datagram-packet is nothing else than a byte[]!!! you might think of methods like: byte[] package; //it sould be at least 20 byte and conform to TCP/IP IPv4 public static byte[] getSourceIp(byte[] package){ byte[] sourceIp = new byte[4]; //System.arraycopy(package, 96, sourceIp, 4); //way shorter for (int i = 0; i &lt; 4; i ++){ sourceIp [i] = package[i+12]; //12=offset for source ip @ipv4 } return sourceIp; } public static void setSourceIp(byte[] sourceIp , byte[] package){ for (int i = 0; i &lt; 4; i ++){ package[i+12] = sourceIp[i]; //12=offset for source ip @ipv4 } } let's assert you byte[] package is conform to the TCP/IP IPv4 protocol and at least 160 bit (20byte) long... http://en.wikipedia.org/wiki/IPv4
type: Answer

http://stackoverflow.com/q/20872558
has answer: http://stackoverflow.com/a/20872651
tagged with: android
type: AnsweredQuestion
has title: Android Grid View String Alignment Issue
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/20872651
upvote count: 1
answer count: 1
has body: I am working on an Android application in which I need to create a "Tile" that holds four strings on the Top, Bottom, Left, and Right sides of a grid view. How can I possibly do this? It should look like this below..... Each little box would be the placeholder of a string. How would I write these strings into the boxes, and how would I position the boxes so they go exactly on the North, East, South, and West sides (centered) on each side of a square? I have been working on this for a while, and I just need help.... How would this be written in my java code (not in the XML file)?
favorite count: 0

http://stackoverflow.com/comment/31437975
has text: What I'm saing is that if you know where to put 1 in the binary array - you can instead just add the corresponding element to the current list.
comment on: http://stackoverflow.com/a/20935489
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/20857771
tagged with: keyword
type: AnsweredQuestion
has body: I have been learning Java from Java 2: Complete Reference, 5th Edition. I couldn't understand the exact of purpose this keyword and the concept of instance variable hiding. please explain me with example.
tagged with: java
has answer: http://stackoverflow.com/a/20857849
has title: Explain the functioning of "this" Keyword and the concept of Instance Variable Hiding by using "this" keyword in java
type: Question
has comment: http://stackoverflow.com/comment/31290952
linked to: http://stackoverflow.com/q/7794621
answer count: 1
has comment: http://stackoverflow.com/comment/33908780
score: 0
accepted answer: http://stackoverflow.com/a/20857849
has comment: http://stackoverflow.com/comment/31290479
favorite count: 0
upvote count: 2
downvote count: 2

http://stackoverflow.com/q/20958489
tagged with: redis
has title: Jedis Many Subscribers
has answer: http://stackoverflow.com/a/20989285
score: 2
upvote count: 2
type: UnansweredQuestion
type: Question
has body: I'm building a push server in java and am planning on using Redis PubSub to queue up messages to send to the client. Right now my implementation has a redis subscriber per device. So when a device comes online it'll subscribe to a redis queue for it's device. Does this scale ok/is there a better way? I'll have thousands of subscribers.
tagged with: java
tagged with: jedis
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/31584180
type: Comment
type: AnswerComment
has text: Thanks It realy works for me.Actually I am going to run it as an java web start to block some downloading service running on remote OS. Will it for for all versions Windows OS?
comment on: http://stackoverflow.com/a/20998111
score: 0

http://stackoverflow.com/a/21182186
type: Answer
has body: Sorry,it was my mistake. I set the wrong combiner!.When I corrected it , it worked.
score: 0
answers question: http://stackoverflow.com/q/20945542

http://stackoverflow.com/q/20929979
tagged with: biginteger
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate
type: Question
has body: I have a piece of code like this: CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery&lt;Offer&gt; query = cb.createQuery(Offer.class); Root&lt;Offer&gt; root = query.from(Offer.class); query = query.select(root).where(cb.equal(root.get(Offer_.companyID), company.getId())); return em.createQuery(query).getResultList() Now, this looks nice and dandy, but it gives me problems. Both offer.companyID and company.id are long. Here's the what log shows me that hibernate is doing: Hibernate: SELECT C.id FROM company C INNER JOIN company_operators cm ON cm.company_id = c.id WHERE cm.operators_id = '503' And this is the error I get: 12:47:00,581 ERROR [org.jboss.ejb3.invocation] (http--0.0.0.0-9080-5) JBAS014134: EJB Invocation failed on component OfferRepository for method public java.util.List org.jboss.tools.example.richfaces.data.OfferRepository.getOffersbyMemberId(java.lang.Long) throws java.lang.Exception: javax.ejb.EJBException: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long What could be the problem here?
has title: JPA BigInteger and Long issue
tagged with: long-integer
has answer: http://stackoverflow.com/a/20932759
accepted answer: http://stackoverflow.com/a/20932759
has answer: http://stackoverflow.com/a/20931723
answer count: 3
upvote count: 1
tagged with: jpa
favorite count: 0
has answer: http://stackoverflow.com/a/20933180
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20933180

http://stackoverflow.com/comment/31401592
type: AnswerComment
score: 0
type: Comment
has text: No you cannot! You will update in the other methods of `AsyncTask` as described in my edit to this answer.
comment on: http://stackoverflow.com/a/20915964

conflict
tag name: conflict
type: Tag
tags question: http://stackoverflow.com/q/20936134

http://stackoverflow.com/comment/31362754
type: QuestionComment
has text: Might be the same as http://stackoverflow.com/questions/9588827/webdriver-switch-to-new-browser-opened-after-click-on-button
type: Comment
comment on: http://stackoverflow.com/q/20895099
score: 0

http://stackoverflow.com/comment/31373992
score: 0
type: AnswerComment
has text: Sure it's an infinite loop, like most apps. It blocks on the accept() call.
type: Comment
comment on: http://stackoverflow.com/a/20902113

http://stackoverflow.com/q/20970649
tagged with: selenium
type: Question
has comment: http://stackoverflow.com/comment/31516283
downvote count: 0
has title: How to get Json data on page load OR get url generated from Json data on click event
upvote count: 1
has comment: http://stackoverflow.com/comment/31504126
favorite count: 0
has comment: http://stackoverflow.com/comment/31516654
has comment: http://stackoverflow.com/comment/31509174
type: UnansweredQuestion
has body: I'm testing an existing website and I need to pick up the url of a link and the href text = "#". If I click on the link, whatever it is opens then displays a perfectly normal URL in the browser, so the website is somehow translating "#" into a proper URL. I have several hundred items, all referenced by "#", but all opening completely different items when you click on them. I need to know what it is before I click it as I have to be able to handle it opening as a pop up or in a separate window or as a load instruction to office etc. and therefore pass the URL to different bits of code to open, depending on the file extension. I've tried: teststring = "//div[@class='" + divClass.toString() + "']/div[2]/a"; LesTestString = driver.findElement(By.xpath(teststring)).getAttribute("href"); which returns 'myWebsite.com/my/path/here/#'; and String LessLink = inputhandler.getAttribute("href"); which does the same. when I look at the element in firebug it looks like this: &lt;div class="reference span5 "&gt; &lt;a class="name math-formula" href="#"&gt; 1.1 Lesson Player &lt;/a&gt; Any suggestions? Added Information: It would seem that the URL is generated by the browser on click from various bits of information sent in a large Json string. So this questions should now be either (1) how do you pick up the url generated by the browser onclick, or (2) how do you pick up the Json sent from the server using java /selenium or something that will run in that environment?
answer count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/31525483
type: Comment
type: QuestionComment
has text: So I suppose you updated your ADT right to fix the first issue? The second part: open the properties for the project and look under `Java Build Path` is there any "red crosses" in the `Libraries` tab?
score: 0
comment on: http://stackoverflow.com/q/20980690

http://stackoverflow.com/q/21001427
has body: MoveFiles moveCSV.moveToNewFolder(source,destination); - This method always returns false for this file "REPORT_AUDIT_LOGGING_REPORT_20140102.csv". if I create any dummy CSV file, it is moved as expected. Can someone please help me to understand whats happening with this file? String csvFilename = "C:\\Data\\csv_files\\REPORT_AUDIT_LOGGING_REPORT_20140102.csv"; String OutputfileName = "GISWREPTPD_Output" + getDateTime()+ ".csv"; File outputfile = new File ("C:\\Data\\Output", OutputfileName ); CSVWriter write = new CSVWriter(new FileWriter(outputfile)); CSVReader csvR = new CSVReader(new FileReader(csvFilename), ',', '\'', 1); File source = new File ("C:\\Data\\csv_files"); File destination = new File ("C:\\Data\\Archive"); ------ ------ write.close(); MoveFiles moveCSV = new MoveFiles(); moveCSV.moveToNewFolder(source,destination); MoveFiles.java =============== public void moveToNewFolder(File source, File destination) throws IOException { for (File files : source.listFiles()) { System.out.println("File Name:"files); System.out.println("Renamed:" + files.renameTo(new File (destination, files.getName()))); } } Result: File Name:C:\Data\csv_files\GISWREPTPD_AUDIT_LOGGING_REPORT_20140102.csv Renamed:false
tagged with: java
has comment: http://stackoverflow.com/comment/31561054
has comment: http://stackoverflow.com/comment/31561296
type: Question
score: 0
has answer: http://stackoverflow.com/a/21001715
answer count: 1
has comment: http://stackoverflow.com/comment/31561050
has title: Move CSV file to another folder in java
has comment: http://stackoverflow.com/comment/31561229
has comment: http://stackoverflow.com/comment/31561342
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31562207
has comment: http://stackoverflow.com/comment/31562245
has comment: http://stackoverflow.com/comment/31561271

http://stackoverflow.com/q/20970788
tagged with: loops
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/20971223
tagged with: user-interface
has comment: http://stackoverflow.com/comment/31504462
tagged with: class
score: 0
upvote count: 1
downvote count: 1
has body: This is how my code looked in the beginning: https://gist.github.com/anonymous/8270001 Now I removed the ActionListener to a separate class: https://gist.github.com/anonymous/8257038 The program should give me a little UI, but it just keeps running without any UI popup or errors. Someone told me this: In your GUI class constructor, you are creating a new nupuVajutus object, but since nupuVajutus extends the GUI class, when you create a nupuVajutus, you are also inherently calling the GUI class constructor by default, thus creating an infinite loop If this is really the problem, then I have to say I am not that good and could use some help getting this program working with the classes separated.
favorite count: 0
type: UnansweredQuestion
has title: Separate my ActionListener from my GUI class, doesn't work properly
has answer: http://stackoverflow.com/a/20971478
tagged with: java

http://stackoverflow.com/q/20862024
favorite count: 0
has answer: http://stackoverflow.com/a/20895816
type: Question
score: 3
has body: I'm a newbie in JavaFX and I have no idea how to solve this problem. So, I have a checkbox column in a TableView. For example, I select 3 first boxes and scroll down the table. But when I go to the top of table, checkboxes are not selected. Here is some code: import javafx.application.Application; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.*; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.layout.BorderPane; import javafx.stage.Stage; import javafx.util.Callback; import java.util.LinkedList; import java.util.List; public class App extends Application { List&lt;User&gt; list = new LinkedList&lt;&gt;(); TableColumn&lt;User, Integer&gt; id; TableColumn&lt;User, String&gt; firstName; TableColumn&lt;User, Boolean&gt; selected; TableView&lt;User&gt; tableView; public static void main(String[] args) { launch(); } @Override public void start(Stage stage) throws Exception { stage.setHeight(500); stage.setWidth(500); stage.setMinHeight(200); stage.setMinHeight(100); stage.setTitle("Table view"); tableView = new TableView&lt;&gt;(); ObservableList&lt;User&gt; list = FXCollections.observableArrayList(); for(int i = 0; i &lt; 40; i++) { list.add(new User(i, "first name", "last name")); } id = new TableColumn("ID"); id.setCellValueFactory(new PropertyValueFactory&lt;User, Integer&gt;("id")); firstName = new TableColumn("First Name"); firstName.setCellValueFactory(new PropertyValueFactory&lt;User, String&gt;("firstName")); TableColumn&lt;User, String&gt; lastName = new TableColumn("Last Name"); lastName.setCellValueFactory(new PropertyValueFactory&lt;User, String&gt;("lastName")); selected = new TableColumn("Select"); Callback&lt;TableColumn&lt;User, Boolean&gt;, TableCell&lt;User, Boolean&gt;&gt; booleanCellFactory = new Callback&lt;TableColumn&lt;User, Boolean&gt;, …
upvote count: 3
has title: How to fix TableView when scrolling
answer count: 2
accepted answer: http://stackoverflow.com/a/20895816
has comment: http://stackoverflow.com/comment/31310414
possible better answer: http://stackoverflow.com/a/20886338
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/20886338
has comment: http://stackoverflow.com/comment/31331830
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/q/20853135
tagged with: valuestack
tagged with: java
type: Question
tagged with: ognl
has answer: http://stackoverflow.com/a/20862240
tagged with: struts2
tagged with: struts2-interceptors
answer count: 3
score: 2
has answer: http://stackoverflow.com/a/20854831
downvote count: 0
has body: I am new to Struts 2. I am studying it from the book Struts2 In Action. I am having difficulty in understanding some concepts in OGNL which are as follows- We know that params interceptor moves the data from the request parameters to the action object in ValueStack. Now while reading, I came upon a line that says- "The tricky part of the job is mapping the name of the parameter to an actual property on the ValueStack. This is where OGNL comes in. The params interceptor interprets the request parameter name as an OGNL expression to locate the correct destination property on the ValueStack". Question 1) Here, what does "interprets" mean? Is it that params interceptor translates the request parameter into some OGNL expression and then OGNL expression provides mapping to the properties in ValueStack OR does it mean something else? When result start its rendering process, the Struts 2 tags retrieve data from the ValueStack by referencing specific values with OGNL expressions. Question 2) So the tags take OGNL expressions, but how is the data being moved? Earlier, params interceptor was the one that moved the data but now there is no params interceptor. So how is the data being moved?
has answer: http://stackoverflow.com/a/20856600
has title: Struts 2 - Understanding the working between OGNL and params interceptor
favorite count: 0
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/q/20992894
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31545409
has title: Repaint JPanel from inside loop
linked to: http://stackoverflow.com/q/20905985
has comment: http://stackoverflow.com/comment/31545318
tagged with: repaint
score: 1
tagged with: swing
accepted answer: http://stackoverflow.com/a/20993226
type: AnsweredQuestion
tagged with: java
has body: Is it possible to repaint a JPanel from within a loop in another object? I have a JFrame that consists of a JPanel (DrawPanel) and a SA object. I would like to update/repaint the JPanel during the while loop in this SA object. I started a new thread, but still panel.repaint() does not execute. public class Mainform extends JFrame { private DrawPanel DrawPanel; public static void main(String[] args) { DrawPanel panel = new DrawPanel(); SA sa = new SA(panel); Thread t = new Thread(sa); t.start(); //... } } public class DrawPanel extends JPanel implements MouseMotionListener, MouseListener { public DrawPanel() { super(); setBackground(Color.WHITE); addMouseWheelListener(this); addMouseListener(this); addMouseMotionListener(this); } //... } public class SA implements Runnable { private DrawPanel panel; public SA(DrawPanel p) { this.panel = p; init(); } public void run() { while (true) { //... panel.repaint(); } } } EDIT: run is public
has answer: http://stackoverflow.com/a/20993226
type: Question
upvote count: 1
has comment: http://stackoverflow.com/comment/31545162

http://stackoverflow.com/a/20884119
has body: The Activity's onKeyDown / up / etc method will get called if no View consumes the event. When Views do consume the events, you will need either: a custom version of each relevant class that forwards the key presses up to the activity. add a text change listener or key listener to all TextViews in the view hierarchy (could use a recursive method to step through the entire hierarchy)
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31340813
answers question: http://stackoverflow.com/q/20854980
has comment: http://stackoverflow.com/comment/31340540
type: Answer
upvote count: 2

http://stackoverflow.com/comment/31550739
score: 0
comment on: http://stackoverflow.com/q/20993972
type: Comment
type: QuestionComment
has text: @RomanC I think he was answering me. OP: are you using the default interceptor stack (your package extends "struts-default" and you have not defined any custom interceptor stack) ?

http://stackoverflow.com/comment/31361934
type: AnswerComment
comment on: http://stackoverflow.com/a/20895152
has text: Being able to make changes to the implementation is really only part of the answer.
type: Comment
score: 2

http://stackoverflow.com/comment/31340333
type: QuestionComment
has text: what exception are you getting?
comment on: http://stackoverflow.com/q/20884018
score: 0
type: Comment

http://stackoverflow.com/comment/31360514
score: 1
has text: @Aditya I edited my solution above, can I get the check mark now :-)
type: AnswerComment
comment on: http://stackoverflow.com/a/20874242
type: Comment

http://stackoverflow.com/comment/31326359
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20876167
has text: I just wanted to start fresh, restate my question.... I'm still getting errors.....

http://stackoverflow.com/comment/31439205
type: QuestionComment
has text: Ok, There is no difference between, there is written getDialog() or new IODialog();
score: 1
comment on: http://stackoverflow.com/q/20935934
type: Comment

http://stackoverflow.com/comment/31535500
type: Comment
has text: It's all good, we all make silly mistakes :)
comment on: http://stackoverflow.com/q/20987097
score: 0
type: QuestionComment